123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975489764897748978489794898048981489824898348984489854898648987489884898948990489914899248993489944899548996489974899848999490004900149002490034900449005490064900749008490094901049011490124901349014490154901649017490184901949020490214902249023490244902549026490274902849029490304903149032490334903449035490364903749038490394904049041490424904349044490454904649047490484904949050490514905249053490544905549056490574905849059490604906149062490634906449065490664906749068490694907049071490724907349074490754907649077490784907949080490814908249083490844908549086490874908849089490904909149092490934909449095490964909749098490994910049101491024910349104491054910649107491084910949110491114911249113491144911549116491174911849119491204912149122491234912449125491264912749128491294913049131491324913349134491354913649137491384913949140491414914249143491444914549146491474914849149491504915149152491534915449155491564915749158491594916049161491624916349164491654916649167491684916949170491714917249173491744917549176491774917849179491804918149182491834918449185491864918749188491894919049191491924919349194491954919649197491984919949200492014920249203492044920549206492074920849209492104921149212492134921449215492164921749218492194922049221492224922349224492254922649227492284922949230492314923249233492344923549236492374923849239492404924149242492434924449245492464924749248492494925049251492524925349254492554925649257492584925949260492614926249263492644926549266492674926849269492704927149272492734927449275492764927749278492794928049281492824928349284492854928649287492884928949290492914929249293492944929549296492974929849299493004930149302493034930449305493064930749308493094931049311493124931349314493154931649317493184931949320493214932249323493244932549326493274932849329493304933149332493334933449335493364933749338493394934049341493424934349344493454934649347493484934949350493514935249353493544935549356493574935849359493604936149362493634936449365493664936749368493694937049371493724937349374493754937649377493784937949380493814938249383493844938549386493874938849389493904939149392493934939449395493964939749398493994940049401494024940349404494054940649407494084940949410494114941249413494144941549416494174941849419494204942149422494234942449425494264942749428494294943049431494324943349434494354943649437494384943949440494414944249443494444944549446494474944849449494504945149452494534945449455494564945749458494594946049461494624946349464494654946649467494684946949470494714947249473494744947549476494774947849479494804948149482494834948449485494864948749488494894949049491494924949349494494954949649497494984949949500495014950249503495044950549506495074950849509495104951149512495134951449515495164951749518495194952049521495224952349524495254952649527495284952949530495314953249533495344953549536495374953849539495404954149542495434954449545495464954749548495494955049551495524955349554495554955649557495584955949560495614956249563495644956549566495674956849569495704957149572495734957449575495764957749578495794958049581495824958349584495854958649587495884958949590495914959249593495944959549596495974959849599496004960149602496034960449605496064960749608496094961049611496124961349614496154961649617496184961949620496214962249623496244962549626496274962849629496304963149632496334963449635496364963749638496394964049641496424964349644496454964649647496484964949650496514965249653496544965549656496574965849659496604966149662496634966449665496664966749668496694967049671496724967349674496754967649677496784967949680496814968249683496844968549686496874968849689496904969149692496934969449695496964969749698496994970049701497024970349704497054970649707497084970949710497114971249713497144971549716497174971849719497204972149722497234972449725497264972749728497294973049731497324973349734497354973649737497384973949740497414974249743497444974549746497474974849749497504975149752497534975449755497564975749758497594976049761497624976349764497654976649767497684976949770497714977249773497744977549776497774977849779497804978149782497834978449785497864978749788497894979049791497924979349794497954979649797497984979949800498014980249803498044980549806498074980849809498104981149812498134981449815498164981749818498194982049821498224982349824498254982649827498284982949830498314983249833498344983549836498374983849839498404984149842498434984449845498464984749848498494985049851498524985349854498554985649857498584985949860498614986249863498644986549866498674986849869498704987149872498734987449875498764987749878498794988049881498824988349884498854988649887498884988949890498914989249893498944989549896498974989849899499004990149902499034990449905499064990749908499094991049911499124991349914499154991649917499184991949920499214992249923499244992549926499274992849929499304993149932499334993449935499364993749938499394994049941499424994349944499454994649947499484994949950499514995249953499544995549956499574995849959499604996149962499634996449965499664996749968499694997049971499724997349974499754997649977499784997949980499814998249983499844998549986499874998849989499904999149992499934999449995499964999749998499995000050001500025000350004500055000650007500085000950010500115001250013500145001550016500175001850019500205002150022500235002450025500265002750028500295003050031500325003350034500355003650037500385003950040500415004250043500445004550046500475004850049500505005150052500535005450055500565005750058500595006050061500625006350064500655006650067500685006950070500715007250073500745007550076500775007850079500805008150082500835008450085500865008750088500895009050091500925009350094500955009650097500985009950100501015010250103501045010550106501075010850109501105011150112501135011450115501165011750118501195012050121501225012350124501255012650127501285012950130501315013250133501345013550136501375013850139501405014150142501435014450145501465014750148501495015050151501525015350154501555015650157501585015950160501615016250163501645016550166501675016850169501705017150172501735017450175501765017750178501795018050181501825018350184501855018650187501885018950190501915019250193501945019550196501975019850199502005020150202502035020450205502065020750208502095021050211502125021350214502155021650217502185021950220502215022250223502245022550226502275022850229502305023150232502335023450235502365023750238502395024050241502425024350244502455024650247502485024950250502515025250253502545025550256502575025850259502605026150262502635026450265502665026750268502695027050271502725027350274502755027650277502785027950280502815028250283502845028550286502875028850289502905029150292502935029450295502965029750298502995030050301503025030350304503055030650307503085030950310503115031250313503145031550316503175031850319503205032150322503235032450325503265032750328503295033050331503325033350334503355033650337503385033950340503415034250343503445034550346503475034850349503505035150352503535035450355503565035750358503595036050361503625036350364503655036650367503685036950370503715037250373503745037550376503775037850379503805038150382503835038450385503865038750388503895039050391503925039350394503955039650397503985039950400504015040250403504045040550406504075040850409504105041150412504135041450415504165041750418504195042050421504225042350424504255042650427504285042950430504315043250433504345043550436504375043850439504405044150442504435044450445504465044750448504495045050451504525045350454504555045650457504585045950460504615046250463504645046550466504675046850469504705047150472504735047450475504765047750478504795048050481504825048350484504855048650487504885048950490504915049250493504945049550496504975049850499505005050150502505035050450505505065050750508505095051050511505125051350514505155051650517505185051950520505215052250523505245052550526505275052850529505305053150532505335053450535505365053750538505395054050541505425054350544505455054650547505485054950550505515055250553505545055550556505575055850559505605056150562505635056450565505665056750568505695057050571505725057350574505755057650577505785057950580505815058250583505845058550586505875058850589505905059150592505935059450595505965059750598505995060050601506025060350604506055060650607506085060950610506115061250613506145061550616506175061850619506205062150622506235062450625506265062750628506295063050631506325063350634506355063650637506385063950640506415064250643506445064550646506475064850649506505065150652506535065450655506565065750658506595066050661506625066350664506655066650667506685066950670506715067250673506745067550676506775067850679506805068150682506835068450685506865068750688506895069050691506925069350694506955069650697506985069950700507015070250703507045070550706507075070850709507105071150712507135071450715507165071750718507195072050721507225072350724507255072650727507285072950730507315073250733507345073550736507375073850739507405074150742507435074450745507465074750748507495075050751507525075350754507555075650757507585075950760507615076250763507645076550766507675076850769507705077150772507735077450775507765077750778507795078050781507825078350784507855078650787507885078950790507915079250793507945079550796507975079850799508005080150802508035080450805508065080750808508095081050811508125081350814508155081650817508185081950820508215082250823508245082550826508275082850829508305083150832508335083450835508365083750838508395084050841508425084350844508455084650847508485084950850508515085250853508545085550856508575085850859508605086150862508635086450865508665086750868508695087050871508725087350874508755087650877508785087950880508815088250883508845088550886508875088850889508905089150892508935089450895508965089750898508995090050901509025090350904509055090650907509085090950910509115091250913509145091550916509175091850919509205092150922509235092450925509265092750928509295093050931509325093350934509355093650937509385093950940509415094250943509445094550946509475094850949509505095150952509535095450955509565095750958509595096050961509625096350964509655096650967509685096950970509715097250973509745097550976509775097850979509805098150982509835098450985509865098750988509895099050991509925099350994509955099650997509985099951000510015100251003510045100551006510075100851009510105101151012510135101451015510165101751018510195102051021510225102351024510255102651027510285102951030510315103251033510345103551036510375103851039510405104151042510435104451045510465104751048510495105051051510525105351054510555105651057510585105951060510615106251063510645106551066510675106851069510705107151072510735107451075510765107751078510795108051081510825108351084510855108651087510885108951090510915109251093510945109551096510975109851099511005110151102511035110451105511065110751108511095111051111511125111351114511155111651117511185111951120511215112251123511245112551126511275112851129511305113151132511335113451135511365113751138511395114051141511425114351144511455114651147511485114951150511515115251153511545115551156511575115851159511605116151162511635116451165511665116751168511695117051171511725117351174511755117651177511785117951180511815118251183511845118551186511875118851189511905119151192511935119451195511965119751198511995120051201512025120351204512055120651207512085120951210512115121251213512145121551216512175121851219512205122151222512235122451225512265122751228512295123051231512325123351234512355123651237512385123951240512415124251243512445124551246512475124851249512505125151252512535125451255512565125751258512595126051261512625126351264512655126651267512685126951270512715127251273512745127551276512775127851279512805128151282512835128451285512865128751288512895129051291512925129351294512955129651297512985129951300513015130251303513045130551306513075130851309513105131151312513135131451315513165131751318513195132051321513225132351324513255132651327513285132951330513315133251333513345133551336513375133851339513405134151342513435134451345513465134751348513495135051351513525135351354513555135651357513585135951360513615136251363513645136551366513675136851369513705137151372513735137451375513765137751378513795138051381513825138351384513855138651387513885138951390513915139251393513945139551396513975139851399514005140151402514035140451405514065140751408514095141051411514125141351414514155141651417514185141951420514215142251423514245142551426514275142851429514305143151432514335143451435514365143751438514395144051441514425144351444514455144651447514485144951450514515145251453514545145551456514575145851459514605146151462514635146451465514665146751468514695147051471514725147351474514755147651477514785147951480514815148251483514845148551486514875148851489514905149151492514935149451495514965149751498514995150051501515025150351504515055150651507515085150951510515115151251513515145151551516515175151851519515205152151522515235152451525515265152751528515295153051531515325153351534515355153651537515385153951540515415154251543515445154551546515475154851549515505155151552515535155451555515565155751558515595156051561515625156351564515655156651567515685156951570515715157251573515745157551576515775157851579515805158151582515835158451585515865158751588515895159051591515925159351594515955159651597515985159951600516015160251603516045160551606516075160851609516105161151612516135161451615516165161751618516195162051621516225162351624516255162651627516285162951630516315163251633516345163551636516375163851639516405164151642516435164451645516465164751648516495165051651516525165351654516555165651657516585165951660516615166251663516645166551666516675166851669516705167151672516735167451675516765167751678516795168051681516825168351684516855168651687516885168951690516915169251693516945169551696516975169851699517005170151702517035170451705517065170751708517095171051711517125171351714517155171651717517185171951720517215172251723517245172551726517275172851729517305173151732517335173451735517365173751738517395174051741517425174351744517455174651747517485174951750517515175251753517545175551756517575175851759517605176151762517635176451765517665176751768517695177051771517725177351774517755177651777517785177951780517815178251783517845178551786517875178851789517905179151792517935179451795517965179751798517995180051801518025180351804518055180651807518085180951810518115181251813518145181551816518175181851819518205182151822518235182451825518265182751828518295183051831518325183351834518355183651837518385183951840518415184251843518445184551846518475184851849518505185151852518535185451855518565185751858518595186051861518625186351864518655186651867518685186951870518715187251873518745187551876518775187851879518805188151882518835188451885518865188751888518895189051891518925189351894518955189651897518985189951900519015190251903519045190551906519075190851909519105191151912519135191451915519165191751918519195192051921519225192351924519255192651927519285192951930519315193251933519345193551936519375193851939519405194151942519435194451945519465194751948519495195051951519525195351954519555195651957519585195951960519615196251963519645196551966519675196851969519705197151972519735197451975519765197751978519795198051981519825198351984519855198651987519885198951990519915199251993519945199551996519975199851999520005200152002520035200452005520065200752008520095201052011520125201352014520155201652017520185201952020520215202252023520245202552026520275202852029520305203152032520335203452035520365203752038520395204052041520425204352044520455204652047520485204952050520515205252053520545205552056520575205852059520605206152062520635206452065520665206752068520695207052071520725207352074520755207652077520785207952080520815208252083520845208552086520875208852089520905209152092520935209452095520965209752098520995210052101521025210352104521055210652107521085210952110521115211252113521145211552116521175211852119521205212152122521235212452125521265212752128521295213052131521325213352134521355213652137521385213952140521415214252143521445214552146521475214852149521505215152152521535215452155521565215752158521595216052161521625216352164521655216652167521685216952170521715217252173521745217552176521775217852179521805218152182521835218452185521865218752188521895219052191521925219352194521955219652197521985219952200522015220252203522045220552206522075220852209522105221152212522135221452215522165221752218522195222052221522225222352224522255222652227522285222952230522315223252233522345223552236522375223852239522405224152242522435224452245522465224752248522495225052251522525225352254522555225652257522585225952260522615226252263522645226552266522675226852269522705227152272522735227452275522765227752278522795228052281522825228352284522855228652287522885228952290522915229252293522945229552296522975229852299523005230152302523035230452305523065230752308523095231052311523125231352314523155231652317523185231952320523215232252323523245232552326523275232852329523305233152332523335233452335523365233752338523395234052341523425234352344523455234652347523485234952350523515235252353523545235552356523575235852359523605236152362523635236452365523665236752368523695237052371523725237352374523755237652377523785237952380523815238252383523845238552386523875238852389523905239152392523935239452395523965239752398523995240052401524025240352404524055240652407524085240952410524115241252413524145241552416524175241852419524205242152422524235242452425524265242752428524295243052431524325243352434524355243652437524385243952440524415244252443524445244552446524475244852449524505245152452524535245452455524565245752458524595246052461524625246352464524655246652467524685246952470524715247252473524745247552476524775247852479524805248152482524835248452485524865248752488524895249052491524925249352494524955249652497524985249952500525015250252503525045250552506525075250852509525105251152512525135251452515525165251752518525195252052521525225252352524525255252652527525285252952530525315253252533525345253552536525375253852539525405254152542525435254452545525465254752548525495255052551525525255352554525555255652557525585255952560525615256252563525645256552566525675256852569525705257152572525735257452575525765257752578525795258052581525825258352584525855258652587525885258952590525915259252593525945259552596525975259852599526005260152602526035260452605526065260752608526095261052611526125261352614526155261652617526185261952620526215262252623526245262552626526275262852629526305263152632526335263452635526365263752638526395264052641526425264352644526455264652647526485264952650526515265252653526545265552656526575265852659526605266152662526635266452665526665266752668526695267052671526725267352674526755267652677526785267952680526815268252683526845268552686526875268852689526905269152692526935269452695526965269752698526995270052701527025270352704527055270652707527085270952710527115271252713527145271552716527175271852719527205272152722527235272452725527265272752728527295273052731527325273352734527355273652737527385273952740527415274252743527445274552746527475274852749527505275152752527535275452755527565275752758527595276052761527625276352764527655276652767527685276952770527715277252773527745277552776527775277852779527805278152782527835278452785527865278752788527895279052791527925279352794527955279652797527985279952800528015280252803528045280552806528075280852809528105281152812528135281452815528165281752818528195282052821528225282352824528255282652827528285282952830528315283252833528345283552836528375283852839528405284152842528435284452845528465284752848528495285052851528525285352854528555285652857528585285952860528615286252863528645286552866528675286852869528705287152872528735287452875528765287752878528795288052881528825288352884528855288652887528885288952890528915289252893528945289552896528975289852899529005290152902529035290452905529065290752908529095291052911529125291352914529155291652917529185291952920529215292252923529245292552926529275292852929529305293152932529335293452935529365293752938529395294052941529425294352944529455294652947529485294952950529515295252953529545295552956529575295852959529605296152962529635296452965529665296752968529695297052971529725297352974529755297652977529785297952980529815298252983529845298552986529875298852989529905299152992529935299452995529965299752998529995300053001530025300353004530055300653007530085300953010530115301253013530145301553016530175301853019530205302153022530235302453025530265302753028530295303053031530325303353034530355303653037530385303953040530415304253043530445304553046530475304853049530505305153052530535305453055530565305753058530595306053061530625306353064530655306653067530685306953070530715307253073530745307553076530775307853079530805308153082530835308453085530865308753088530895309053091530925309353094530955309653097530985309953100531015310253103531045310553106531075310853109531105311153112531135311453115531165311753118531195312053121531225312353124531255312653127531285312953130531315313253133531345313553136531375313853139531405314153142531435314453145531465314753148531495315053151531525315353154531555315653157531585315953160531615316253163531645316553166531675316853169531705317153172531735317453175531765317753178531795318053181531825318353184531855318653187531885318953190531915319253193531945319553196531975319853199532005320153202532035320453205532065320753208532095321053211532125321353214532155321653217532185321953220532215322253223532245322553226532275322853229532305323153232532335323453235532365323753238532395324053241532425324353244532455324653247532485324953250532515325253253532545325553256532575325853259532605326153262532635326453265532665326753268532695327053271532725327353274532755327653277532785327953280532815328253283532845328553286532875328853289532905329153292532935329453295532965329753298532995330053301533025330353304533055330653307533085330953310533115331253313533145331553316533175331853319533205332153322533235332453325533265332753328533295333053331533325333353334533355333653337533385333953340533415334253343533445334553346533475334853349533505335153352533535335453355533565335753358533595336053361533625336353364533655336653367533685336953370533715337253373533745337553376533775337853379533805338153382533835338453385533865338753388533895339053391533925339353394533955339653397533985339953400534015340253403534045340553406534075340853409534105341153412534135341453415534165341753418534195342053421534225342353424534255342653427534285342953430534315343253433534345343553436534375343853439534405344153442534435344453445534465344753448534495345053451534525345353454534555345653457534585345953460534615346253463534645346553466534675346853469534705347153472534735347453475534765347753478534795348053481534825348353484534855348653487534885348953490534915349253493534945349553496534975349853499535005350153502535035350453505535065350753508535095351053511535125351353514535155351653517535185351953520535215352253523535245352553526535275352853529535305353153532535335353453535535365353753538535395354053541535425354353544535455354653547535485354953550535515355253553535545355553556535575355853559535605356153562535635356453565535665356753568535695357053571535725357353574535755357653577535785357953580535815358253583535845358553586535875358853589535905359153592535935359453595535965359753598535995360053601536025360353604536055360653607536085360953610536115361253613536145361553616536175361853619536205362153622536235362453625536265362753628536295363053631536325363353634536355363653637536385363953640536415364253643536445364553646536475364853649536505365153652536535365453655536565365753658536595366053661536625366353664536655366653667536685366953670536715367253673536745367553676536775367853679536805368153682536835368453685536865368753688536895369053691536925369353694536955369653697536985369953700537015370253703537045370553706537075370853709537105371153712537135371453715537165371753718537195372053721537225372353724537255372653727537285372953730537315373253733537345373553736537375373853739537405374153742537435374453745537465374753748537495375053751537525375353754537555375653757537585375953760537615376253763537645376553766537675376853769537705377153772537735377453775537765377753778537795378053781537825378353784537855378653787537885378953790537915379253793537945379553796537975379853799538005380153802538035380453805538065380753808538095381053811538125381353814538155381653817538185381953820538215382253823538245382553826538275382853829538305383153832538335383453835538365383753838538395384053841538425384353844538455384653847538485384953850538515385253853538545385553856538575385853859538605386153862538635386453865538665386753868538695387053871538725387353874538755387653877538785387953880538815388253883538845388553886538875388853889538905389153892538935389453895538965389753898538995390053901539025390353904539055390653907539085390953910539115391253913539145391553916539175391853919539205392153922539235392453925539265392753928539295393053931539325393353934539355393653937539385393953940539415394253943539445394553946539475394853949539505395153952539535395453955539565395753958539595396053961539625396353964539655396653967539685396953970539715397253973539745397553976539775397853979539805398153982539835398453985539865398753988539895399053991539925399353994539955399653997539985399954000540015400254003540045400554006540075400854009540105401154012540135401454015540165401754018540195402054021540225402354024540255402654027540285402954030540315403254033540345403554036540375403854039540405404154042540435404454045540465404754048540495405054051540525405354054540555405654057540585405954060540615406254063540645406554066540675406854069540705407154072540735407454075540765407754078540795408054081540825408354084540855408654087540885408954090540915409254093540945409554096540975409854099541005410154102541035410454105541065410754108541095411054111541125411354114541155411654117541185411954120541215412254123541245412554126541275412854129541305413154132541335413454135541365413754138541395414054141541425414354144541455414654147541485414954150541515415254153541545415554156541575415854159541605416154162541635416454165541665416754168541695417054171541725417354174541755417654177541785417954180541815418254183541845418554186541875418854189541905419154192541935419454195541965419754198541995420054201542025420354204542055420654207542085420954210542115421254213542145421554216542175421854219542205422154222542235422454225542265422754228542295423054231542325423354234542355423654237542385423954240542415424254243542445424554246542475424854249542505425154252542535425454255542565425754258542595426054261542625426354264542655426654267542685426954270542715427254273542745427554276542775427854279542805428154282542835428454285542865428754288542895429054291542925429354294542955429654297542985429954300543015430254303543045430554306543075430854309543105431154312543135431454315543165431754318543195432054321543225432354324543255432654327543285432954330543315433254333543345433554336543375433854339543405434154342543435434454345543465434754348543495435054351543525435354354543555435654357543585435954360543615436254363543645436554366543675436854369543705437154372543735437454375543765437754378543795438054381543825438354384543855438654387543885438954390543915439254393543945439554396543975439854399544005440154402544035440454405544065440754408544095441054411544125441354414544155441654417544185441954420544215442254423544245442554426544275442854429544305443154432544335443454435544365443754438544395444054441544425444354444544455444654447544485444954450544515445254453544545445554456544575445854459544605446154462544635446454465544665446754468544695447054471544725447354474544755447654477544785447954480544815448254483544845448554486544875448854489544905449154492544935449454495544965449754498544995450054501545025450354504545055450654507545085450954510545115451254513545145451554516545175451854519545205452154522545235452454525545265452754528545295453054531545325453354534545355453654537545385453954540545415454254543545445454554546545475454854549545505455154552545535455454555545565455754558545595456054561545625456354564545655456654567545685456954570545715457254573545745457554576545775457854579545805458154582545835458454585545865458754588545895459054591545925459354594545955459654597545985459954600546015460254603546045460554606546075460854609546105461154612546135461454615546165461754618546195462054621546225462354624546255462654627546285462954630546315463254633546345463554636546375463854639546405464154642546435464454645546465464754648546495465054651546525465354654546555465654657546585465954660546615466254663546645466554666546675466854669546705467154672546735467454675546765467754678546795468054681546825468354684546855468654687546885468954690546915469254693546945469554696546975469854699547005470154702547035470454705547065470754708547095471054711547125471354714547155471654717547185471954720547215472254723547245472554726547275472854729547305473154732547335473454735547365473754738547395474054741547425474354744547455474654747547485474954750547515475254753547545475554756547575475854759547605476154762547635476454765547665476754768547695477054771547725477354774547755477654777547785477954780547815478254783547845478554786547875478854789547905479154792547935479454795547965479754798547995480054801548025480354804548055480654807548085480954810548115481254813548145481554816548175481854819548205482154822548235482454825548265482754828548295483054831548325483354834548355483654837548385483954840548415484254843548445484554846548475484854849548505485154852548535485454855548565485754858548595486054861548625486354864548655486654867548685486954870548715487254873548745487554876548775487854879548805488154882548835488454885548865488754888548895489054891548925489354894548955489654897548985489954900549015490254903549045490554906549075490854909549105491154912549135491454915549165491754918549195492054921549225492354924549255492654927549285492954930549315493254933549345493554936549375493854939549405494154942549435494454945549465494754948549495495054951549525495354954549555495654957549585495954960549615496254963549645496554966549675496854969549705497154972549735497454975549765497754978549795498054981549825498354984549855498654987549885498954990549915499254993549945499554996549975499854999550005500155002550035500455005550065500755008550095501055011550125501355014550155501655017550185501955020550215502255023550245502555026550275502855029550305503155032550335503455035550365503755038550395504055041550425504355044550455504655047550485504955050550515505255053550545505555056550575505855059550605506155062550635506455065550665506755068550695507055071550725507355074550755507655077550785507955080550815508255083550845508555086550875508855089550905509155092550935509455095550965509755098550995510055101551025510355104551055510655107551085510955110551115511255113551145511555116551175511855119551205512155122551235512455125551265512755128551295513055131551325513355134551355513655137551385513955140551415514255143551445514555146551475514855149551505515155152551535515455155551565515755158551595516055161551625516355164551655516655167551685516955170551715517255173551745517555176551775517855179551805518155182551835518455185551865518755188551895519055191551925519355194551955519655197551985519955200552015520255203552045520555206552075520855209552105521155212552135521455215552165521755218552195522055221552225522355224552255522655227552285522955230552315523255233552345523555236552375523855239552405524155242552435524455245552465524755248552495525055251552525525355254552555525655257552585525955260552615526255263552645526555266552675526855269552705527155272552735527455275552765527755278552795528055281552825528355284552855528655287552885528955290552915529255293552945529555296552975529855299553005530155302553035530455305553065530755308553095531055311553125531355314553155531655317553185531955320553215532255323553245532555326553275532855329553305533155332553335533455335553365533755338553395534055341553425534355344553455534655347553485534955350553515535255353553545535555356553575535855359553605536155362553635536455365553665536755368553695537055371553725537355374553755537655377553785537955380553815538255383553845538555386553875538855389553905539155392553935539455395553965539755398553995540055401554025540355404554055540655407554085540955410554115541255413554145541555416554175541855419554205542155422554235542455425554265542755428554295543055431554325543355434554355543655437554385543955440554415544255443554445544555446554475544855449554505545155452554535545455455554565545755458554595546055461554625546355464554655546655467554685546955470554715547255473554745547555476554775547855479554805548155482554835548455485554865548755488554895549055491554925549355494554955549655497554985549955500555015550255503555045550555506555075550855509555105551155512555135551455515555165551755518555195552055521555225552355524555255552655527555285552955530555315553255533555345553555536555375553855539555405554155542555435554455545555465554755548555495555055551555525555355554555555555655557555585555955560555615556255563555645556555566555675556855569555705557155572555735557455575555765557755578555795558055581555825558355584555855558655587555885558955590555915559255593555945559555596555975559855599556005560155602556035560455605556065560755608556095561055611556125561355614556155561655617556185561955620556215562255623556245562555626556275562855629556305563155632556335563455635556365563755638556395564055641556425564355644556455564655647556485564955650556515565255653556545565555656556575565855659556605566155662556635566455665556665566755668556695567055671556725567355674556755567655677556785567955680556815568255683556845568555686556875568855689556905569155692556935569455695556965569755698556995570055701557025570355704557055570655707557085570955710557115571255713557145571555716557175571855719557205572155722557235572455725557265572755728557295573055731557325573355734557355573655737557385573955740557415574255743557445574555746557475574855749557505575155752557535575455755557565575755758557595576055761557625576355764557655576655767557685576955770557715577255773557745577555776557775577855779557805578155782557835578455785557865578755788557895579055791557925579355794557955579655797557985579955800558015580255803558045580555806558075580855809558105581155812558135581455815558165581755818558195582055821558225582355824558255582655827558285582955830558315583255833558345583555836558375583855839558405584155842558435584455845558465584755848558495585055851558525585355854558555585655857558585585955860558615586255863558645586555866558675586855869558705587155872558735587455875558765587755878558795588055881558825588355884558855588655887558885588955890558915589255893558945589555896558975589855899559005590155902559035590455905559065590755908559095591055911559125591355914559155591655917559185591955920559215592255923559245592555926559275592855929559305593155932559335593455935559365593755938559395594055941559425594355944559455594655947559485594955950559515595255953559545595555956559575595855959559605596155962559635596455965559665596755968559695597055971559725597355974559755597655977559785597955980559815598255983559845598555986559875598855989559905599155992559935599455995559965599755998559995600056001560025600356004560055600656007560085600956010560115601256013560145601556016560175601856019560205602156022560235602456025560265602756028560295603056031560325603356034560355603656037560385603956040560415604256043560445604556046560475604856049560505605156052560535605456055560565605756058560595606056061560625606356064560655606656067560685606956070560715607256073560745607556076560775607856079560805608156082560835608456085560865608756088560895609056091560925609356094560955609656097560985609956100561015610256103561045610556106561075610856109561105611156112561135611456115561165611756118561195612056121561225612356124561255612656127561285612956130561315613256133561345613556136561375613856139561405614156142561435614456145561465614756148561495615056151561525615356154561555615656157561585615956160561615616256163561645616556166561675616856169561705617156172561735617456175561765617756178561795618056181561825618356184561855618656187561885618956190561915619256193561945619556196561975619856199562005620156202562035620456205562065620756208562095621056211562125621356214562155621656217562185621956220562215622256223562245622556226562275622856229562305623156232562335623456235562365623756238562395624056241562425624356244562455624656247562485624956250562515625256253562545625556256562575625856259562605626156262562635626456265562665626756268562695627056271562725627356274562755627656277562785627956280562815628256283562845628556286562875628856289562905629156292562935629456295562965629756298562995630056301563025630356304563055630656307563085630956310563115631256313563145631556316563175631856319563205632156322563235632456325563265632756328563295633056331563325633356334563355633656337563385633956340563415634256343563445634556346563475634856349563505635156352563535635456355563565635756358563595636056361563625636356364563655636656367563685636956370563715637256373563745637556376563775637856379563805638156382563835638456385563865638756388563895639056391563925639356394563955639656397563985639956400564015640256403564045640556406564075640856409564105641156412564135641456415564165641756418564195642056421564225642356424564255642656427564285642956430564315643256433564345643556436564375643856439564405644156442564435644456445564465644756448564495645056451564525645356454564555645656457564585645956460564615646256463564645646556466564675646856469564705647156472564735647456475564765647756478564795648056481564825648356484564855648656487564885648956490564915649256493564945649556496564975649856499565005650156502565035650456505565065650756508565095651056511565125651356514565155651656517565185651956520565215652256523565245652556526565275652856529565305653156532565335653456535565365653756538565395654056541565425654356544565455654656547565485654956550565515655256553565545655556556565575655856559565605656156562565635656456565565665656756568565695657056571565725657356574565755657656577565785657956580565815658256583565845658556586565875658856589565905659156592565935659456595565965659756598565995660056601566025660356604566055660656607566085660956610566115661256613566145661556616566175661856619566205662156622566235662456625566265662756628566295663056631566325663356634566355663656637566385663956640566415664256643566445664556646566475664856649566505665156652566535665456655566565665756658566595666056661566625666356664566655666656667566685666956670566715667256673566745667556676566775667856679566805668156682566835668456685566865668756688566895669056691566925669356694566955669656697566985669956700567015670256703567045670556706567075670856709567105671156712567135671456715567165671756718567195672056721567225672356724567255672656727567285672956730567315673256733567345673556736567375673856739567405674156742567435674456745567465674756748567495675056751567525675356754567555675656757567585675956760567615676256763567645676556766567675676856769567705677156772567735677456775567765677756778567795678056781567825678356784567855678656787567885678956790567915679256793567945679556796567975679856799568005680156802568035680456805568065680756808568095681056811568125681356814568155681656817568185681956820568215682256823568245682556826568275682856829568305683156832568335683456835568365683756838568395684056841568425684356844568455684656847568485684956850568515685256853568545685556856568575685856859568605686156862568635686456865568665686756868568695687056871568725687356874568755687656877568785687956880568815688256883568845688556886568875688856889568905689156892568935689456895568965689756898568995690056901569025690356904569055690656907569085690956910569115691256913569145691556916569175691856919569205692156922569235692456925569265692756928569295693056931569325693356934569355693656937569385693956940569415694256943569445694556946569475694856949569505695156952569535695456955569565695756958569595696056961569625696356964569655696656967569685696956970569715697256973569745697556976569775697856979569805698156982569835698456985569865698756988569895699056991569925699356994569955699656997569985699957000570015700257003570045700557006570075700857009570105701157012570135701457015570165701757018570195702057021570225702357024570255702657027570285702957030570315703257033570345703557036570375703857039570405704157042570435704457045570465704757048570495705057051570525705357054570555705657057570585705957060570615706257063570645706557066570675706857069570705707157072570735707457075570765707757078570795708057081570825708357084570855708657087570885708957090570915709257093570945709557096570975709857099571005710157102571035710457105571065710757108571095711057111571125711357114571155711657117571185711957120571215712257123571245712557126571275712857129571305713157132571335713457135571365713757138571395714057141571425714357144571455714657147571485714957150571515715257153571545715557156571575715857159571605716157162571635716457165571665716757168571695717057171571725717357174571755717657177571785717957180571815718257183571845718557186571875718857189571905719157192571935719457195571965719757198571995720057201572025720357204572055720657207572085720957210572115721257213572145721557216572175721857219572205722157222572235722457225572265722757228572295723057231572325723357234572355723657237572385723957240572415724257243572445724557246572475724857249572505725157252572535725457255572565725757258572595726057261572625726357264572655726657267572685726957270572715727257273572745727557276572775727857279572805728157282572835728457285572865728757288572895729057291572925729357294572955729657297572985729957300573015730257303573045730557306573075730857309573105731157312573135731457315573165731757318573195732057321573225732357324573255732657327573285732957330573315733257333573345733557336573375733857339573405734157342573435734457345573465734757348573495735057351573525735357354573555735657357573585735957360573615736257363573645736557366573675736857369573705737157372573735737457375573765737757378573795738057381573825738357384573855738657387573885738957390573915739257393573945739557396573975739857399574005740157402574035740457405574065740757408574095741057411574125741357414574155741657417574185741957420574215742257423574245742557426574275742857429574305743157432574335743457435574365743757438574395744057441574425744357444574455744657447574485744957450574515745257453574545745557456574575745857459574605746157462574635746457465574665746757468574695747057471574725747357474574755747657477574785747957480574815748257483574845748557486574875748857489574905749157492574935749457495574965749757498574995750057501575025750357504575055750657507575085750957510575115751257513575145751557516575175751857519575205752157522575235752457525575265752757528575295753057531575325753357534575355753657537575385753957540575415754257543575445754557546575475754857549575505755157552575535755457555575565755757558575595756057561575625756357564575655756657567575685756957570575715757257573575745757557576575775757857579575805758157582575835758457585575865758757588575895759057591575925759357594575955759657597575985759957600576015760257603576045760557606576075760857609576105761157612576135761457615576165761757618576195762057621576225762357624576255762657627576285762957630576315763257633576345763557636576375763857639576405764157642576435764457645576465764757648576495765057651576525765357654576555765657657576585765957660576615766257663576645766557666576675766857669576705767157672576735767457675576765767757678576795768057681576825768357684576855768657687576885768957690576915769257693576945769557696576975769857699577005770157702577035770457705577065770757708577095771057711577125771357714577155771657717577185771957720577215772257723577245772557726577275772857729577305773157732577335773457735577365773757738577395774057741577425774357744577455774657747577485774957750577515775257753577545775557756577575775857759577605776157762577635776457765577665776757768577695777057771577725777357774577755777657777577785777957780577815778257783577845778557786577875778857789577905779157792577935779457795577965779757798577995780057801578025780357804578055780657807578085780957810578115781257813578145781557816578175781857819578205782157822578235782457825578265782757828578295783057831578325783357834578355783657837578385783957840578415784257843578445784557846578475784857849578505785157852578535785457855578565785757858578595786057861578625786357864578655786657867578685786957870578715787257873578745787557876578775787857879578805788157882578835788457885578865788757888578895789057891578925789357894578955789657897578985789957900579015790257903579045790557906579075790857909579105791157912579135791457915579165791757918579195792057921579225792357924579255792657927579285792957930579315793257933579345793557936579375793857939579405794157942579435794457945579465794757948579495795057951579525795357954579555795657957579585795957960579615796257963579645796557966579675796857969579705797157972579735797457975579765797757978579795798057981579825798357984579855798657987579885798957990579915799257993579945799557996579975799857999580005800158002580035800458005580065800758008580095801058011580125801358014580155801658017580185801958020580215802258023580245802558026580275802858029580305803158032580335803458035580365803758038580395804058041580425804358044580455804658047580485804958050580515805258053580545805558056580575805858059580605806158062580635806458065580665806758068580695807058071580725807358074580755807658077580785807958080580815808258083580845808558086580875808858089580905809158092580935809458095580965809758098580995810058101581025810358104581055810658107581085810958110581115811258113581145811558116581175811858119581205812158122581235812458125581265812758128581295813058131581325813358134581355813658137581385813958140581415814258143581445814558146581475814858149581505815158152581535815458155581565815758158581595816058161581625816358164581655816658167581685816958170581715817258173581745817558176581775817858179581805818158182581835818458185581865818758188581895819058191581925819358194581955819658197581985819958200582015820258203582045820558206582075820858209582105821158212582135821458215582165821758218582195822058221582225822358224582255822658227582285822958230582315823258233582345823558236582375823858239582405824158242582435824458245582465824758248582495825058251582525825358254582555825658257582585825958260582615826258263582645826558266582675826858269582705827158272582735827458275582765827758278582795828058281582825828358284582855828658287582885828958290582915829258293582945829558296582975829858299583005830158302583035830458305583065830758308583095831058311583125831358314583155831658317583185831958320583215832258323583245832558326583275832858329583305833158332583335833458335583365833758338583395834058341583425834358344583455834658347583485834958350583515835258353583545835558356583575835858359583605836158362583635836458365583665836758368583695837058371583725837358374583755837658377583785837958380583815838258383583845838558386583875838858389583905839158392583935839458395583965839758398583995840058401584025840358404584055840658407584085840958410584115841258413584145841558416584175841858419584205842158422584235842458425584265842758428584295843058431584325843358434584355843658437584385843958440584415844258443584445844558446584475844858449584505845158452584535845458455584565845758458584595846058461584625846358464584655846658467584685846958470584715847258473584745847558476584775847858479584805848158482584835848458485584865848758488584895849058491584925849358494584955849658497584985849958500585015850258503585045850558506585075850858509585105851158512585135851458515585165851758518585195852058521585225852358524585255852658527585285852958530585315853258533585345853558536585375853858539585405854158542585435854458545585465854758548585495855058551585525855358554585555855658557585585855958560585615856258563585645856558566585675856858569585705857158572585735857458575585765857758578585795858058581585825858358584585855858658587585885858958590585915859258593585945859558596585975859858599586005860158602586035860458605586065860758608586095861058611586125861358614586155861658617586185861958620586215862258623586245862558626586275862858629586305863158632586335863458635586365863758638586395864058641586425864358644586455864658647586485864958650586515865258653586545865558656586575865858659586605866158662586635866458665586665866758668586695867058671586725867358674586755867658677586785867958680586815868258683586845868558686586875868858689586905869158692586935869458695586965869758698586995870058701587025870358704587055870658707587085870958710587115871258713587145871558716587175871858719587205872158722587235872458725587265872758728587295873058731587325873358734587355873658737587385873958740587415874258743587445874558746587475874858749587505875158752587535875458755587565875758758587595876058761587625876358764587655876658767587685876958770587715877258773587745877558776587775877858779587805878158782587835878458785587865878758788587895879058791587925879358794587955879658797587985879958800588015880258803588045880558806588075880858809588105881158812588135881458815588165881758818588195882058821588225882358824588255882658827588285882958830588315883258833588345883558836588375883858839588405884158842588435884458845588465884758848588495885058851588525885358854588555885658857588585885958860588615886258863588645886558866588675886858869588705887158872588735887458875588765887758878588795888058881588825888358884588855888658887588885888958890588915889258893588945889558896588975889858899589005890158902589035890458905589065890758908589095891058911589125891358914589155891658917589185891958920589215892258923589245892558926589275892858929589305893158932589335893458935589365893758938589395894058941589425894358944589455894658947589485894958950589515895258953589545895558956589575895858959589605896158962589635896458965589665896758968589695897058971589725897358974589755897658977589785897958980589815898258983589845898558986589875898858989589905899158992589935899458995589965899758998589995900059001590025900359004590055900659007590085900959010590115901259013590145901559016590175901859019590205902159022590235902459025590265902759028590295903059031590325903359034590355903659037590385903959040590415904259043590445904559046590475904859049590505905159052590535905459055590565905759058590595906059061590625906359064590655906659067590685906959070590715907259073590745907559076590775907859079590805908159082590835908459085590865908759088590895909059091590925909359094590955909659097590985909959100591015910259103591045910559106591075910859109591105911159112591135911459115591165911759118591195912059121591225912359124591255912659127591285912959130591315913259133591345913559136591375913859139591405914159142591435914459145591465914759148591495915059151591525915359154591555915659157591585915959160591615916259163591645916559166591675916859169591705917159172591735917459175591765917759178591795918059181591825918359184591855918659187591885918959190591915919259193591945919559196591975919859199592005920159202592035920459205592065920759208592095921059211592125921359214592155921659217592185921959220592215922259223592245922559226592275922859229592305923159232592335923459235592365923759238592395924059241592425924359244592455924659247592485924959250592515925259253592545925559256592575925859259592605926159262592635926459265592665926759268592695927059271592725927359274592755927659277592785927959280592815928259283592845928559286592875928859289592905929159292592935929459295592965929759298592995930059301593025930359304593055930659307593085930959310593115931259313593145931559316593175931859319593205932159322593235932459325593265932759328593295933059331593325933359334593355933659337593385933959340593415934259343593445934559346593475934859349593505935159352593535935459355593565935759358593595936059361593625936359364593655936659367593685936959370593715937259373593745937559376593775937859379593805938159382593835938459385593865938759388593895939059391593925939359394593955939659397593985939959400594015940259403594045940559406594075940859409594105941159412594135941459415594165941759418594195942059421594225942359424594255942659427594285942959430594315943259433594345943559436594375943859439594405944159442594435944459445594465944759448594495945059451594525945359454594555945659457594585945959460594615946259463594645946559466594675946859469594705947159472594735947459475594765947759478594795948059481594825948359484594855948659487594885948959490594915949259493594945949559496594975949859499595005950159502595035950459505595065950759508595095951059511595125951359514595155951659517595185951959520595215952259523595245952559526595275952859529595305953159532595335953459535595365953759538595395954059541595425954359544595455954659547595485954959550595515955259553595545955559556595575955859559595605956159562595635956459565595665956759568595695957059571595725957359574595755957659577595785957959580595815958259583595845958559586595875958859589595905959159592595935959459595595965959759598595995960059601596025960359604596055960659607596085960959610596115961259613596145961559616596175961859619596205962159622596235962459625596265962759628596295963059631596325963359634596355963659637596385963959640596415964259643596445964559646596475964859649596505965159652596535965459655596565965759658596595966059661596625966359664596655966659667596685966959670596715967259673596745967559676596775967859679596805968159682596835968459685596865968759688596895969059691596925969359694596955969659697596985969959700597015970259703597045970559706597075970859709597105971159712597135971459715597165971759718597195972059721597225972359724597255972659727597285972959730597315973259733597345973559736597375973859739597405974159742597435974459745597465974759748597495975059751597525975359754597555975659757597585975959760597615976259763597645976559766597675976859769597705977159772597735977459775597765977759778597795978059781597825978359784597855978659787597885978959790597915979259793597945979559796597975979859799598005980159802598035980459805598065980759808598095981059811598125981359814598155981659817598185981959820598215982259823598245982559826598275982859829598305983159832598335983459835598365983759838598395984059841598425984359844598455984659847598485984959850598515985259853598545985559856598575985859859598605986159862598635986459865598665986759868598695987059871598725987359874598755987659877598785987959880598815988259883598845988559886598875988859889598905989159892598935989459895598965989759898598995990059901599025990359904599055990659907599085990959910599115991259913599145991559916599175991859919599205992159922599235992459925599265992759928599295993059931599325993359934599355993659937599385993959940599415994259943599445994559946599475994859949599505995159952599535995459955599565995759958599595996059961599625996359964599655996659967599685996959970599715997259973599745997559976599775997859979599805998159982599835998459985599865998759988599895999059991599925999359994599955999659997599985999960000600016000260003600046000560006600076000860009600106001160012600136001460015600166001760018600196002060021600226002360024600256002660027600286002960030600316003260033600346003560036600376003860039600406004160042600436004460045600466004760048600496005060051600526005360054600556005660057600586005960060600616006260063600646006560066600676006860069600706007160072600736007460075600766007760078600796008060081600826008360084600856008660087600886008960090600916009260093600946009560096600976009860099601006010160102601036010460105601066010760108601096011060111601126011360114601156011660117601186011960120601216012260123601246012560126601276012860129601306013160132601336013460135601366013760138601396014060141601426014360144601456014660147601486014960150601516015260153601546015560156601576015860159601606016160162601636016460165601666016760168601696017060171601726017360174601756017660177601786017960180601816018260183601846018560186601876018860189601906019160192601936019460195601966019760198601996020060201602026020360204602056020660207602086020960210602116021260213602146021560216602176021860219602206022160222602236022460225602266022760228602296023060231602326023360234602356023660237602386023960240602416024260243602446024560246602476024860249602506025160252602536025460255602566025760258602596026060261602626026360264602656026660267602686026960270602716027260273602746027560276602776027860279602806028160282602836028460285602866028760288602896029060291602926029360294602956029660297602986029960300603016030260303603046030560306603076030860309603106031160312603136031460315603166031760318603196032060321603226032360324603256032660327603286032960330603316033260333603346033560336603376033860339603406034160342603436034460345603466034760348603496035060351603526035360354603556035660357603586035960360603616036260363603646036560366603676036860369603706037160372603736037460375603766037760378603796038060381603826038360384603856038660387603886038960390603916039260393603946039560396603976039860399604006040160402604036040460405604066040760408604096041060411604126041360414604156041660417604186041960420604216042260423604246042560426604276042860429604306043160432604336043460435604366043760438604396044060441604426044360444604456044660447604486044960450604516045260453604546045560456604576045860459604606046160462604636046460465604666046760468604696047060471604726047360474604756047660477604786047960480604816048260483604846048560486604876048860489604906049160492604936049460495604966049760498604996050060501605026050360504605056050660507605086050960510605116051260513605146051560516605176051860519605206052160522605236052460525605266052760528605296053060531605326053360534605356053660537605386053960540605416054260543605446054560546605476054860549605506055160552605536055460555605566055760558605596056060561605626056360564605656056660567605686056960570605716057260573605746057560576605776057860579605806058160582605836058460585605866058760588605896059060591605926059360594605956059660597605986059960600606016060260603606046060560606606076060860609606106061160612606136061460615606166061760618606196062060621606226062360624606256062660627606286062960630606316063260633606346063560636606376063860639606406064160642606436064460645606466064760648606496065060651606526065360654606556065660657606586065960660606616066260663606646066560666606676066860669606706067160672606736067460675606766067760678606796068060681606826068360684606856068660687606886068960690606916069260693606946069560696606976069860699607006070160702607036070460705607066070760708607096071060711607126071360714607156071660717607186071960720607216072260723607246072560726607276072860729607306073160732607336073460735607366073760738607396074060741607426074360744607456074660747607486074960750607516075260753607546075560756607576075860759607606076160762607636076460765607666076760768607696077060771607726077360774607756077660777607786077960780607816078260783607846078560786607876078860789607906079160792607936079460795607966079760798607996080060801608026080360804608056080660807608086080960810608116081260813608146081560816608176081860819608206082160822608236082460825608266082760828608296083060831608326083360834608356083660837608386083960840608416084260843608446084560846608476084860849608506085160852608536085460855608566085760858608596086060861608626086360864608656086660867608686086960870608716087260873608746087560876608776087860879608806088160882608836088460885608866088760888608896089060891608926089360894608956089660897608986089960900609016090260903609046090560906609076090860909609106091160912609136091460915609166091760918609196092060921609226092360924609256092660927609286092960930609316093260933609346093560936609376093860939609406094160942609436094460945609466094760948609496095060951609526095360954609556095660957609586095960960609616096260963609646096560966609676096860969609706097160972609736097460975609766097760978609796098060981609826098360984609856098660987609886098960990609916099260993609946099560996609976099860999610006100161002610036100461005610066100761008610096101061011610126101361014610156101661017610186101961020610216102261023610246102561026610276102861029610306103161032610336103461035610366103761038610396104061041610426104361044610456104661047610486104961050610516105261053610546105561056610576105861059610606106161062610636106461065610666106761068610696107061071610726107361074610756107661077610786107961080610816108261083610846108561086610876108861089610906109161092610936109461095610966109761098610996110061101611026110361104611056110661107611086110961110611116111261113611146111561116611176111861119611206112161122611236112461125611266112761128611296113061131611326113361134611356113661137611386113961140611416114261143611446114561146611476114861149611506115161152611536115461155611566115761158611596116061161611626116361164611656116661167611686116961170611716117261173611746117561176611776117861179611806118161182611836118461185611866118761188611896119061191611926119361194611956119661197611986119961200612016120261203612046120561206612076120861209612106121161212612136121461215612166121761218612196122061221612226122361224612256122661227612286122961230612316123261233612346123561236612376123861239612406124161242612436124461245612466124761248612496125061251612526125361254612556125661257612586125961260612616126261263612646126561266612676126861269612706127161272612736127461275612766127761278612796128061281612826128361284612856128661287612886128961290612916129261293612946129561296612976129861299613006130161302613036130461305613066130761308613096131061311613126131361314613156131661317613186131961320613216132261323613246132561326613276132861329613306133161332613336133461335613366133761338613396134061341613426134361344613456134661347613486134961350613516135261353613546135561356613576135861359613606136161362613636136461365613666136761368613696137061371613726137361374613756137661377613786137961380613816138261383613846138561386613876138861389613906139161392613936139461395613966139761398613996140061401614026140361404614056140661407614086140961410614116141261413614146141561416614176141861419614206142161422614236142461425614266142761428614296143061431614326143361434614356143661437614386143961440614416144261443614446144561446614476144861449614506145161452614536145461455614566145761458614596146061461614626146361464614656146661467614686146961470614716147261473614746147561476614776147861479614806148161482614836148461485614866148761488614896149061491614926149361494614956149661497614986149961500615016150261503615046150561506615076150861509615106151161512615136151461515615166151761518615196152061521615226152361524615256152661527615286152961530615316153261533615346153561536615376153861539615406154161542615436154461545615466154761548615496155061551615526155361554615556155661557615586155961560615616156261563615646156561566615676156861569615706157161572615736157461575615766157761578615796158061581615826158361584615856158661587615886158961590615916159261593615946159561596615976159861599616006160161602616036160461605616066160761608616096161061611616126161361614616156161661617616186161961620616216162261623616246162561626616276162861629616306163161632616336163461635616366163761638616396164061641616426164361644616456164661647616486164961650616516165261653616546165561656616576165861659616606166161662616636166461665616666166761668616696167061671616726167361674616756167661677616786167961680616816168261683616846168561686616876168861689616906169161692616936169461695616966169761698616996170061701617026170361704617056170661707617086170961710617116171261713617146171561716617176171861719617206172161722617236172461725617266172761728617296173061731617326173361734617356173661737617386173961740617416174261743617446174561746617476174861749617506175161752617536175461755617566175761758617596176061761617626176361764617656176661767617686176961770617716177261773617746177561776617776177861779617806178161782617836178461785617866178761788617896179061791617926179361794617956179661797617986179961800618016180261803618046180561806618076180861809618106181161812618136181461815618166181761818618196182061821618226182361824618256182661827618286182961830618316183261833618346183561836618376183861839618406184161842618436184461845618466184761848618496185061851618526185361854618556185661857618586185961860618616186261863618646186561866618676186861869618706187161872618736187461875618766187761878618796188061881618826188361884618856188661887618886188961890618916189261893618946189561896618976189861899619006190161902619036190461905619066190761908619096191061911619126191361914619156191661917619186191961920619216192261923619246192561926619276192861929619306193161932619336193461935619366193761938619396194061941619426194361944619456194661947619486194961950619516195261953619546195561956619576195861959619606196161962619636196461965619666196761968619696197061971619726197361974619756197661977619786197961980619816198261983619846198561986619876198861989619906199161992619936199461995619966199761998619996200062001620026200362004620056200662007620086200962010620116201262013620146201562016620176201862019620206202162022620236202462025620266202762028620296203062031620326203362034620356203662037620386203962040620416204262043620446204562046620476204862049620506205162052620536205462055620566205762058620596206062061620626206362064620656206662067620686206962070620716207262073620746207562076620776207862079620806208162082620836208462085620866208762088620896209062091620926209362094620956209662097620986209962100621016210262103621046210562106621076210862109621106211162112621136211462115621166211762118621196212062121621226212362124621256212662127621286212962130621316213262133621346213562136621376213862139621406214162142621436214462145621466214762148621496215062151621526215362154621556215662157621586215962160621616216262163621646216562166621676216862169621706217162172621736217462175621766217762178621796218062181621826218362184621856218662187621886218962190621916219262193621946219562196621976219862199622006220162202622036220462205622066220762208622096221062211622126221362214622156221662217622186221962220622216222262223622246222562226622276222862229622306223162232622336223462235622366223762238622396224062241622426224362244622456224662247622486224962250622516225262253622546225562256622576225862259622606226162262622636226462265622666226762268622696227062271622726227362274622756227662277622786227962280622816228262283622846228562286622876228862289622906229162292622936229462295622966229762298622996230062301623026230362304623056230662307623086230962310623116231262313623146231562316623176231862319623206232162322623236232462325623266232762328623296233062331623326233362334623356233662337623386233962340623416234262343623446234562346623476234862349623506235162352623536235462355623566235762358623596236062361623626236362364623656236662367623686236962370623716237262373623746237562376623776237862379623806238162382623836238462385623866238762388623896239062391623926239362394623956239662397623986239962400624016240262403624046240562406624076240862409624106241162412624136241462415624166241762418624196242062421624226242362424624256242662427624286242962430624316243262433624346243562436624376243862439624406244162442624436244462445624466244762448624496245062451624526245362454624556245662457624586245962460624616246262463624646246562466624676246862469624706247162472624736247462475624766247762478624796248062481624826248362484624856248662487624886248962490624916249262493624946249562496624976249862499625006250162502625036250462505625066250762508625096251062511625126251362514625156251662517625186251962520625216252262523625246252562526625276252862529625306253162532625336253462535625366253762538625396254062541625426254362544625456254662547625486254962550625516255262553625546255562556625576255862559625606256162562625636256462565625666256762568625696257062571625726257362574625756257662577625786257962580625816258262583625846258562586625876258862589625906259162592625936259462595625966259762598625996260062601626026260362604626056260662607626086260962610626116261262613626146261562616626176261862619626206262162622626236262462625626266262762628626296263062631626326263362634626356263662637626386263962640626416264262643626446264562646626476264862649626506265162652626536265462655626566265762658626596266062661626626266362664626656266662667626686266962670626716267262673626746267562676626776267862679626806268162682626836268462685626866268762688626896269062691626926269362694626956269662697626986269962700627016270262703627046270562706627076270862709627106271162712627136271462715627166271762718627196272062721627226272362724627256272662727627286272962730627316273262733627346273562736627376273862739627406274162742627436274462745627466274762748627496275062751627526275362754627556275662757627586275962760627616276262763627646276562766627676276862769627706277162772627736277462775627766277762778627796278062781627826278362784627856278662787627886278962790627916279262793627946279562796627976279862799628006280162802628036280462805628066280762808628096281062811628126281362814628156281662817628186281962820628216282262823628246282562826628276282862829628306283162832628336283462835628366283762838628396284062841628426284362844628456284662847628486284962850628516285262853628546285562856628576285862859628606286162862628636286462865628666286762868628696287062871628726287362874628756287662877628786287962880628816288262883628846288562886628876288862889628906289162892628936289462895628966289762898628996290062901629026290362904629056290662907629086290962910629116291262913629146291562916629176291862919629206292162922629236292462925629266292762928629296293062931629326293362934629356293662937629386293962940629416294262943629446294562946629476294862949629506295162952629536295462955629566295762958629596296062961629626296362964629656296662967629686296962970629716297262973629746297562976629776297862979629806298162982629836298462985629866298762988629896299062991629926299362994629956299662997629986299963000630016300263003630046300563006630076300863009630106301163012630136301463015630166301763018630196302063021630226302363024630256302663027630286302963030630316303263033630346303563036630376303863039630406304163042630436304463045630466304763048630496305063051630526305363054630556305663057630586305963060630616306263063630646306563066630676306863069630706307163072630736307463075630766307763078630796308063081630826308363084630856308663087630886308963090630916309263093630946309563096630976309863099631006310163102631036310463105631066310763108631096311063111631126311363114631156311663117631186311963120631216312263123631246312563126631276312863129631306313163132631336313463135631366313763138631396314063141631426314363144631456314663147631486314963150631516315263153631546315563156631576315863159631606316163162631636316463165631666316763168631696317063171631726317363174631756317663177631786317963180631816318263183631846318563186631876318863189631906319163192631936319463195631966319763198631996320063201632026320363204632056320663207632086320963210632116321263213632146321563216632176321863219632206322163222632236322463225632266322763228632296323063231632326323363234632356323663237632386323963240632416324263243632446324563246632476324863249632506325163252632536325463255632566325763258632596326063261632626326363264632656326663267632686326963270632716327263273632746327563276632776327863279632806328163282632836328463285632866328763288632896329063291632926329363294632956329663297632986329963300633016330263303633046330563306633076330863309633106331163312633136331463315633166331763318633196332063321633226332363324633256332663327633286332963330633316333263333633346333563336633376333863339633406334163342633436334463345633466334763348633496335063351633526335363354633556335663357633586335963360633616336263363633646336563366633676336863369633706337163372633736337463375633766337763378633796338063381633826338363384633856338663387633886338963390633916339263393633946339563396633976339863399634006340163402634036340463405634066340763408634096341063411634126341363414634156341663417634186341963420634216342263423634246342563426634276342863429634306343163432634336343463435634366343763438634396344063441634426344363444634456344663447634486344963450634516345263453634546345563456634576345863459634606346163462634636346463465634666346763468634696347063471634726347363474634756347663477634786347963480634816348263483634846348563486634876348863489634906349163492634936349463495634966349763498634996350063501635026350363504635056350663507635086350963510635116351263513635146351563516635176351863519635206352163522635236352463525635266352763528635296353063531635326353363534635356353663537635386353963540635416354263543635446354563546635476354863549635506355163552635536355463555635566355763558635596356063561635626356363564635656356663567635686356963570635716357263573635746357563576635776357863579635806358163582635836358463585635866358763588635896359063591635926359363594635956359663597635986359963600636016360263603636046360563606636076360863609636106361163612636136361463615636166361763618636196362063621636226362363624636256362663627636286362963630636316363263633636346363563636636376363863639636406364163642636436364463645636466364763648636496365063651636526365363654636556365663657636586365963660636616366263663636646366563666636676366863669636706367163672636736367463675636766367763678636796368063681636826368363684636856368663687636886368963690636916369263693636946369563696636976369863699637006370163702637036370463705637066370763708637096371063711637126371363714637156371663717637186371963720637216372263723637246372563726637276372863729637306373163732637336373463735637366373763738637396374063741637426374363744637456374663747637486374963750637516375263753637546375563756637576375863759637606376163762637636376463765637666376763768637696377063771637726377363774637756377663777637786377963780637816378263783637846378563786637876378863789637906379163792637936379463795637966379763798637996380063801638026380363804638056380663807638086380963810638116381263813638146381563816638176381863819638206382163822638236382463825638266382763828638296383063831638326383363834638356383663837638386383963840638416384263843638446384563846638476384863849638506385163852638536385463855638566385763858638596386063861638626386363864638656386663867638686386963870638716387263873638746387563876638776387863879638806388163882638836388463885638866388763888638896389063891638926389363894638956389663897638986389963900639016390263903639046390563906639076390863909639106391163912639136391463915639166391763918639196392063921639226392363924639256392663927639286392963930639316393263933639346393563936639376393863939639406394163942639436394463945639466394763948639496395063951639526395363954639556395663957639586395963960639616396263963639646396563966639676396863969639706397163972639736397463975639766397763978639796398063981639826398363984639856398663987639886398963990639916399263993639946399563996639976399863999640006400164002640036400464005640066400764008640096401064011640126401364014640156401664017640186401964020640216402264023640246402564026640276402864029640306403164032640336403464035640366403764038640396404064041640426404364044640456404664047640486404964050640516405264053640546405564056640576405864059640606406164062640636406464065640666406764068640696407064071640726407364074640756407664077640786407964080640816408264083640846408564086640876408864089640906409164092640936409464095640966409764098640996410064101641026410364104641056410664107641086410964110641116411264113641146411564116641176411864119641206412164122641236412464125641266412764128641296413064131641326413364134641356413664137641386413964140641416414264143641446414564146641476414864149641506415164152641536415464155641566415764158641596416064161641626416364164641656416664167641686416964170641716417264173641746417564176641776417864179641806418164182641836418464185641866418764188641896419064191641926419364194641956419664197641986419964200642016420264203642046420564206642076420864209642106421164212642136421464215642166421764218642196422064221642226422364224642256422664227642286422964230642316423264233642346423564236642376423864239642406424164242642436424464245642466424764248642496425064251642526425364254642556425664257642586425964260642616426264263642646426564266642676426864269642706427164272642736427464275642766427764278642796428064281642826428364284642856428664287642886428964290642916429264293642946429564296642976429864299643006430164302643036430464305643066430764308643096431064311643126431364314643156431664317643186431964320643216432264323643246432564326643276432864329643306433164332643336433464335643366433764338643396434064341643426434364344643456434664347643486434964350643516435264353643546435564356643576435864359643606436164362643636436464365643666436764368643696437064371643726437364374643756437664377643786437964380643816438264383643846438564386643876438864389643906439164392643936439464395643966439764398643996440064401644026440364404644056440664407644086440964410644116441264413644146441564416644176441864419644206442164422644236442464425644266442764428644296443064431644326443364434644356443664437644386443964440644416444264443644446444564446644476444864449644506445164452644536445464455644566445764458644596446064461644626446364464644656446664467644686446964470644716447264473644746447564476644776447864479644806448164482644836448464485644866448764488644896449064491644926449364494644956449664497644986449964500645016450264503645046450564506645076450864509645106451164512645136451464515645166451764518645196452064521645226452364524645256452664527645286452964530645316453264533645346453564536645376453864539645406454164542645436454464545645466454764548645496455064551645526455364554645556455664557645586455964560645616456264563645646456564566645676456864569645706457164572645736457464575645766457764578645796458064581645826458364584645856458664587645886458964590645916459264593645946459564596645976459864599646006460164602646036460464605646066460764608646096461064611646126461364614646156461664617646186461964620646216462264623646246462564626646276462864629646306463164632646336463464635646366463764638646396464064641646426464364644646456464664647646486464964650646516465264653646546465564656646576465864659646606466164662646636466464665646666466764668646696467064671646726467364674646756467664677646786467964680646816468264683646846468564686646876468864689646906469164692646936469464695646966469764698646996470064701647026470364704647056470664707647086470964710647116471264713647146471564716647176471864719647206472164722647236472464725647266472764728647296473064731647326473364734647356473664737647386473964740647416474264743647446474564746647476474864749647506475164752647536475464755647566475764758647596476064761647626476364764647656476664767647686476964770647716477264773647746477564776647776477864779647806478164782647836478464785647866478764788647896479064791647926479364794647956479664797647986479964800648016480264803648046480564806648076480864809648106481164812648136481464815648166481764818648196482064821648226482364824648256482664827648286482964830648316483264833648346483564836648376483864839648406484164842648436484464845648466484764848648496485064851648526485364854648556485664857648586485964860648616486264863648646486564866648676486864869648706487164872648736487464875648766487764878648796488064881648826488364884648856488664887648886488964890648916489264893648946489564896648976489864899649006490164902649036490464905649066490764908649096491064911649126491364914649156491664917649186491964920649216492264923649246492564926649276492864929649306493164932649336493464935649366493764938649396494064941649426494364944649456494664947649486494964950649516495264953649546495564956649576495864959649606496164962649636496464965649666496764968649696497064971649726497364974649756497664977649786497964980649816498264983649846498564986649876498864989649906499164992649936499464995649966499764998649996500065001650026500365004650056500665007650086500965010650116501265013650146501565016650176501865019650206502165022650236502465025650266502765028650296503065031650326503365034650356503665037650386503965040650416504265043650446504565046650476504865049650506505165052650536505465055650566505765058650596506065061650626506365064650656506665067650686506965070650716507265073650746507565076650776507865079650806508165082650836508465085650866508765088650896509065091650926509365094650956509665097650986509965100651016510265103651046510565106651076510865109651106511165112651136511465115651166511765118651196512065121651226512365124651256512665127651286512965130651316513265133651346513565136651376513865139651406514165142651436514465145651466514765148651496515065151651526515365154651556515665157651586515965160651616516265163651646516565166651676516865169651706517165172651736517465175651766517765178651796518065181651826518365184651856518665187651886518965190651916519265193651946519565196651976519865199652006520165202652036520465205652066520765208652096521065211652126521365214652156521665217652186521965220652216522265223652246522565226652276522865229652306523165232652336523465235652366523765238652396524065241652426524365244652456524665247652486524965250652516525265253652546525565256652576525865259652606526165262652636526465265652666526765268652696527065271652726527365274652756527665277652786527965280652816528265283652846528565286652876528865289652906529165292652936529465295652966529765298652996530065301653026530365304653056530665307653086530965310653116531265313653146531565316653176531865319653206532165322653236532465325653266532765328653296533065331653326533365334653356533665337653386533965340653416534265343653446534565346653476534865349653506535165352653536535465355653566535765358653596536065361653626536365364653656536665367653686536965370653716537265373653746537565376653776537865379653806538165382653836538465385653866538765388653896539065391653926539365394653956539665397653986539965400654016540265403654046540565406654076540865409654106541165412654136541465415654166541765418654196542065421654226542365424654256542665427654286542965430654316543265433654346543565436654376543865439654406544165442654436544465445654466544765448654496545065451654526545365454654556545665457654586545965460654616546265463654646546565466654676546865469654706547165472654736547465475654766547765478654796548065481654826548365484654856548665487654886548965490654916549265493654946549565496654976549865499655006550165502655036550465505655066550765508655096551065511655126551365514655156551665517655186551965520655216552265523655246552565526655276552865529655306553165532655336553465535655366553765538655396554065541655426554365544655456554665547655486554965550655516555265553655546555565556655576555865559655606556165562655636556465565655666556765568655696557065571655726557365574655756557665577655786557965580655816558265583655846558565586655876558865589655906559165592655936559465595655966559765598655996560065601656026560365604656056560665607656086560965610656116561265613656146561565616656176561865619656206562165622656236562465625656266562765628656296563065631656326563365634656356563665637656386563965640656416564265643656446564565646656476564865649656506565165652656536565465655656566565765658656596566065661656626566365664656656566665667656686566965670656716567265673656746567565676656776567865679656806568165682656836568465685656866568765688656896569065691656926569365694656956569665697656986569965700657016570265703657046570565706657076570865709657106571165712657136571465715657166571765718657196572065721657226572365724657256572665727657286572965730657316573265733657346573565736657376573865739657406574165742657436574465745657466574765748657496575065751657526575365754657556575665757657586575965760657616576265763657646576565766657676576865769657706577165772657736577465775657766577765778657796578065781657826578365784657856578665787657886578965790657916579265793657946579565796657976579865799658006580165802658036580465805658066580765808658096581065811658126581365814658156581665817658186581965820658216582265823658246582565826658276582865829658306583165832658336583465835658366583765838658396584065841658426584365844658456584665847658486584965850658516585265853658546585565856658576585865859658606586165862658636586465865658666586765868658696587065871658726587365874658756587665877658786587965880658816588265883658846588565886658876588865889658906589165892658936589465895658966589765898658996590065901659026590365904659056590665907659086590965910659116591265913659146591565916659176591865919659206592165922659236592465925659266592765928659296593065931659326593365934659356593665937659386593965940659416594265943659446594565946659476594865949659506595165952659536595465955659566595765958659596596065961659626596365964659656596665967659686596965970659716597265973659746597565976659776597865979659806598165982659836598465985659866598765988659896599065991659926599365994659956599665997659986599966000660016600266003660046600566006660076600866009660106601166012660136601466015660166601766018660196602066021660226602366024660256602666027660286602966030660316603266033660346603566036660376603866039660406604166042660436604466045660466604766048660496605066051660526605366054660556605666057660586605966060660616606266063660646606566066660676606866069660706607166072660736607466075660766607766078660796608066081660826608366084660856608666087660886608966090660916609266093660946609566096660976609866099661006610166102661036610466105661066610766108661096611066111661126611366114661156611666117661186611966120661216612266123661246612566126661276612866129661306613166132661336613466135661366613766138661396614066141661426614366144661456614666147661486614966150661516615266153661546615566156661576615866159661606616166162661636616466165661666616766168661696617066171661726617366174661756617666177661786617966180661816618266183661846618566186661876618866189661906619166192661936619466195661966619766198661996620066201662026620366204662056620666207662086620966210662116621266213662146621566216662176621866219662206622166222662236622466225662266622766228662296623066231662326623366234662356623666237662386623966240662416624266243662446624566246662476624866249662506625166252662536625466255662566625766258662596626066261662626626366264662656626666267662686626966270662716627266273662746627566276662776627866279662806628166282662836628466285662866628766288662896629066291662926629366294662956629666297662986629966300663016630266303663046630566306663076630866309663106631166312663136631466315663166631766318663196632066321663226632366324663256632666327663286632966330663316633266333663346633566336663376633866339663406634166342663436634466345663466634766348663496635066351663526635366354663556635666357663586635966360663616636266363663646636566366663676636866369663706637166372663736637466375663766637766378663796638066381663826638366384663856638666387663886638966390663916639266393663946639566396663976639866399664006640166402664036640466405664066640766408664096641066411664126641366414664156641666417664186641966420664216642266423664246642566426664276642866429664306643166432664336643466435664366643766438664396644066441664426644366444664456644666447664486644966450664516645266453664546645566456664576645866459664606646166462664636646466465664666646766468664696647066471664726647366474664756647666477664786647966480664816648266483664846648566486664876648866489664906649166492664936649466495664966649766498664996650066501665026650366504665056650666507665086650966510665116651266513665146651566516665176651866519665206652166522665236652466525665266652766528665296653066531665326653366534665356653666537665386653966540665416654266543665446654566546665476654866549665506655166552665536655466555665566655766558665596656066561665626656366564665656656666567665686656966570665716657266573665746657566576665776657866579665806658166582665836658466585665866658766588665896659066591665926659366594665956659666597665986659966600666016660266603666046660566606666076660866609666106661166612666136661466615666166661766618666196662066621666226662366624666256662666627666286662966630666316663266633666346663566636666376663866639666406664166642666436664466645666466664766648666496665066651666526665366654666556665666657666586665966660666616666266663666646666566666666676666866669666706667166672666736667466675666766667766678666796668066681666826668366684666856668666687666886668966690666916669266693666946669566696666976669866699667006670166702667036670466705667066670766708667096671066711667126671366714667156671666717667186671966720667216672266723667246672566726667276672866729667306673166732667336673466735667366673766738667396674066741667426674366744667456674666747667486674966750667516675266753667546675566756667576675866759667606676166762667636676466765667666676766768667696677066771667726677366774667756677666777667786677966780667816678266783667846678566786667876678866789667906679166792667936679466795667966679766798667996680066801668026680366804668056680666807668086680966810668116681266813668146681566816668176681866819668206682166822668236682466825668266682766828668296683066831668326683366834668356683666837668386683966840668416684266843668446684566846668476684866849668506685166852668536685466855668566685766858668596686066861668626686366864668656686666867668686686966870668716687266873668746687566876668776687866879668806688166882668836688466885668866688766888668896689066891668926689366894668956689666897668986689966900669016690266903669046690566906669076690866909669106691166912669136691466915669166691766918669196692066921669226692366924669256692666927669286692966930669316693266933669346693566936669376693866939669406694166942669436694466945669466694766948669496695066951669526695366954669556695666957669586695966960669616696266963669646696566966669676696866969669706697166972669736697466975669766697766978669796698066981669826698366984669856698666987669886698966990669916699266993669946699566996669976699866999670006700167002670036700467005670066700767008670096701067011670126701367014670156701667017670186701967020670216702267023670246702567026670276702867029670306703167032670336703467035670366703767038670396704067041670426704367044670456704667047670486704967050670516705267053670546705567056670576705867059670606706167062670636706467065670666706767068670696707067071670726707367074670756707667077670786707967080670816708267083670846708567086670876708867089670906709167092670936709467095670966709767098670996710067101671026710367104671056710667107671086710967110671116711267113671146711567116671176711867119671206712167122671236712467125671266712767128671296713067131671326713367134671356713667137671386713967140671416714267143671446714567146671476714867149671506715167152671536715467155671566715767158671596716067161671626716367164671656716667167671686716967170671716717267173671746717567176671776717867179671806718167182671836718467185671866718767188671896719067191671926719367194671956719667197671986719967200672016720267203672046720567206672076720867209672106721167212672136721467215672166721767218672196722067221672226722367224672256722667227672286722967230672316723267233672346723567236672376723867239672406724167242672436724467245672466724767248672496725067251672526725367254672556725667257672586725967260672616726267263672646726567266672676726867269672706727167272672736727467275672766727767278672796728067281672826728367284672856728667287672886728967290672916729267293672946729567296672976729867299673006730167302673036730467305673066730767308673096731067311673126731367314673156731667317673186731967320673216732267323673246732567326673276732867329673306733167332673336733467335673366733767338673396734067341673426734367344673456734667347673486734967350673516735267353673546735567356673576735867359673606736167362673636736467365673666736767368673696737067371673726737367374673756737667377673786737967380673816738267383673846738567386673876738867389673906739167392673936739467395673966739767398673996740067401674026740367404674056740667407674086740967410674116741267413674146741567416674176741867419674206742167422674236742467425674266742767428674296743067431674326743367434674356743667437674386743967440674416744267443674446744567446674476744867449674506745167452674536745467455674566745767458674596746067461674626746367464674656746667467674686746967470674716747267473674746747567476674776747867479674806748167482674836748467485674866748767488674896749067491674926749367494674956749667497674986749967500675016750267503675046750567506675076750867509675106751167512675136751467515675166751767518675196752067521675226752367524675256752667527675286752967530675316753267533675346753567536675376753867539675406754167542675436754467545675466754767548675496755067551675526755367554675556755667557675586755967560675616756267563675646756567566675676756867569675706757167572675736757467575675766757767578675796758067581675826758367584675856758667587675886758967590675916759267593675946759567596675976759867599676006760167602676036760467605676066760767608676096761067611676126761367614676156761667617676186761967620676216762267623676246762567626676276762867629676306763167632676336763467635676366763767638676396764067641676426764367644676456764667647676486764967650676516765267653676546765567656676576765867659676606766167662676636766467665676666766767668676696767067671676726767367674676756767667677676786767967680676816768267683676846768567686676876768867689676906769167692676936769467695676966769767698676996770067701677026770367704677056770667707677086770967710677116771267713677146771567716677176771867719677206772167722677236772467725677266772767728677296773067731677326773367734677356773667737677386773967740677416774267743677446774567746677476774867749677506775167752677536775467755677566775767758677596776067761677626776367764677656776667767677686776967770677716777267773677746777567776677776777867779677806778167782677836778467785677866778767788677896779067791677926779367794677956779667797677986779967800678016780267803678046780567806678076780867809678106781167812678136781467815678166781767818678196782067821678226782367824678256782667827678286782967830678316783267833678346783567836678376783867839678406784167842678436784467845678466784767848678496785067851678526785367854678556785667857678586785967860678616786267863678646786567866678676786867869678706787167872678736787467875678766787767878678796788067881678826788367884678856788667887678886788967890678916789267893678946789567896678976789867899679006790167902679036790467905679066790767908679096791067911679126791367914679156791667917679186791967920679216792267923679246792567926679276792867929679306793167932679336793467935679366793767938679396794067941679426794367944679456794667947679486794967950679516795267953679546795567956679576795867959679606796167962679636796467965679666796767968679696797067971679726797367974679756797667977679786797967980679816798267983679846798567986679876798867989679906799167992679936799467995679966799767998679996800068001680026800368004680056800668007680086800968010680116801268013680146801568016680176801868019680206802168022680236802468025680266802768028680296803068031680326803368034680356803668037680386803968040680416804268043680446804568046680476804868049680506805168052680536805468055680566805768058680596806068061680626806368064680656806668067680686806968070680716807268073680746807568076680776807868079680806808168082680836808468085680866808768088680896809068091680926809368094680956809668097680986809968100681016810268103681046810568106681076810868109681106811168112681136811468115681166811768118681196812068121681226812368124681256812668127681286812968130681316813268133681346813568136681376813868139681406814168142681436814468145681466814768148681496815068151681526815368154681556815668157681586815968160681616816268163681646816568166681676816868169681706817168172681736817468175681766817768178681796818068181681826818368184681856818668187681886818968190681916819268193681946819568196681976819868199682006820168202682036820468205682066820768208682096821068211682126821368214682156821668217682186821968220682216822268223682246822568226682276822868229682306823168232682336823468235682366823768238682396824068241682426824368244682456824668247682486824968250682516825268253682546825568256682576825868259682606826168262682636826468265682666826768268682696827068271682726827368274682756827668277682786827968280682816828268283682846828568286682876828868289682906829168292682936829468295682966829768298682996830068301683026830368304683056830668307683086830968310683116831268313683146831568316683176831868319683206832168322683236832468325683266832768328683296833068331683326833368334683356833668337683386833968340683416834268343683446834568346683476834868349683506835168352683536835468355683566835768358683596836068361683626836368364683656836668367683686836968370683716837268373683746837568376683776837868379683806838168382683836838468385683866838768388683896839068391683926839368394683956839668397683986839968400684016840268403684046840568406684076840868409684106841168412684136841468415684166841768418684196842068421684226842368424684256842668427684286842968430684316843268433684346843568436684376843868439684406844168442684436844468445684466844768448684496845068451684526845368454684556845668457684586845968460684616846268463684646846568466684676846868469684706847168472684736847468475684766847768478684796848068481684826848368484684856848668487684886848968490684916849268493684946849568496684976849868499685006850168502685036850468505685066850768508685096851068511685126851368514685156851668517685186851968520685216852268523685246852568526685276852868529685306853168532685336853468535685366853768538685396854068541685426854368544685456854668547685486854968550685516855268553685546855568556685576855868559685606856168562685636856468565685666856768568685696857068571685726857368574685756857668577685786857968580685816858268583685846858568586685876858868589685906859168592685936859468595685966859768598685996860068601686026860368604686056860668607686086860968610686116861268613686146861568616686176861868619686206862168622686236862468625686266862768628686296863068631686326863368634686356863668637686386863968640686416864268643686446864568646686476864868649686506865168652686536865468655686566865768658686596866068661686626866368664686656866668667686686866968670686716867268673686746867568676686776867868679686806868168682686836868468685686866868768688686896869068691686926869368694686956869668697686986869968700687016870268703687046870568706687076870868709687106871168712687136871468715687166871768718687196872068721687226872368724687256872668727687286872968730687316873268733687346873568736687376873868739687406874168742687436874468745687466874768748687496875068751687526875368754687556875668757687586875968760687616876268763687646876568766687676876868769687706877168772687736877468775687766877768778687796878068781687826878368784687856878668787687886878968790687916879268793687946879568796687976879868799688006880168802688036880468805688066880768808688096881068811688126881368814688156881668817688186881968820688216882268823688246882568826688276882868829688306883168832688336883468835688366883768838688396884068841688426884368844688456884668847688486884968850688516885268853688546885568856688576885868859688606886168862688636886468865688666886768868688696887068871688726887368874688756887668877688786887968880688816888268883688846888568886688876888868889688906889168892688936889468895688966889768898688996890068901689026890368904689056890668907689086890968910689116891268913689146891568916689176891868919689206892168922689236892468925689266892768928689296893068931689326893368934689356893668937689386893968940689416894268943689446894568946689476894868949689506895168952689536895468955689566895768958689596896068961689626896368964689656896668967689686896968970689716897268973689746897568976689776897868979689806898168982689836898468985689866898768988689896899068991689926899368994689956899668997689986899969000690016900269003690046900569006690076900869009690106901169012690136901469015690166901769018690196902069021690226902369024690256902669027690286902969030690316903269033690346903569036690376903869039690406904169042690436904469045690466904769048690496905069051690526905369054690556905669057690586905969060690616906269063690646906569066690676906869069690706907169072690736907469075690766907769078690796908069081690826908369084690856908669087690886908969090690916909269093690946909569096690976909869099691006910169102691036910469105691066910769108691096911069111691126911369114691156911669117691186911969120691216912269123691246912569126691276912869129691306913169132691336913469135691366913769138691396914069141691426914369144691456914669147691486914969150691516915269153691546915569156691576915869159691606916169162691636916469165691666916769168691696917069171691726917369174691756917669177691786917969180691816918269183691846918569186691876918869189691906919169192691936919469195691966919769198691996920069201692026920369204692056920669207692086920969210692116921269213692146921569216692176921869219692206922169222692236922469225692266922769228692296923069231692326923369234692356923669237692386923969240692416924269243692446924569246692476924869249692506925169252692536925469255692566925769258692596926069261692626926369264692656926669267692686926969270692716927269273692746927569276692776927869279692806928169282692836928469285692866928769288692896929069291692926929369294692956929669297692986929969300693016930269303693046930569306693076930869309693106931169312693136931469315693166931769318693196932069321693226932369324693256932669327693286932969330693316933269333693346933569336693376933869339693406934169342693436934469345693466934769348693496935069351693526935369354693556935669357693586935969360693616936269363693646936569366693676936869369693706937169372693736937469375693766937769378693796938069381693826938369384693856938669387693886938969390693916939269393693946939569396693976939869399694006940169402694036940469405694066940769408694096941069411694126941369414694156941669417694186941969420694216942269423694246942569426694276942869429694306943169432694336943469435694366943769438694396944069441694426944369444694456944669447694486944969450694516945269453694546945569456694576945869459694606946169462694636946469465694666946769468694696947069471694726947369474694756947669477694786947969480694816948269483694846948569486694876948869489694906949169492694936949469495694966949769498694996950069501695026950369504695056950669507695086950969510695116951269513695146951569516695176951869519695206952169522695236952469525695266952769528695296953069531695326953369534695356953669537695386953969540695416954269543695446954569546695476954869549695506955169552695536955469555695566955769558695596956069561695626956369564695656956669567695686956969570695716957269573695746957569576695776957869579695806958169582695836958469585695866958769588695896959069591695926959369594695956959669597695986959969600696016960269603696046960569606696076960869609696106961169612696136961469615696166961769618696196962069621696226962369624696256962669627696286962969630696316963269633696346963569636696376963869639696406964169642696436964469645696466964769648696496965069651696526965369654696556965669657696586965969660696616966269663696646966569666696676966869669696706967169672696736967469675696766967769678696796968069681696826968369684696856968669687696886968969690696916969269693696946969569696696976969869699697006970169702697036970469705697066970769708697096971069711697126971369714697156971669717697186971969720697216972269723697246972569726697276972869729697306973169732697336973469735697366973769738697396974069741697426974369744697456974669747697486974969750697516975269753697546975569756697576975869759697606976169762697636976469765697666976769768697696977069771697726977369774697756977669777697786977969780697816978269783697846978569786697876978869789697906979169792697936979469795697966979769798697996980069801698026980369804698056980669807698086980969810698116981269813698146981569816698176981869819698206982169822698236982469825698266982769828698296983069831698326983369834698356983669837698386983969840698416984269843698446984569846698476984869849698506985169852698536985469855698566985769858698596986069861698626986369864698656986669867698686986969870698716987269873698746987569876698776987869879698806988169882698836988469885698866988769888698896989069891698926989369894698956989669897698986989969900699016990269903699046990569906699076990869909699106991169912699136991469915699166991769918699196992069921699226992369924699256992669927699286992969930699316993269933699346993569936699376993869939699406994169942699436994469945699466994769948699496995069951699526995369954699556995669957699586995969960699616996269963699646996569966699676996869969699706997169972699736997469975699766997769978699796998069981699826998369984699856998669987699886998969990699916999269993699946999569996699976999869999700007000170002700037000470005700067000770008700097001070011700127001370014700157001670017700187001970020700217002270023700247002570026700277002870029700307003170032700337003470035700367003770038700397004070041700427004370044700457004670047700487004970050700517005270053700547005570056700577005870059700607006170062700637006470065700667006770068700697007070071700727007370074700757007670077700787007970080700817008270083700847008570086700877008870089700907009170092700937009470095700967009770098700997010070101701027010370104701057010670107701087010970110701117011270113701147011570116701177011870119701207012170122701237012470125701267012770128701297013070131701327013370134701357013670137701387013970140701417014270143701447014570146701477014870149701507015170152701537015470155701567015770158701597016070161701627016370164701657016670167701687016970170701717017270173701747017570176701777017870179701807018170182701837018470185701867018770188701897019070191701927019370194701957019670197701987019970200702017020270203702047020570206702077020870209702107021170212702137021470215702167021770218702197022070221702227022370224702257022670227702287022970230702317023270233702347023570236702377023870239702407024170242702437024470245702467024770248702497025070251702527025370254702557025670257702587025970260702617026270263702647026570266702677026870269702707027170272702737027470275702767027770278702797028070281702827028370284702857028670287702887028970290702917029270293702947029570296702977029870299703007030170302703037030470305703067030770308703097031070311703127031370314703157031670317703187031970320703217032270323703247032570326703277032870329703307033170332703337033470335703367033770338703397034070341703427034370344703457034670347703487034970350703517035270353703547035570356703577035870359703607036170362703637036470365703667036770368703697037070371703727037370374703757037670377703787037970380703817038270383703847038570386703877038870389703907039170392703937039470395703967039770398703997040070401704027040370404704057040670407704087040970410704117041270413704147041570416704177041870419704207042170422704237042470425704267042770428704297043070431704327043370434704357043670437704387043970440704417044270443704447044570446704477044870449704507045170452704537045470455704567045770458704597046070461704627046370464704657046670467704687046970470704717047270473704747047570476704777047870479704807048170482704837048470485704867048770488704897049070491704927049370494704957049670497704987049970500705017050270503705047050570506705077050870509705107051170512705137051470515705167051770518705197052070521705227052370524705257052670527705287052970530705317053270533705347053570536705377053870539705407054170542705437054470545705467054770548705497055070551705527055370554705557055670557705587055970560705617056270563705647056570566705677056870569705707057170572705737057470575705767057770578705797058070581705827058370584705857058670587705887058970590705917059270593705947059570596705977059870599706007060170602706037060470605706067060770608706097061070611706127061370614706157061670617706187061970620706217062270623706247062570626706277062870629706307063170632706337063470635706367063770638706397064070641706427064370644706457064670647706487064970650706517065270653706547065570656706577065870659706607066170662706637066470665706667066770668706697067070671706727067370674706757067670677706787067970680706817068270683706847068570686706877068870689706907069170692706937069470695706967069770698706997070070701707027070370704707057070670707707087070970710707117071270713707147071570716707177071870719707207072170722707237072470725707267072770728707297073070731707327073370734707357073670737707387073970740707417074270743707447074570746707477074870749707507075170752707537075470755707567075770758707597076070761707627076370764707657076670767707687076970770707717077270773707747077570776707777077870779707807078170782707837078470785707867078770788707897079070791707927079370794707957079670797707987079970800708017080270803708047080570806708077080870809708107081170812708137081470815708167081770818708197082070821708227082370824708257082670827708287082970830708317083270833708347083570836708377083870839708407084170842708437084470845708467084770848708497085070851708527085370854708557085670857708587085970860708617086270863708647086570866708677086870869708707087170872708737087470875708767087770878708797088070881708827088370884708857088670887708887088970890708917089270893708947089570896708977089870899709007090170902709037090470905709067090770908709097091070911709127091370914709157091670917709187091970920709217092270923709247092570926709277092870929709307093170932709337093470935709367093770938709397094070941709427094370944709457094670947709487094970950709517095270953709547095570956709577095870959709607096170962709637096470965709667096770968709697097070971709727097370974709757097670977709787097970980709817098270983709847098570986709877098870989709907099170992709937099470995709967099770998709997100071001710027100371004710057100671007710087100971010710117101271013710147101571016710177101871019710207102171022710237102471025710267102771028710297103071031710327103371034710357103671037710387103971040710417104271043710447104571046710477104871049710507105171052710537105471055710567105771058710597106071061710627106371064710657106671067710687106971070710717107271073710747107571076710777107871079710807108171082710837108471085710867108771088710897109071091710927109371094710957109671097710987109971100711017110271103711047110571106711077110871109711107111171112711137111471115711167111771118711197112071121711227112371124711257112671127711287112971130711317113271133711347113571136711377113871139711407114171142711437114471145711467114771148711497115071151711527115371154711557115671157711587115971160711617116271163711647116571166711677116871169711707117171172711737117471175711767117771178711797118071181711827118371184711857118671187711887118971190711917119271193711947119571196711977119871199712007120171202712037120471205712067120771208712097121071211712127121371214712157121671217712187121971220712217122271223712247122571226712277122871229712307123171232712337123471235712367123771238712397124071241712427124371244712457124671247712487124971250712517125271253712547125571256712577125871259712607126171262712637126471265712667126771268712697127071271712727127371274712757127671277712787127971280712817128271283712847128571286712877128871289712907129171292712937129471295712967129771298712997130071301713027130371304713057130671307713087130971310713117131271313713147131571316713177131871319713207132171322713237132471325713267132771328713297133071331713327133371334713357133671337713387133971340713417134271343713447134571346713477134871349713507135171352713537135471355713567135771358713597136071361713627136371364713657136671367713687136971370713717137271373713747137571376713777137871379713807138171382713837138471385713867138771388713897139071391713927139371394713957139671397713987139971400714017140271403714047140571406714077140871409714107141171412714137141471415714167141771418714197142071421714227142371424714257142671427714287142971430714317143271433714347143571436714377143871439714407144171442714437144471445714467144771448714497145071451714527145371454714557145671457714587145971460714617146271463714647146571466714677146871469714707147171472714737147471475714767147771478714797148071481714827148371484714857148671487714887148971490714917149271493714947149571496714977149871499715007150171502715037150471505715067150771508715097151071511715127151371514715157151671517715187151971520715217152271523715247152571526715277152871529715307153171532715337153471535715367153771538715397154071541715427154371544715457154671547715487154971550715517155271553715547155571556715577155871559715607156171562715637156471565715667156771568715697157071571715727157371574715757157671577715787157971580715817158271583715847158571586715877158871589715907159171592715937159471595715967159771598715997160071601716027160371604716057160671607716087160971610716117161271613716147161571616716177161871619716207162171622716237162471625716267162771628716297163071631716327163371634716357163671637716387163971640716417164271643716447164571646716477164871649716507165171652716537165471655716567165771658716597166071661716627166371664716657166671667716687166971670716717167271673716747167571676716777167871679716807168171682716837168471685716867168771688716897169071691716927169371694716957169671697716987169971700717017170271703717047170571706717077170871709717107171171712717137171471715717167171771718717197172071721717227172371724717257172671727717287172971730717317173271733717347173571736717377173871739717407174171742717437174471745717467174771748717497175071751717527175371754717557175671757717587175971760717617176271763717647176571766717677176871769717707177171772717737177471775717767177771778717797178071781717827178371784717857178671787717887178971790717917179271793717947179571796717977179871799718007180171802718037180471805718067180771808718097181071811718127181371814718157181671817718187181971820718217182271823718247182571826718277182871829718307183171832718337183471835718367183771838718397184071841718427184371844718457184671847718487184971850718517185271853718547185571856718577185871859718607186171862718637186471865718667186771868718697187071871718727187371874718757187671877718787187971880718817188271883718847188571886718877188871889718907189171892718937189471895718967189771898718997190071901719027190371904719057190671907719087190971910719117191271913719147191571916719177191871919719207192171922719237192471925719267192771928719297193071931719327193371934719357193671937719387193971940719417194271943719447194571946719477194871949719507195171952719537195471955719567195771958719597196071961719627196371964719657196671967719687196971970719717197271973719747197571976719777197871979719807198171982719837198471985719867198771988719897199071991719927199371994719957199671997719987199972000720017200272003720047200572006720077200872009720107201172012720137201472015720167201772018720197202072021720227202372024720257202672027720287202972030720317203272033720347203572036720377203872039720407204172042720437204472045720467204772048720497205072051720527205372054720557205672057720587205972060720617206272063720647206572066720677206872069720707207172072720737207472075720767207772078720797208072081720827208372084720857208672087720887208972090720917209272093720947209572096720977209872099721007210172102721037210472105721067210772108721097211072111721127211372114721157211672117721187211972120721217212272123721247212572126721277212872129721307213172132721337213472135721367213772138721397214072141721427214372144721457214672147721487214972150721517215272153721547215572156721577215872159721607216172162721637216472165721667216772168721697217072171721727217372174721757217672177721787217972180721817218272183721847218572186721877218872189721907219172192721937219472195721967219772198721997220072201722027220372204722057220672207722087220972210722117221272213722147221572216722177221872219722207222172222722237222472225722267222772228722297223072231722327223372234722357223672237722387223972240722417224272243722447224572246722477224872249722507225172252722537225472255722567225772258722597226072261722627226372264722657226672267722687226972270722717227272273722747227572276722777227872279722807228172282722837228472285722867228772288722897229072291722927229372294722957229672297722987229972300723017230272303723047230572306723077230872309723107231172312723137231472315723167231772318723197232072321723227232372324723257232672327723287232972330723317233272333723347233572336723377233872339723407234172342723437234472345723467234772348723497235072351723527235372354723557235672357723587235972360723617236272363723647236572366723677236872369723707237172372723737237472375723767237772378723797238072381723827238372384723857238672387723887238972390723917239272393723947239572396723977239872399724007240172402724037240472405724067240772408724097241072411724127241372414724157241672417724187241972420724217242272423724247242572426724277242872429724307243172432724337243472435724367243772438724397244072441724427244372444724457244672447724487244972450724517245272453724547245572456724577245872459724607246172462724637246472465724667246772468724697247072471724727247372474724757247672477724787247972480724817248272483724847248572486724877248872489724907249172492724937249472495724967249772498724997250072501725027250372504725057250672507725087250972510725117251272513725147251572516725177251872519725207252172522725237252472525725267252772528725297253072531725327253372534725357253672537725387253972540725417254272543725447254572546725477254872549725507255172552725537255472555725567255772558725597256072561725627256372564725657256672567725687256972570725717257272573725747257572576725777257872579725807258172582725837258472585725867258772588725897259072591725927259372594725957259672597725987259972600726017260272603726047260572606726077260872609726107261172612726137261472615726167261772618726197262072621726227262372624726257262672627726287262972630726317263272633726347263572636726377263872639726407264172642726437264472645726467264772648726497265072651726527265372654726557265672657726587265972660726617266272663726647266572666726677266872669726707267172672726737267472675726767267772678726797268072681726827268372684726857268672687726887268972690726917269272693726947269572696726977269872699727007270172702727037270472705727067270772708727097271072711727127271372714727157271672717727187271972720727217272272723727247272572726727277272872729727307273172732727337273472735727367273772738727397274072741727427274372744727457274672747727487274972750727517275272753727547275572756727577275872759727607276172762727637276472765727667276772768727697277072771727727277372774727757277672777727787277972780727817278272783727847278572786727877278872789727907279172792727937279472795727967279772798727997280072801728027280372804728057280672807728087280972810728117281272813728147281572816728177281872819728207282172822728237282472825728267282772828728297283072831728327283372834728357283672837728387283972840728417284272843728447284572846728477284872849728507285172852728537285472855728567285772858728597286072861728627286372864728657286672867728687286972870728717287272873728747287572876728777287872879728807288172882728837288472885728867288772888728897289072891728927289372894728957289672897728987289972900729017290272903729047290572906729077290872909729107291172912729137291472915729167291772918729197292072921729227292372924729257292672927729287292972930729317293272933729347293572936729377293872939729407294172942729437294472945729467294772948729497295072951729527295372954729557295672957729587295972960729617296272963729647296572966729677296872969729707297172972729737297472975729767297772978729797298072981729827298372984729857298672987729887298972990729917299272993729947299572996729977299872999730007300173002730037300473005730067300773008730097301073011730127301373014730157301673017730187301973020730217302273023730247302573026730277302873029730307303173032730337303473035730367303773038730397304073041730427304373044730457304673047730487304973050730517305273053730547305573056730577305873059730607306173062730637306473065730667306773068730697307073071730727307373074730757307673077730787307973080730817308273083730847308573086730877308873089730907309173092730937309473095730967309773098730997310073101731027310373104731057310673107731087310973110731117311273113731147311573116731177311873119731207312173122731237312473125731267312773128731297313073131731327313373134731357313673137731387313973140731417314273143731447314573146731477314873149731507315173152731537315473155731567315773158731597316073161731627316373164731657316673167731687316973170731717317273173731747317573176731777317873179731807318173182731837318473185731867318773188731897319073191731927319373194731957319673197731987319973200732017320273203732047320573206732077320873209732107321173212732137321473215732167321773218732197322073221732227322373224732257322673227732287322973230732317323273233732347323573236732377323873239732407324173242732437324473245732467324773248732497325073251732527325373254732557325673257732587325973260732617326273263732647326573266732677326873269732707327173272732737327473275732767327773278732797328073281732827328373284732857328673287732887328973290732917329273293732947329573296732977329873299733007330173302733037330473305733067330773308733097331073311733127331373314733157331673317733187331973320733217332273323733247332573326733277332873329733307333173332733337333473335733367333773338733397334073341733427334373344733457334673347733487334973350733517335273353733547335573356733577335873359733607336173362733637336473365733667336773368733697337073371733727337373374733757337673377733787337973380733817338273383733847338573386733877338873389733907339173392733937339473395733967339773398733997340073401734027340373404734057340673407734087340973410734117341273413734147341573416734177341873419734207342173422734237342473425734267342773428734297343073431734327343373434734357343673437734387343973440734417344273443734447344573446734477344873449734507345173452734537345473455734567345773458734597346073461734627346373464734657346673467734687346973470734717347273473734747347573476734777347873479734807348173482734837348473485734867348773488734897349073491734927349373494734957349673497734987349973500735017350273503735047350573506735077350873509735107351173512735137351473515735167351773518735197352073521735227352373524735257352673527735287352973530735317353273533735347353573536735377353873539735407354173542735437354473545735467354773548735497355073551735527355373554735557355673557735587355973560735617356273563735647356573566735677356873569735707357173572735737357473575735767357773578735797358073581735827358373584735857358673587735887358973590735917359273593735947359573596735977359873599736007360173602736037360473605736067360773608736097361073611736127361373614736157361673617736187361973620736217362273623736247362573626736277362873629736307363173632736337363473635736367363773638736397364073641736427364373644736457364673647736487364973650736517365273653736547365573656736577365873659736607366173662736637366473665736667366773668736697367073671736727367373674736757367673677736787367973680736817368273683736847368573686736877368873689736907369173692736937369473695736967369773698736997370073701737027370373704737057370673707737087370973710737117371273713737147371573716737177371873719737207372173722737237372473725737267372773728737297373073731737327373373734737357373673737737387373973740737417374273743737447374573746737477374873749737507375173752737537375473755737567375773758737597376073761737627376373764737657376673767737687376973770737717377273773737747377573776737777377873779737807378173782737837378473785737867378773788737897379073791737927379373794737957379673797737987379973800738017380273803738047380573806738077380873809738107381173812738137381473815738167381773818738197382073821738227382373824738257382673827738287382973830738317383273833738347383573836738377383873839738407384173842738437384473845738467384773848738497385073851738527385373854738557385673857738587385973860738617386273863738647386573866738677386873869738707387173872738737387473875738767387773878738797388073881738827388373884738857388673887738887388973890738917389273893738947389573896738977389873899739007390173902739037390473905739067390773908739097391073911739127391373914739157391673917739187391973920739217392273923739247392573926739277392873929739307393173932739337393473935739367393773938739397394073941739427394373944739457394673947739487394973950739517395273953739547395573956739577395873959739607396173962739637396473965739667396773968739697397073971739727397373974739757397673977739787397973980739817398273983739847398573986739877398873989739907399173992739937399473995739967399773998739997400074001740027400374004740057400674007740087400974010740117401274013740147401574016740177401874019740207402174022740237402474025740267402774028740297403074031740327403374034740357403674037740387403974040740417404274043740447404574046740477404874049740507405174052740537405474055740567405774058740597406074061740627406374064740657406674067740687406974070740717407274073740747407574076740777407874079740807408174082740837408474085740867408774088740897409074091740927409374094740957409674097740987409974100741017410274103741047410574106741077410874109741107411174112741137411474115741167411774118741197412074121741227412374124741257412674127741287412974130741317413274133741347413574136741377413874139741407414174142741437414474145741467414774148741497415074151741527415374154741557415674157741587415974160741617416274163741647416574166741677416874169741707417174172741737417474175741767417774178741797418074181741827418374184741857418674187741887418974190741917419274193741947419574196741977419874199742007420174202742037420474205742067420774208742097421074211742127421374214742157421674217742187421974220742217422274223742247422574226742277422874229742307423174232742337423474235742367423774238742397424074241742427424374244742457424674247742487424974250742517425274253742547425574256742577425874259742607426174262742637426474265742667426774268742697427074271742727427374274742757427674277742787427974280742817428274283742847428574286742877428874289742907429174292742937429474295742967429774298742997430074301743027430374304743057430674307743087430974310743117431274313743147431574316743177431874319743207432174322743237432474325743267432774328743297433074331743327433374334743357433674337743387433974340743417434274343743447434574346743477434874349743507435174352743537435474355743567435774358743597436074361743627436374364743657436674367743687436974370743717437274373743747437574376743777437874379743807438174382743837438474385743867438774388743897439074391743927439374394743957439674397743987439974400744017440274403744047440574406744077440874409744107441174412744137441474415744167441774418744197442074421744227442374424744257442674427744287442974430744317443274433744347443574436744377443874439744407444174442744437444474445744467444774448744497445074451744527445374454744557445674457744587445974460744617446274463744647446574466744677446874469744707447174472744737447474475744767447774478744797448074481744827448374484744857448674487744887448974490744917449274493744947449574496744977449874499745007450174502745037450474505745067450774508745097451074511745127451374514745157451674517745187451974520745217452274523745247452574526745277452874529745307453174532745337453474535745367453774538745397454074541745427454374544745457454674547745487454974550745517455274553745547455574556745577455874559745607456174562745637456474565745667456774568745697457074571745727457374574745757457674577745787457974580745817458274583745847458574586745877458874589745907459174592745937459474595745967459774598745997460074601746027460374604746057460674607746087460974610746117461274613746147461574616746177461874619746207462174622746237462474625746267462774628746297463074631746327463374634746357463674637746387463974640746417464274643746447464574646746477464874649746507465174652746537465474655746567465774658746597466074661746627466374664746657466674667746687466974670746717467274673746747467574676746777467874679746807468174682746837468474685746867468774688746897469074691746927469374694746957469674697746987469974700747017470274703747047470574706747077470874709747107471174712747137471474715747167471774718747197472074721747227472374724747257472674727747287472974730747317473274733747347473574736747377473874739747407474174742747437474474745747467474774748747497475074751747527475374754747557475674757747587475974760747617476274763747647476574766747677476874769747707477174772747737477474775747767477774778747797478074781747827478374784747857478674787747887478974790747917479274793747947479574796747977479874799748007480174802748037480474805748067480774808748097481074811748127481374814748157481674817748187481974820748217482274823748247482574826748277482874829748307483174832748337483474835748367483774838748397484074841748427484374844748457484674847748487484974850748517485274853748547485574856748577485874859748607486174862748637486474865748667486774868748697487074871748727487374874748757487674877748787487974880748817488274883748847488574886748877488874889748907489174892748937489474895748967489774898748997490074901749027490374904749057490674907749087490974910749117491274913749147491574916749177491874919749207492174922749237492474925749267492774928749297493074931749327493374934749357493674937749387493974940749417494274943749447494574946749477494874949749507495174952749537495474955749567495774958749597496074961749627496374964749657496674967749687496974970749717497274973749747497574976749777497874979749807498174982749837498474985749867498774988749897499074991749927499374994749957499674997749987499975000750017500275003750047500575006750077500875009750107501175012750137501475015750167501775018750197502075021750227502375024750257502675027750287502975030750317503275033750347503575036750377503875039750407504175042750437504475045750467504775048750497505075051750527505375054750557505675057750587505975060750617506275063750647506575066750677506875069750707507175072750737507475075750767507775078750797508075081750827508375084750857508675087750887508975090750917509275093750947509575096750977509875099751007510175102751037510475105751067510775108751097511075111751127511375114751157511675117751187511975120751217512275123751247512575126751277512875129751307513175132751337513475135751367513775138751397514075141751427514375144751457514675147751487514975150751517515275153751547515575156751577515875159751607516175162751637516475165751667516775168751697517075171751727517375174751757517675177751787517975180751817518275183751847518575186751877518875189751907519175192751937519475195751967519775198751997520075201752027520375204752057520675207752087520975210752117521275213752147521575216752177521875219752207522175222752237522475225752267522775228752297523075231752327523375234752357523675237752387523975240752417524275243752447524575246752477524875249752507525175252752537525475255752567525775258752597526075261752627526375264752657526675267752687526975270752717527275273752747527575276752777527875279752807528175282752837528475285752867528775288752897529075291752927529375294752957529675297752987529975300753017530275303753047530575306753077530875309753107531175312753137531475315753167531775318753197532075321753227532375324753257532675327753287532975330753317533275333753347533575336753377533875339753407534175342753437534475345753467534775348753497535075351753527535375354753557535675357753587535975360753617536275363753647536575366753677536875369753707537175372753737537475375753767537775378753797538075381753827538375384753857538675387753887538975390753917539275393753947539575396753977539875399754007540175402754037540475405754067540775408754097541075411754127541375414754157541675417754187541975420754217542275423754247542575426754277542875429754307543175432754337543475435754367543775438754397544075441754427544375444754457544675447754487544975450754517545275453754547545575456754577545875459754607546175462754637546475465754667546775468754697547075471754727547375474754757547675477754787547975480754817548275483754847548575486754877548875489754907549175492754937549475495754967549775498754997550075501755027550375504755057550675507755087550975510755117551275513755147551575516755177551875519755207552175522755237552475525755267552775528755297553075531755327553375534755357553675537755387553975540755417554275543755447554575546755477554875549755507555175552755537555475555755567555775558755597556075561755627556375564755657556675567755687556975570755717557275573755747557575576755777557875579755807558175582755837558475585755867558775588755897559075591755927559375594755957559675597755987559975600756017560275603756047560575606756077560875609756107561175612756137561475615756167561775618756197562075621756227562375624756257562675627756287562975630756317563275633756347563575636756377563875639756407564175642756437564475645756467564775648756497565075651756527565375654756557565675657756587565975660756617566275663756647566575666756677566875669756707567175672756737567475675756767567775678756797568075681756827568375684756857568675687756887568975690756917569275693756947569575696756977569875699757007570175702757037570475705757067570775708757097571075711757127571375714757157571675717757187571975720757217572275723757247572575726757277572875729757307573175732757337573475735757367573775738757397574075741757427574375744757457574675747757487574975750757517575275753757547575575756757577575875759757607576175762757637576475765757667576775768757697577075771757727577375774757757577675777757787577975780757817578275783757847578575786757877578875789757907579175792757937579475795757967579775798757997580075801758027580375804758057580675807758087580975810758117581275813758147581575816758177581875819758207582175822758237582475825758267582775828758297583075831758327583375834758357583675837758387583975840758417584275843758447584575846758477584875849758507585175852758537585475855758567585775858758597586075861758627586375864758657586675867758687586975870758717587275873758747587575876758777587875879758807588175882758837588475885758867588775888758897589075891758927589375894758957589675897758987589975900759017590275903759047590575906759077590875909759107591175912759137591475915759167591775918759197592075921759227592375924759257592675927759287592975930759317593275933759347593575936759377593875939759407594175942759437594475945759467594775948759497595075951759527595375954759557595675957759587595975960759617596275963759647596575966759677596875969759707597175972759737597475975759767597775978759797598075981759827598375984759857598675987759887598975990759917599275993759947599575996759977599875999760007600176002760037600476005760067600776008760097601076011760127601376014760157601676017760187601976020760217602276023760247602576026760277602876029760307603176032760337603476035760367603776038760397604076041760427604376044760457604676047760487604976050760517605276053760547605576056760577605876059760607606176062760637606476065760667606776068760697607076071760727607376074760757607676077760787607976080760817608276083760847608576086760877608876089760907609176092760937609476095760967609776098760997610076101761027610376104761057610676107761087610976110761117611276113761147611576116761177611876119761207612176122761237612476125761267612776128761297613076131761327613376134761357613676137761387613976140761417614276143761447614576146761477614876149761507615176152761537615476155761567615776158761597616076161761627616376164761657616676167761687616976170761717617276173761747617576176761777617876179761807618176182761837618476185761867618776188761897619076191761927619376194761957619676197761987619976200762017620276203762047620576206762077620876209762107621176212762137621476215762167621776218762197622076221762227622376224762257622676227762287622976230762317623276233762347623576236762377623876239762407624176242762437624476245762467624776248762497625076251762527625376254762557625676257762587625976260762617626276263762647626576266762677626876269762707627176272762737627476275762767627776278762797628076281762827628376284762857628676287762887628976290762917629276293762947629576296762977629876299763007630176302763037630476305763067630776308763097631076311763127631376314763157631676317763187631976320763217632276323763247632576326763277632876329763307633176332763337633476335763367633776338763397634076341763427634376344763457634676347763487634976350763517635276353763547635576356763577635876359763607636176362763637636476365763667636776368763697637076371763727637376374763757637676377763787637976380763817638276383763847638576386763877638876389763907639176392763937639476395763967639776398763997640076401764027640376404764057640676407764087640976410764117641276413764147641576416764177641876419764207642176422764237642476425764267642776428764297643076431764327643376434764357643676437764387643976440764417644276443764447644576446764477644876449764507645176452764537645476455764567645776458764597646076461764627646376464764657646676467764687646976470764717647276473764747647576476764777647876479764807648176482764837648476485764867648776488764897649076491764927649376494764957649676497764987649976500765017650276503765047650576506765077650876509765107651176512765137651476515765167651776518765197652076521765227652376524765257652676527765287652976530765317653276533765347653576536765377653876539765407654176542765437654476545765467654776548765497655076551765527655376554765557655676557765587655976560765617656276563765647656576566765677656876569765707657176572765737657476575765767657776578765797658076581765827658376584765857658676587765887658976590765917659276593765947659576596765977659876599766007660176602766037660476605766067660776608766097661076611766127661376614766157661676617766187661976620766217662276623766247662576626766277662876629766307663176632766337663476635766367663776638766397664076641766427664376644766457664676647766487664976650766517665276653766547665576656766577665876659766607666176662766637666476665766667666776668766697667076671766727667376674766757667676677766787667976680766817668276683766847668576686766877668876689766907669176692766937669476695766967669776698766997670076701767027670376704767057670676707767087670976710767117671276713767147671576716767177671876719767207672176722767237672476725767267672776728767297673076731767327673376734767357673676737767387673976740767417674276743767447674576746767477674876749767507675176752767537675476755767567675776758767597676076761767627676376764767657676676767767687676976770767717677276773767747677576776767777677876779767807678176782767837678476785767867678776788767897679076791767927679376794767957679676797767987679976800768017680276803768047680576806768077680876809768107681176812768137681476815768167681776818768197682076821768227682376824768257682676827768287682976830768317683276833768347683576836768377683876839768407684176842768437684476845768467684776848768497685076851768527685376854768557685676857768587685976860768617686276863768647686576866768677686876869768707687176872768737687476875768767687776878768797688076881768827688376884768857688676887768887688976890768917689276893768947689576896768977689876899769007690176902769037690476905769067690776908769097691076911769127691376914769157691676917769187691976920769217692276923769247692576926769277692876929769307693176932769337693476935769367693776938769397694076941769427694376944769457694676947769487694976950769517695276953769547695576956769577695876959769607696176962769637696476965769667696776968769697697076971769727697376974769757697676977769787697976980769817698276983769847698576986769877698876989769907699176992769937699476995769967699776998769997700077001770027700377004770057700677007770087700977010770117701277013770147701577016770177701877019770207702177022770237702477025770267702777028770297703077031770327703377034770357703677037770387703977040770417704277043770447704577046770477704877049770507705177052770537705477055770567705777058770597706077061770627706377064770657706677067770687706977070770717707277073770747707577076770777707877079770807708177082770837708477085770867708777088770897709077091770927709377094770957709677097770987709977100771017710277103771047710577106771077710877109771107711177112771137711477115771167711777118771197712077121771227712377124771257712677127771287712977130771317713277133771347713577136771377713877139771407714177142771437714477145771467714777148771497715077151771527715377154771557715677157771587715977160771617716277163771647716577166771677716877169771707717177172771737717477175771767717777178771797718077181771827718377184771857718677187771887718977190771917719277193771947719577196771977719877199772007720177202772037720477205772067720777208772097721077211772127721377214772157721677217772187721977220772217722277223772247722577226772277722877229772307723177232772337723477235772367723777238772397724077241772427724377244772457724677247772487724977250772517725277253772547725577256772577725877259772607726177262772637726477265772667726777268772697727077271772727727377274772757727677277772787727977280772817728277283772847728577286772877728877289772907729177292772937729477295772967729777298772997730077301773027730377304773057730677307773087730977310773117731277313773147731577316773177731877319773207732177322773237732477325773267732777328773297733077331773327733377334773357733677337773387733977340773417734277343773447734577346773477734877349773507735177352773537735477355773567735777358773597736077361773627736377364773657736677367773687736977370773717737277373773747737577376773777737877379773807738177382773837738477385773867738777388773897739077391773927739377394773957739677397773987739977400774017740277403774047740577406774077740877409774107741177412774137741477415774167741777418774197742077421774227742377424774257742677427774287742977430774317743277433774347743577436774377743877439774407744177442774437744477445774467744777448774497745077451774527745377454774557745677457774587745977460774617746277463774647746577466774677746877469774707747177472774737747477475774767747777478774797748077481774827748377484774857748677487774887748977490774917749277493774947749577496774977749877499775007750177502775037750477505775067750777508775097751077511775127751377514775157751677517775187751977520775217752277523775247752577526775277752877529775307753177532775337753477535775367753777538775397754077541775427754377544775457754677547775487754977550775517755277553775547755577556775577755877559775607756177562775637756477565775667756777568775697757077571775727757377574775757757677577775787757977580775817758277583775847758577586775877758877589775907759177592775937759477595775967759777598775997760077601776027760377604776057760677607776087760977610776117761277613776147761577616776177761877619776207762177622776237762477625776267762777628776297763077631776327763377634776357763677637776387763977640776417764277643776447764577646776477764877649776507765177652776537765477655776567765777658776597766077661776627766377664776657766677667776687766977670776717767277673776747767577676776777767877679776807768177682776837768477685776867768777688776897769077691776927769377694776957769677697776987769977700777017770277703777047770577706777077770877709777107771177712777137771477715777167771777718777197772077721777227772377724777257772677727777287772977730777317773277733777347773577736777377773877739777407774177742777437774477745777467774777748777497775077751777527775377754777557775677757777587775977760777617776277763777647776577766777677776877769777707777177772777737777477775777767777777778777797778077781777827778377784777857778677787777887778977790777917779277793777947779577796777977779877799778007780177802778037780477805778067780777808778097781077811778127781377814778157781677817778187781977820778217782277823778247782577826778277782877829778307783177832778337783477835778367783777838778397784077841778427784377844778457784677847778487784977850778517785277853778547785577856778577785877859778607786177862778637786477865778667786777868778697787077871778727787377874778757787677877778787787977880778817788277883778847788577886778877788877889778907789177892778937789477895778967789777898778997790077901779027790377904779057790677907779087790977910779117791277913779147791577916779177791877919779207792177922779237792477925779267792777928779297793077931779327793377934779357793677937779387793977940779417794277943779447794577946779477794877949779507795177952779537795477955779567795777958779597796077961779627796377964779657796677967779687796977970779717797277973779747797577976779777797877979779807798177982779837798477985779867798777988779897799077991779927799377994779957799677997779987799978000780017800278003780047800578006780077800878009780107801178012780137801478015780167801778018780197802078021780227802378024780257802678027780287802978030780317803278033780347803578036780377803878039780407804178042780437804478045780467804778048780497805078051780527805378054780557805678057780587805978060780617806278063780647806578066780677806878069780707807178072780737807478075780767807778078780797808078081780827808378084780857808678087780887808978090780917809278093780947809578096780977809878099781007810178102781037810478105781067810778108781097811078111781127811378114781157811678117781187811978120781217812278123781247812578126781277812878129781307813178132781337813478135781367813778138781397814078141781427814378144781457814678147781487814978150781517815278153781547815578156781577815878159781607816178162781637816478165781667816778168781697817078171781727817378174781757817678177781787817978180781817818278183781847818578186781877818878189781907819178192781937819478195781967819778198781997820078201782027820378204782057820678207782087820978210782117821278213782147821578216782177821878219782207822178222782237822478225782267822778228782297823078231782327823378234782357823678237782387823978240782417824278243782447824578246782477824878249782507825178252782537825478255782567825778258782597826078261782627826378264782657826678267782687826978270782717827278273782747827578276782777827878279782807828178282782837828478285782867828778288782897829078291782927829378294782957829678297782987829978300783017830278303783047830578306783077830878309783107831178312783137831478315783167831778318783197832078321783227832378324783257832678327783287832978330783317833278333783347833578336783377833878339783407834178342783437834478345783467834778348783497835078351783527835378354783557835678357783587835978360783617836278363783647836578366783677836878369783707837178372783737837478375783767837778378783797838078381783827838378384783857838678387783887838978390783917839278393783947839578396783977839878399784007840178402784037840478405784067840778408784097841078411784127841378414784157841678417784187841978420784217842278423784247842578426784277842878429784307843178432784337843478435784367843778438784397844078441784427844378444784457844678447784487844978450784517845278453784547845578456784577845878459784607846178462784637846478465784667846778468784697847078471784727847378474784757847678477784787847978480784817848278483784847848578486784877848878489784907849178492784937849478495784967849778498784997850078501785027850378504785057850678507785087850978510785117851278513785147851578516785177851878519785207852178522785237852478525785267852778528785297853078531785327853378534785357853678537785387853978540785417854278543785447854578546785477854878549785507855178552785537855478555785567855778558785597856078561785627856378564785657856678567785687856978570785717857278573785747857578576785777857878579785807858178582785837858478585785867858778588785897859078591785927859378594785957859678597785987859978600786017860278603786047860578606786077860878609786107861178612786137861478615786167861778618786197862078621786227862378624786257862678627786287862978630786317863278633786347863578636786377863878639786407864178642786437864478645786467864778648786497865078651786527865378654786557865678657786587865978660786617866278663786647866578666786677866878669786707867178672786737867478675786767867778678786797868078681786827868378684786857868678687786887868978690786917869278693786947869578696786977869878699787007870178702787037870478705787067870778708787097871078711787127871378714787157871678717787187871978720787217872278723787247872578726787277872878729787307873178732787337873478735787367873778738787397874078741787427874378744787457874678747787487874978750787517875278753787547875578756787577875878759787607876178762787637876478765787667876778768787697877078771787727877378774787757877678777787787877978780787817878278783787847878578786787877878878789787907879178792787937879478795787967879778798787997880078801788027880378804788057880678807788087880978810788117881278813788147881578816788177881878819788207882178822788237882478825788267882778828788297883078831788327883378834788357883678837788387883978840788417884278843788447884578846788477884878849788507885178852788537885478855788567885778858788597886078861788627886378864788657886678867788687886978870788717887278873788747887578876788777887878879788807888178882788837888478885788867888778888788897889078891788927889378894788957889678897788987889978900789017890278903789047890578906789077890878909789107891178912789137891478915789167891778918789197892078921789227892378924789257892678927789287892978930789317893278933789347893578936789377893878939789407894178942789437894478945789467894778948789497895078951789527895378954789557895678957789587895978960789617896278963789647896578966789677896878969789707897178972789737897478975789767897778978789797898078981789827898378984789857898678987789887898978990789917899278993789947899578996789977899878999790007900179002790037900479005790067900779008790097901079011790127901379014790157901679017790187901979020790217902279023790247902579026790277902879029790307903179032790337903479035790367903779038790397904079041790427904379044790457904679047790487904979050790517905279053790547905579056790577905879059790607906179062790637906479065790667906779068790697907079071790727907379074790757907679077790787907979080790817908279083790847908579086790877908879089790907909179092790937909479095790967909779098790997910079101791027910379104791057910679107791087910979110791117911279113791147911579116791177911879119791207912179122791237912479125791267912779128791297913079131791327913379134791357913679137791387913979140791417914279143791447914579146791477914879149791507915179152791537915479155791567915779158791597916079161791627916379164791657916679167791687916979170791717917279173791747917579176791777917879179791807918179182791837918479185791867918779188791897919079191791927919379194791957919679197791987919979200792017920279203792047920579206792077920879209792107921179212792137921479215792167921779218792197922079221792227922379224792257922679227792287922979230792317923279233792347923579236792377923879239792407924179242792437924479245792467924779248792497925079251792527925379254792557925679257792587925979260792617926279263792647926579266792677926879269792707927179272792737927479275792767927779278792797928079281792827928379284792857928679287792887928979290792917929279293792947929579296792977929879299793007930179302793037930479305793067930779308793097931079311793127931379314793157931679317793187931979320793217932279323793247932579326793277932879329793307933179332793337933479335793367933779338793397934079341793427934379344793457934679347793487934979350793517935279353793547935579356793577935879359793607936179362793637936479365793667936779368793697937079371793727937379374793757937679377793787937979380793817938279383793847938579386793877938879389793907939179392793937939479395793967939779398793997940079401794027940379404794057940679407794087940979410794117941279413794147941579416794177941879419794207942179422794237942479425794267942779428794297943079431794327943379434794357943679437794387943979440794417944279443794447944579446794477944879449794507945179452794537945479455794567945779458794597946079461794627946379464794657946679467794687946979470794717947279473794747947579476794777947879479794807948179482794837948479485794867948779488794897949079491794927949379494794957949679497794987949979500795017950279503795047950579506795077950879509795107951179512795137951479515795167951779518795197952079521795227952379524795257952679527795287952979530795317953279533795347953579536795377953879539795407954179542795437954479545795467954779548795497955079551795527955379554795557955679557795587955979560795617956279563795647956579566795677956879569795707957179572795737957479575795767957779578795797958079581795827958379584795857958679587795887958979590795917959279593795947959579596795977959879599796007960179602796037960479605796067960779608796097961079611796127961379614796157961679617796187961979620796217962279623796247962579626796277962879629796307963179632796337963479635796367963779638796397964079641796427964379644796457964679647796487964979650796517965279653796547965579656796577965879659796607966179662796637966479665796667966779668796697967079671796727967379674796757967679677796787967979680796817968279683796847968579686796877968879689796907969179692796937969479695796967969779698796997970079701797027970379704797057970679707797087970979710797117971279713797147971579716797177971879719797207972179722797237972479725797267972779728797297973079731797327973379734797357973679737797387973979740797417974279743797447974579746797477974879749797507975179752797537975479755797567975779758797597976079761797627976379764797657976679767797687976979770797717977279773797747977579776797777977879779797807978179782797837978479785797867978779788797897979079791797927979379794797957979679797797987979979800798017980279803798047980579806798077980879809798107981179812798137981479815798167981779818798197982079821798227982379824798257982679827798287982979830798317983279833798347983579836798377983879839798407984179842798437984479845798467984779848798497985079851798527985379854798557985679857798587985979860798617986279863798647986579866798677986879869798707987179872798737987479875798767987779878798797988079881798827988379884798857988679887798887988979890798917989279893798947989579896798977989879899799007990179902799037990479905799067990779908799097991079911799127991379914799157991679917799187991979920799217992279923799247992579926799277992879929799307993179932799337993479935799367993779938799397994079941799427994379944799457994679947799487994979950799517995279953799547995579956799577995879959799607996179962799637996479965799667996779968799697997079971799727997379974799757997679977799787997979980799817998279983799847998579986799877998879989799907999179992799937999479995799967999779998799998000080001800028000380004800058000680007800088000980010800118001280013800148001580016800178001880019800208002180022800238002480025800268002780028800298003080031800328003380034800358003680037800388003980040800418004280043800448004580046800478004880049800508005180052800538005480055800568005780058800598006080061800628006380064800658006680067800688006980070800718007280073800748007580076800778007880079800808008180082800838008480085800868008780088800898009080091800928009380094800958009680097800988009980100801018010280103801048010580106801078010880109801108011180112801138011480115801168011780118801198012080121801228012380124801258012680127801288012980130801318013280133801348013580136801378013880139801408014180142801438014480145801468014780148801498015080151801528015380154801558015680157801588015980160801618016280163801648016580166801678016880169801708017180172801738017480175801768017780178801798018080181801828018380184801858018680187801888018980190801918019280193801948019580196801978019880199802008020180202802038020480205802068020780208802098021080211802128021380214802158021680217802188021980220802218022280223802248022580226802278022880229802308023180232802338023480235802368023780238802398024080241802428024380244802458024680247802488024980250802518025280253802548025580256802578025880259802608026180262802638026480265802668026780268802698027080271802728027380274802758027680277802788027980280802818028280283802848028580286802878028880289802908029180292802938029480295802968029780298802998030080301803028030380304803058030680307803088030980310803118031280313803148031580316803178031880319803208032180322803238032480325803268032780328803298033080331803328033380334803358033680337803388033980340803418034280343803448034580346803478034880349803508035180352803538035480355803568035780358803598036080361803628036380364803658036680367803688036980370803718037280373803748037580376803778037880379803808038180382803838038480385803868038780388803898039080391803928039380394803958039680397803988039980400804018040280403804048040580406804078040880409804108041180412804138041480415804168041780418804198042080421804228042380424804258042680427804288042980430804318043280433804348043580436804378043880439804408044180442804438044480445804468044780448804498045080451804528045380454804558045680457804588045980460804618046280463804648046580466804678046880469804708047180472804738047480475804768047780478804798048080481804828048380484804858048680487804888048980490804918049280493804948049580496804978049880499805008050180502805038050480505805068050780508805098051080511805128051380514805158051680517805188051980520805218052280523805248052580526805278052880529805308053180532805338053480535805368053780538805398054080541805428054380544805458054680547805488054980550805518055280553805548055580556805578055880559805608056180562805638056480565805668056780568805698057080571805728057380574805758057680577805788057980580805818058280583805848058580586805878058880589805908059180592805938059480595805968059780598805998060080601806028060380604806058060680607806088060980610806118061280613806148061580616806178061880619806208062180622806238062480625806268062780628806298063080631806328063380634806358063680637806388063980640806418064280643806448064580646806478064880649806508065180652806538065480655806568065780658806598066080661806628066380664806658066680667806688066980670806718067280673806748067580676806778067880679806808068180682806838068480685806868068780688806898069080691806928069380694806958069680697806988069980700807018070280703807048070580706807078070880709807108071180712807138071480715807168071780718807198072080721807228072380724807258072680727807288072980730807318073280733807348073580736807378073880739807408074180742807438074480745807468074780748807498075080751807528075380754807558075680757807588075980760807618076280763807648076580766807678076880769807708077180772807738077480775807768077780778807798078080781807828078380784807858078680787807888078980790807918079280793807948079580796807978079880799808008080180802808038080480805808068080780808808098081080811808128081380814808158081680817808188081980820808218082280823808248082580826808278082880829808308083180832808338083480835808368083780838808398084080841808428084380844808458084680847808488084980850808518085280853808548085580856808578085880859808608086180862808638086480865808668086780868808698087080871808728087380874808758087680877808788087980880808818088280883808848088580886808878088880889808908089180892808938089480895808968089780898808998090080901809028090380904809058090680907809088090980910809118091280913809148091580916809178091880919809208092180922809238092480925809268092780928809298093080931809328093380934809358093680937809388093980940809418094280943809448094580946809478094880949809508095180952809538095480955809568095780958809598096080961809628096380964809658096680967809688096980970809718097280973809748097580976809778097880979809808098180982809838098480985809868098780988809898099080991809928099380994809958099680997809988099981000810018100281003810048100581006810078100881009810108101181012810138101481015810168101781018810198102081021810228102381024810258102681027810288102981030810318103281033810348103581036810378103881039810408104181042810438104481045810468104781048810498105081051810528105381054810558105681057810588105981060810618106281063810648106581066810678106881069810708107181072810738107481075810768107781078810798108081081810828108381084810858108681087810888108981090810918109281093810948109581096810978109881099811008110181102811038110481105811068110781108811098111081111811128111381114811158111681117811188111981120811218112281123811248112581126811278112881129811308113181132811338113481135811368113781138811398114081141811428114381144811458114681147811488114981150811518115281153811548115581156811578115881159811608116181162811638116481165811668116781168811698117081171811728117381174811758117681177811788117981180811818118281183811848118581186811878118881189811908119181192811938119481195811968119781198811998120081201812028120381204812058120681207812088120981210812118121281213812148121581216812178121881219812208122181222812238122481225812268122781228812298123081231812328123381234812358123681237812388123981240812418124281243812448124581246812478124881249812508125181252812538125481255812568125781258812598126081261812628126381264812658126681267812688126981270812718127281273812748127581276812778127881279812808128181282812838128481285812868128781288812898129081291812928129381294812958129681297812988129981300813018130281303813048130581306813078130881309813108131181312813138131481315813168131781318813198132081321813228132381324813258132681327813288132981330813318133281333813348133581336813378133881339813408134181342813438134481345813468134781348813498135081351813528135381354813558135681357813588135981360813618136281363813648136581366813678136881369813708137181372813738137481375813768137781378813798138081381813828138381384813858138681387813888138981390813918139281393813948139581396813978139881399814008140181402814038140481405814068140781408814098141081411814128141381414814158141681417814188141981420814218142281423814248142581426814278142881429814308143181432814338143481435814368143781438814398144081441814428144381444814458144681447814488144981450814518145281453814548145581456814578145881459814608146181462814638146481465814668146781468814698147081471814728147381474814758147681477814788147981480814818148281483814848148581486814878148881489814908149181492814938149481495814968149781498814998150081501815028150381504815058150681507815088150981510815118151281513815148151581516815178151881519815208152181522815238152481525815268152781528815298153081531815328153381534815358153681537815388153981540815418154281543815448154581546815478154881549815508155181552815538155481555815568155781558815598156081561815628156381564815658156681567815688156981570815718157281573815748157581576815778157881579815808158181582815838158481585815868158781588815898159081591815928159381594815958159681597815988159981600816018160281603816048160581606816078160881609816108161181612816138161481615816168161781618816198162081621816228162381624816258162681627816288162981630816318163281633816348163581636816378163881639816408164181642816438164481645816468164781648816498165081651816528165381654816558165681657816588165981660816618166281663816648166581666816678166881669816708167181672816738167481675816768167781678816798168081681816828168381684816858168681687816888168981690816918169281693816948169581696816978169881699817008170181702817038170481705817068170781708817098171081711817128171381714817158171681717817188171981720817218172281723817248172581726817278172881729817308173181732817338173481735817368173781738817398174081741817428174381744817458174681747817488174981750817518175281753817548175581756817578175881759817608176181762817638176481765817668176781768817698177081771817728177381774817758177681777817788177981780817818178281783817848178581786817878178881789817908179181792817938179481795817968179781798817998180081801818028180381804818058180681807818088180981810818118181281813818148181581816818178181881819818208182181822818238182481825818268182781828818298183081831818328183381834818358183681837818388183981840818418184281843818448184581846818478184881849818508185181852818538185481855818568185781858818598186081861818628186381864818658186681867818688186981870818718187281873818748187581876818778187881879818808188181882818838188481885818868188781888818898189081891818928189381894818958189681897818988189981900819018190281903819048190581906819078190881909819108191181912819138191481915819168191781918819198192081921819228192381924819258192681927819288192981930819318193281933819348193581936819378193881939819408194181942819438194481945819468194781948819498195081951819528195381954819558195681957819588195981960819618196281963819648196581966819678196881969819708197181972819738197481975819768197781978819798198081981819828198381984819858198681987819888198981990819918199281993819948199581996819978199881999820008200182002820038200482005820068200782008820098201082011820128201382014820158201682017820188201982020820218202282023820248202582026820278202882029820308203182032820338203482035820368203782038820398204082041820428204382044820458204682047820488204982050820518205282053820548205582056820578205882059820608206182062820638206482065820668206782068820698207082071820728207382074820758207682077820788207982080820818208282083820848208582086820878208882089820908209182092820938209482095820968209782098820998210082101821028210382104821058210682107821088210982110821118211282113821148211582116821178211882119821208212182122821238212482125821268212782128821298213082131821328213382134821358213682137821388213982140821418214282143821448214582146821478214882149821508215182152821538215482155821568215782158821598216082161821628216382164821658216682167821688216982170821718217282173821748217582176821778217882179821808218182182821838218482185821868218782188821898219082191821928219382194821958219682197821988219982200822018220282203822048220582206822078220882209822108221182212822138221482215822168221782218822198222082221822228222382224822258222682227822288222982230822318223282233822348223582236822378223882239822408224182242822438224482245822468224782248822498225082251822528225382254822558225682257822588225982260822618226282263822648226582266822678226882269822708227182272822738227482275822768227782278822798228082281822828228382284822858228682287822888228982290822918229282293822948229582296822978229882299823008230182302823038230482305823068230782308823098231082311823128231382314823158231682317823188231982320823218232282323823248232582326823278232882329823308233182332823338233482335823368233782338823398234082341823428234382344823458234682347823488234982350823518235282353823548235582356823578235882359823608236182362823638236482365823668236782368823698237082371823728237382374823758237682377823788237982380823818238282383823848238582386823878238882389823908239182392823938239482395823968239782398823998240082401824028240382404824058240682407824088240982410824118241282413824148241582416824178241882419824208242182422824238242482425824268242782428824298243082431824328243382434824358243682437824388243982440824418244282443824448244582446824478244882449824508245182452824538245482455824568245782458824598246082461824628246382464824658246682467824688246982470824718247282473824748247582476824778247882479824808248182482824838248482485824868248782488824898249082491824928249382494824958249682497824988249982500825018250282503825048250582506825078250882509825108251182512825138251482515825168251782518825198252082521825228252382524825258252682527825288252982530825318253282533825348253582536825378253882539825408254182542825438254482545825468254782548825498255082551825528255382554825558255682557825588255982560825618256282563825648256582566825678256882569825708257182572825738257482575825768257782578825798258082581825828258382584825858258682587825888258982590825918259282593825948259582596825978259882599826008260182602826038260482605826068260782608826098261082611826128261382614826158261682617826188261982620826218262282623826248262582626826278262882629826308263182632826338263482635826368263782638826398264082641826428264382644826458264682647826488264982650826518265282653826548265582656826578265882659826608266182662826638266482665826668266782668826698267082671826728267382674826758267682677826788267982680826818268282683826848268582686826878268882689826908269182692826938269482695826968269782698826998270082701827028270382704827058270682707827088270982710827118271282713827148271582716827178271882719827208272182722827238272482725827268272782728827298273082731827328273382734827358273682737827388273982740827418274282743827448274582746827478274882749827508275182752827538275482755827568275782758827598276082761827628276382764827658276682767827688276982770827718277282773827748277582776827778277882779827808278182782827838278482785827868278782788827898279082791827928279382794827958279682797827988279982800828018280282803828048280582806828078280882809828108281182812828138281482815828168281782818828198282082821828228282382824828258282682827828288282982830828318283282833828348283582836828378283882839828408284182842828438284482845828468284782848828498285082851828528285382854828558285682857828588285982860828618286282863828648286582866828678286882869828708287182872828738287482875828768287782878828798288082881828828288382884828858288682887828888288982890828918289282893828948289582896828978289882899829008290182902829038290482905829068290782908829098291082911829128291382914829158291682917829188291982920829218292282923829248292582926829278292882929829308293182932829338293482935829368293782938829398294082941829428294382944829458294682947829488294982950829518295282953829548295582956829578295882959829608296182962829638296482965829668296782968829698297082971829728297382974829758297682977829788297982980829818298282983829848298582986829878298882989829908299182992829938299482995829968299782998829998300083001830028300383004830058300683007830088300983010830118301283013830148301583016830178301883019830208302183022830238302483025830268302783028830298303083031830328303383034830358303683037830388303983040830418304283043830448304583046830478304883049830508305183052830538305483055830568305783058830598306083061830628306383064830658306683067830688306983070830718307283073830748307583076830778307883079830808308183082830838308483085830868308783088830898309083091830928309383094830958309683097830988309983100831018310283103831048310583106831078310883109831108311183112831138311483115831168311783118831198312083121831228312383124831258312683127831288312983130831318313283133831348313583136831378313883139831408314183142831438314483145831468314783148831498315083151831528315383154831558315683157831588315983160831618316283163831648316583166831678316883169831708317183172831738317483175831768317783178831798318083181831828318383184831858318683187831888318983190831918319283193831948319583196831978319883199832008320183202832038320483205832068320783208832098321083211832128321383214832158321683217832188321983220832218322283223832248322583226832278322883229832308323183232832338323483235832368323783238832398324083241832428324383244832458324683247832488324983250832518325283253832548325583256832578325883259832608326183262832638326483265832668326783268832698327083271832728327383274832758327683277832788327983280832818328283283832848328583286832878328883289832908329183292832938329483295832968329783298832998330083301833028330383304833058330683307833088330983310833118331283313833148331583316833178331883319833208332183322833238332483325833268332783328833298333083331833328333383334833358333683337833388333983340833418334283343833448334583346833478334883349833508335183352833538335483355833568335783358833598336083361833628336383364833658336683367833688336983370833718337283373833748337583376833778337883379833808338183382833838338483385833868338783388833898339083391833928339383394833958339683397833988339983400834018340283403834048340583406834078340883409834108341183412834138341483415834168341783418834198342083421834228342383424834258342683427834288342983430834318343283433834348343583436834378343883439834408344183442834438344483445834468344783448834498345083451834528345383454834558345683457834588345983460834618346283463834648346583466834678346883469834708347183472834738347483475834768347783478834798348083481834828348383484834858348683487834888348983490834918349283493834948349583496834978349883499835008350183502835038350483505835068350783508835098351083511835128351383514835158351683517835188351983520835218352283523835248352583526835278352883529835308353183532835338353483535835368353783538835398354083541835428354383544835458354683547835488354983550835518355283553835548355583556835578355883559835608356183562835638356483565835668356783568835698357083571835728357383574835758357683577835788357983580835818358283583835848358583586835878358883589835908359183592835938359483595835968359783598835998360083601836028360383604836058360683607836088360983610836118361283613836148361583616836178361883619836208362183622836238362483625836268362783628836298363083631836328363383634836358363683637836388363983640836418364283643836448364583646836478364883649836508365183652836538365483655836568365783658836598366083661836628366383664836658366683667836688366983670836718367283673836748367583676836778367883679836808368183682836838368483685836868368783688836898369083691836928369383694836958369683697836988369983700837018370283703837048370583706837078370883709837108371183712837138371483715837168371783718837198372083721837228372383724837258372683727837288372983730837318373283733837348373583736837378373883739837408374183742837438374483745837468374783748837498375083751837528375383754837558375683757837588375983760837618376283763837648376583766837678376883769837708377183772837738377483775837768377783778837798378083781837828378383784837858378683787837888378983790837918379283793837948379583796837978379883799838008380183802838038380483805838068380783808838098381083811838128381383814838158381683817838188381983820838218382283823838248382583826838278382883829838308383183832838338383483835838368383783838838398384083841838428384383844838458384683847838488384983850838518385283853838548385583856838578385883859838608386183862838638386483865838668386783868838698387083871838728387383874838758387683877838788387983880838818388283883838848388583886838878388883889838908389183892838938389483895838968389783898838998390083901839028390383904839058390683907839088390983910839118391283913839148391583916839178391883919839208392183922839238392483925839268392783928839298393083931839328393383934839358393683937839388393983940839418394283943839448394583946839478394883949839508395183952839538395483955839568395783958839598396083961839628396383964839658396683967839688396983970839718397283973839748397583976839778397883979839808398183982839838398483985839868398783988839898399083991839928399383994839958399683997839988399984000840018400284003840048400584006840078400884009840108401184012840138401484015840168401784018840198402084021840228402384024840258402684027840288402984030840318403284033840348403584036840378403884039840408404184042840438404484045840468404784048840498405084051840528405384054840558405684057840588405984060840618406284063840648406584066840678406884069840708407184072840738407484075840768407784078840798408084081840828408384084840858408684087840888408984090840918409284093840948409584096840978409884099841008410184102841038410484105841068410784108841098411084111841128411384114841158411684117841188411984120841218412284123841248412584126841278412884129841308413184132841338413484135841368413784138841398414084141841428414384144841458414684147841488414984150841518415284153841548415584156841578415884159841608416184162841638416484165841668416784168841698417084171841728417384174841758417684177841788417984180841818418284183841848418584186841878418884189841908419184192841938419484195841968419784198841998420084201842028420384204842058420684207842088420984210842118421284213842148421584216842178421884219842208422184222842238422484225842268422784228842298423084231842328423384234842358423684237842388423984240842418424284243842448424584246842478424884249842508425184252842538425484255842568425784258842598426084261842628426384264842658426684267842688426984270842718427284273842748427584276842778427884279842808428184282842838428484285842868428784288842898429084291842928429384294842958429684297842988429984300843018430284303843048430584306843078430884309843108431184312843138431484315843168431784318843198432084321843228432384324843258432684327843288432984330843318433284333843348433584336843378433884339843408434184342843438434484345843468434784348843498435084351843528435384354843558435684357843588435984360843618436284363843648436584366843678436884369843708437184372843738437484375843768437784378843798438084381843828438384384843858438684387843888438984390843918439284393843948439584396843978439884399844008440184402844038440484405844068440784408844098441084411844128441384414844158441684417844188441984420844218442284423844248442584426844278442884429844308443184432844338443484435844368443784438844398444084441844428444384444844458444684447844488444984450844518445284453844548445584456844578445884459844608446184462844638446484465844668446784468844698447084471844728447384474844758447684477844788447984480844818448284483844848448584486844878448884489844908449184492844938449484495844968449784498844998450084501845028450384504845058450684507845088450984510845118451284513845148451584516845178451884519845208452184522845238452484525845268452784528845298453084531845328453384534845358453684537845388453984540845418454284543845448454584546845478454884549845508455184552845538455484555845568455784558845598456084561845628456384564845658456684567845688456984570845718457284573845748457584576845778457884579845808458184582845838458484585845868458784588845898459084591845928459384594845958459684597845988459984600846018460284603846048460584606846078460884609846108461184612846138461484615846168461784618846198462084621846228462384624846258462684627846288462984630846318463284633846348463584636846378463884639846408464184642846438464484645846468464784648846498465084651846528465384654846558465684657846588465984660846618466284663846648466584666846678466884669846708467184672846738467484675846768467784678846798468084681846828468384684846858468684687846888468984690846918469284693846948469584696846978469884699847008470184702847038470484705847068470784708847098471084711847128471384714847158471684717847188471984720847218472284723847248472584726847278472884729847308473184732847338473484735847368473784738847398474084741847428474384744847458474684747847488474984750847518475284753847548475584756847578475884759847608476184762847638476484765847668476784768847698477084771847728477384774847758477684777847788477984780847818478284783847848478584786847878478884789847908479184792847938479484795847968479784798847998480084801848028480384804848058480684807848088480984810848118481284813848148481584816848178481884819848208482184822848238482484825848268482784828848298483084831848328483384834848358483684837848388483984840848418484284843848448484584846848478484884849848508485184852848538485484855848568485784858848598486084861848628486384864848658486684867848688486984870848718487284873848748487584876848778487884879848808488184882848838488484885848868488784888848898489084891848928489384894848958489684897848988489984900849018490284903849048490584906849078490884909849108491184912849138491484915849168491784918849198492084921849228492384924849258492684927849288492984930849318493284933849348493584936849378493884939849408494184942849438494484945849468494784948849498495084951849528495384954849558495684957849588495984960849618496284963849648496584966849678496884969849708497184972849738497484975849768497784978849798498084981849828498384984849858498684987849888498984990849918499284993849948499584996849978499884999850008500185002850038500485005850068500785008850098501085011850128501385014850158501685017850188501985020850218502285023850248502585026850278502885029850308503185032850338503485035850368503785038850398504085041850428504385044850458504685047850488504985050850518505285053850548505585056850578505885059850608506185062850638506485065850668506785068850698507085071850728507385074850758507685077850788507985080850818508285083850848508585086850878508885089850908509185092850938509485095850968509785098850998510085101851028510385104851058510685107851088510985110851118511285113851148511585116851178511885119851208512185122851238512485125851268512785128851298513085131851328513385134851358513685137851388513985140851418514285143851448514585146851478514885149851508515185152851538515485155851568515785158851598516085161851628516385164851658516685167851688516985170851718517285173851748517585176851778517885179851808518185182851838518485185851868518785188851898519085191851928519385194851958519685197851988519985200852018520285203852048520585206852078520885209852108521185212852138521485215852168521785218852198522085221852228522385224852258522685227852288522985230852318523285233852348523585236852378523885239852408524185242852438524485245852468524785248852498525085251852528525385254852558525685257852588525985260852618526285263852648526585266852678526885269852708527185272852738527485275852768527785278852798528085281852828528385284852858528685287852888528985290852918529285293852948529585296852978529885299853008530185302853038530485305853068530785308853098531085311853128531385314853158531685317853188531985320853218532285323853248532585326853278532885329853308533185332853338533485335853368533785338853398534085341853428534385344853458534685347853488534985350853518535285353853548535585356853578535885359853608536185362853638536485365853668536785368853698537085371853728537385374853758537685377853788537985380853818538285383853848538585386853878538885389853908539185392853938539485395853968539785398853998540085401854028540385404854058540685407854088540985410854118541285413854148541585416854178541885419854208542185422854238542485425854268542785428854298543085431854328543385434854358543685437854388543985440854418544285443854448544585446854478544885449854508545185452854538545485455854568545785458854598546085461854628546385464854658546685467854688546985470854718547285473854748547585476854778547885479854808548185482854838548485485854868548785488854898549085491854928549385494854958549685497854988549985500855018550285503855048550585506855078550885509855108551185512855138551485515855168551785518855198552085521855228552385524855258552685527855288552985530855318553285533855348553585536855378553885539855408554185542855438554485545855468554785548855498555085551855528555385554855558555685557855588555985560855618556285563855648556585566855678556885569855708557185572855738557485575855768557785578855798558085581855828558385584855858558685587855888558985590855918559285593855948559585596855978559885599856008560185602856038560485605856068560785608856098561085611856128561385614856158561685617856188561985620856218562285623856248562585626856278562885629856308563185632856338563485635856368563785638856398564085641856428564385644856458564685647856488564985650856518565285653856548565585656856578565885659856608566185662856638566485665856668566785668856698567085671856728567385674856758567685677856788567985680856818568285683856848568585686856878568885689856908569185692856938569485695856968569785698856998570085701857028570385704857058570685707857088570985710857118571285713857148571585716857178571885719857208572185722857238572485725857268572785728857298573085731857328573385734857358573685737857388573985740857418574285743857448574585746857478574885749857508575185752857538575485755857568575785758857598576085761857628576385764857658576685767857688576985770857718577285773857748577585776857778577885779857808578185782857838578485785857868578785788857898579085791857928579385794857958579685797857988579985800858018580285803858048580585806858078580885809858108581185812858138581485815858168581785818858198582085821858228582385824858258582685827858288582985830858318583285833858348583585836858378583885839858408584185842858438584485845858468584785848858498585085851858528585385854858558585685857858588585985860858618586285863858648586585866858678586885869858708587185872858738587485875858768587785878858798588085881858828588385884858858588685887858888588985890858918589285893858948589585896858978589885899859008590185902859038590485905859068590785908859098591085911859128591385914859158591685917859188591985920859218592285923859248592585926859278592885929859308593185932859338593485935859368593785938859398594085941859428594385944859458594685947859488594985950859518595285953859548595585956859578595885959859608596185962859638596485965859668596785968859698597085971859728597385974859758597685977859788597985980859818598285983859848598585986859878598885989859908599185992859938599485995859968599785998859998600086001860028600386004860058600686007860088600986010860118601286013860148601586016860178601886019860208602186022860238602486025860268602786028860298603086031860328603386034860358603686037860388603986040860418604286043860448604586046860478604886049860508605186052860538605486055860568605786058860598606086061860628606386064860658606686067860688606986070860718607286073860748607586076860778607886079860808608186082860838608486085860868608786088860898609086091860928609386094860958609686097860988609986100861018610286103861048610586106861078610886109861108611186112861138611486115861168611786118861198612086121861228612386124861258612686127861288612986130861318613286133861348613586136861378613886139861408614186142861438614486145861468614786148861498615086151861528615386154861558615686157861588615986160861618616286163861648616586166861678616886169861708617186172861738617486175861768617786178861798618086181861828618386184861858618686187861888618986190861918619286193861948619586196861978619886199862008620186202862038620486205862068620786208862098621086211862128621386214862158621686217862188621986220862218622286223862248622586226862278622886229862308623186232862338623486235862368623786238862398624086241862428624386244862458624686247862488624986250862518625286253862548625586256862578625886259862608626186262862638626486265862668626786268862698627086271862728627386274862758627686277862788627986280862818628286283862848628586286862878628886289862908629186292862938629486295862968629786298862998630086301863028630386304863058630686307863088630986310863118631286313863148631586316863178631886319863208632186322863238632486325863268632786328863298633086331863328633386334863358633686337863388633986340863418634286343863448634586346863478634886349863508635186352863538635486355863568635786358863598636086361863628636386364863658636686367863688636986370863718637286373863748637586376863778637886379863808638186382863838638486385863868638786388863898639086391863928639386394863958639686397863988639986400864018640286403864048640586406864078640886409864108641186412864138641486415864168641786418864198642086421864228642386424864258642686427864288642986430864318643286433864348643586436864378643886439864408644186442864438644486445864468644786448864498645086451864528645386454864558645686457864588645986460864618646286463864648646586466864678646886469864708647186472864738647486475864768647786478864798648086481864828648386484864858648686487864888648986490864918649286493864948649586496864978649886499865008650186502865038650486505865068650786508865098651086511865128651386514865158651686517865188651986520865218652286523865248652586526865278652886529865308653186532865338653486535865368653786538865398654086541865428654386544865458654686547865488654986550865518655286553865548655586556865578655886559865608656186562865638656486565865668656786568865698657086571865728657386574865758657686577865788657986580865818658286583865848658586586865878658886589865908659186592865938659486595865968659786598865998660086601866028660386604866058660686607866088660986610866118661286613866148661586616866178661886619866208662186622866238662486625866268662786628866298663086631866328663386634866358663686637866388663986640866418664286643866448664586646866478664886649866508665186652866538665486655866568665786658866598666086661866628666386664866658666686667866688666986670866718667286673866748667586676866778667886679866808668186682866838668486685866868668786688866898669086691866928669386694866958669686697866988669986700867018670286703867048670586706867078670886709867108671186712867138671486715867168671786718867198672086721867228672386724867258672686727867288672986730867318673286733867348673586736867378673886739867408674186742867438674486745867468674786748867498675086751867528675386754867558675686757867588675986760867618676286763867648676586766867678676886769867708677186772867738677486775867768677786778867798678086781867828678386784867858678686787867888678986790867918679286793867948679586796867978679886799868008680186802868038680486805868068680786808868098681086811868128681386814868158681686817868188681986820868218682286823868248682586826868278682886829868308683186832868338683486835868368683786838868398684086841868428684386844868458684686847868488684986850868518685286853868548685586856868578685886859868608686186862868638686486865868668686786868868698687086871868728687386874868758687686877868788687986880868818688286883868848688586886868878688886889868908689186892868938689486895868968689786898868998690086901869028690386904869058690686907869088690986910869118691286913869148691586916869178691886919869208692186922869238692486925869268692786928869298693086931869328693386934869358693686937869388693986940869418694286943869448694586946869478694886949869508695186952869538695486955869568695786958869598696086961869628696386964869658696686967869688696986970869718697286973869748697586976869778697886979869808698186982869838698486985869868698786988869898699086991869928699386994869958699686997869988699987000870018700287003870048700587006870078700887009870108701187012870138701487015870168701787018870198702087021870228702387024870258702687027870288702987030870318703287033870348703587036870378703887039870408704187042870438704487045870468704787048870498705087051870528705387054870558705687057870588705987060870618706287063870648706587066870678706887069870708707187072870738707487075870768707787078870798708087081870828708387084870858708687087870888708987090870918709287093870948709587096870978709887099871008710187102871038710487105871068710787108871098711087111871128711387114871158711687117871188711987120871218712287123871248712587126871278712887129871308713187132871338713487135871368713787138871398714087141871428714387144871458714687147871488714987150871518715287153871548715587156871578715887159871608716187162871638716487165871668716787168871698717087171871728717387174871758717687177871788717987180871818718287183871848718587186871878718887189871908719187192871938719487195871968719787198871998720087201872028720387204872058720687207872088720987210872118721287213872148721587216872178721887219872208722187222872238722487225872268722787228872298723087231872328723387234872358723687237872388723987240872418724287243872448724587246872478724887249872508725187252872538725487255872568725787258872598726087261872628726387264872658726687267872688726987270872718727287273872748727587276872778727887279872808728187282872838728487285872868728787288872898729087291872928729387294872958729687297872988729987300873018730287303873048730587306873078730887309873108731187312873138731487315873168731787318873198732087321873228732387324873258732687327873288732987330873318733287333873348733587336873378733887339873408734187342873438734487345873468734787348873498735087351873528735387354873558735687357873588735987360873618736287363873648736587366873678736887369873708737187372873738737487375873768737787378873798738087381873828738387384873858738687387873888738987390873918739287393873948739587396873978739887399874008740187402874038740487405874068740787408874098741087411874128741387414874158741687417874188741987420874218742287423874248742587426874278742887429874308743187432874338743487435874368743787438874398744087441874428744387444874458744687447874488744987450874518745287453874548745587456874578745887459874608746187462874638746487465874668746787468874698747087471874728747387474874758747687477874788747987480874818748287483874848748587486874878748887489874908749187492874938749487495874968749787498874998750087501875028750387504875058750687507875088750987510875118751287513875148751587516875178751887519875208752187522875238752487525875268752787528875298753087531875328753387534875358753687537875388753987540875418754287543875448754587546875478754887549875508755187552875538755487555875568755787558875598756087561875628756387564875658756687567875688756987570875718757287573875748757587576875778757887579875808758187582875838758487585875868758787588875898759087591875928759387594875958759687597875988759987600876018760287603876048760587606876078760887609876108761187612876138761487615876168761787618876198762087621876228762387624876258762687627876288762987630876318763287633876348763587636876378763887639876408764187642876438764487645876468764787648876498765087651876528765387654876558765687657876588765987660876618766287663876648766587666876678766887669876708767187672876738767487675876768767787678876798768087681876828768387684876858768687687876888768987690876918769287693876948769587696876978769887699877008770187702877038770487705877068770787708877098771087711877128771387714877158771687717877188771987720877218772287723877248772587726877278772887729877308773187732877338773487735877368773787738877398774087741877428774387744877458774687747877488774987750877518775287753877548775587756877578775887759877608776187762877638776487765877668776787768877698777087771877728777387774877758777687777877788777987780877818778287783877848778587786877878778887789877908779187792877938779487795877968779787798877998780087801878028780387804878058780687807878088780987810878118781287813878148781587816878178781887819878208782187822878238782487825878268782787828878298783087831878328783387834878358783687837878388783987840878418784287843878448784587846878478784887849878508785187852878538785487855878568785787858878598786087861878628786387864878658786687867878688786987870878718787287873878748787587876878778787887879878808788187882878838788487885878868788787888878898789087891878928789387894878958789687897878988789987900879018790287903879048790587906879078790887909879108791187912879138791487915879168791787918879198792087921879228792387924879258792687927879288792987930879318793287933879348793587936879378793887939879408794187942879438794487945879468794787948879498795087951879528795387954879558795687957879588795987960879618796287963879648796587966879678796887969879708797187972879738797487975879768797787978879798798087981879828798387984879858798687987879888798987990879918799287993879948799587996879978799887999880008800188002880038800488005880068800788008880098801088011880128801388014880158801688017880188801988020880218802288023880248802588026880278802888029880308803188032880338803488035880368803788038880398804088041880428804388044880458804688047880488804988050880518805288053880548805588056880578805888059880608806188062880638806488065880668806788068880698807088071880728807388074880758807688077880788807988080880818808288083880848808588086880878808888089880908809188092880938809488095880968809788098880998810088101881028810388104881058810688107881088810988110881118811288113881148811588116881178811888119881208812188122881238812488125881268812788128881298813088131881328813388134881358813688137881388813988140881418814288143881448814588146881478814888149881508815188152881538815488155881568815788158881598816088161881628816388164881658816688167881688816988170881718817288173881748817588176881778817888179881808818188182881838818488185881868818788188881898819088191881928819388194881958819688197881988819988200882018820288203882048820588206882078820888209882108821188212882138821488215882168821788218882198822088221882228822388224882258822688227882288822988230882318823288233882348823588236882378823888239882408824188242882438824488245882468824788248882498825088251882528825388254882558825688257882588825988260882618826288263882648826588266882678826888269882708827188272882738827488275882768827788278882798828088281882828828388284882858828688287882888828988290882918829288293882948829588296882978829888299883008830188302883038830488305883068830788308883098831088311883128831388314883158831688317883188831988320883218832288323883248832588326883278832888329883308833188332883338833488335883368833788338883398834088341883428834388344883458834688347883488834988350883518835288353883548835588356883578835888359883608836188362883638836488365883668836788368883698837088371883728837388374883758837688377883788837988380883818838288383883848838588386883878838888389883908839188392883938839488395883968839788398883998840088401884028840388404884058840688407884088840988410884118841288413884148841588416884178841888419884208842188422884238842488425884268842788428884298843088431884328843388434884358843688437884388843988440884418844288443884448844588446884478844888449884508845188452884538845488455884568845788458884598846088461884628846388464884658846688467884688846988470884718847288473884748847588476884778847888479884808848188482884838848488485884868848788488884898849088491884928849388494884958849688497884988849988500885018850288503885048850588506885078850888509885108851188512885138851488515885168851788518885198852088521885228852388524885258852688527885288852988530885318853288533885348853588536885378853888539885408854188542885438854488545885468854788548885498855088551885528855388554885558855688557885588855988560885618856288563885648856588566885678856888569885708857188572885738857488575885768857788578885798858088581885828858388584885858858688587885888858988590885918859288593885948859588596885978859888599886008860188602886038860488605886068860788608886098861088611886128861388614886158861688617886188861988620886218862288623886248862588626886278862888629886308863188632886338863488635886368863788638886398864088641886428864388644886458864688647886488864988650886518865288653886548865588656886578865888659886608866188662886638866488665886668866788668886698867088671886728867388674886758867688677886788867988680886818868288683886848868588686886878868888689886908869188692886938869488695886968869788698886998870088701887028870388704887058870688707887088870988710887118871288713887148871588716887178871888719887208872188722887238872488725887268872788728887298873088731887328873388734887358873688737887388873988740887418874288743887448874588746887478874888749887508875188752887538875488755887568875788758887598876088761887628876388764887658876688767887688876988770887718877288773887748877588776887778877888779887808878188782887838878488785887868878788788887898879088791887928879388794887958879688797887988879988800888018880288803888048880588806888078880888809888108881188812888138881488815888168881788818888198882088821888228882388824888258882688827888288882988830888318883288833888348883588836888378883888839888408884188842888438884488845888468884788848888498885088851888528885388854888558885688857888588885988860888618886288863888648886588866888678886888869888708887188872888738887488875888768887788878888798888088881888828888388884888858888688887888888888988890888918889288893888948889588896888978889888899889008890188902889038890488905889068890788908889098891088911889128891388914889158891688917889188891988920889218892288923889248892588926889278892888929889308893188932889338893488935889368893788938889398894088941889428894388944889458894688947889488894988950889518895288953889548895588956889578895888959889608896188962889638896488965889668896788968889698897088971889728897388974889758897688977889788897988980889818898288983889848898588986889878898888989889908899188992889938899488995889968899788998889998900089001890028900389004890058900689007890088900989010890118901289013890148901589016890178901889019890208902189022890238902489025890268902789028890298903089031890328903389034890358903689037890388903989040890418904289043890448904589046890478904889049890508905189052890538905489055890568905789058890598906089061890628906389064890658906689067890688906989070890718907289073890748907589076890778907889079890808908189082890838908489085890868908789088890898909089091890928909389094890958909689097890988909989100891018910289103891048910589106891078910889109891108911189112891138911489115891168911789118891198912089121891228912389124891258912689127891288912989130891318913289133891348913589136891378913889139891408914189142891438914489145891468914789148891498915089151891528915389154891558915689157891588915989160891618916289163891648916589166891678916889169891708917189172891738917489175891768917789178891798918089181891828918389184891858918689187891888918989190891918919289193891948919589196891978919889199892008920189202892038920489205892068920789208892098921089211892128921389214892158921689217892188921989220892218922289223892248922589226892278922889229892308923189232892338923489235892368923789238892398924089241892428924389244892458924689247892488924989250892518925289253892548925589256892578925889259892608926189262892638926489265892668926789268892698927089271892728927389274892758927689277892788927989280892818928289283892848928589286892878928889289892908929189292892938929489295892968929789298892998930089301893028930389304893058930689307893088930989310893118931289313893148931589316893178931889319893208932189322893238932489325893268932789328893298933089331893328933389334893358933689337893388933989340893418934289343893448934589346893478934889349893508935189352893538935489355893568935789358893598936089361893628936389364893658936689367893688936989370893718937289373893748937589376893778937889379893808938189382893838938489385893868938789388893898939089391893928939389394893958939689397893988939989400894018940289403894048940589406894078940889409894108941189412894138941489415894168941789418894198942089421894228942389424894258942689427894288942989430894318943289433894348943589436894378943889439894408944189442894438944489445894468944789448894498945089451894528945389454894558945689457894588945989460894618946289463894648946589466894678946889469894708947189472894738947489475894768947789478894798948089481894828948389484894858948689487894888948989490894918949289493894948949589496894978949889499895008950189502895038950489505895068950789508895098951089511895128951389514895158951689517895188951989520895218952289523895248952589526895278952889529895308953189532895338953489535895368953789538895398954089541895428954389544895458954689547895488954989550895518955289553895548955589556895578955889559895608956189562895638956489565895668956789568895698957089571895728957389574895758957689577895788957989580895818958289583895848958589586895878958889589895908959189592895938959489595895968959789598895998960089601896028960389604896058960689607896088960989610896118961289613896148961589616896178961889619896208962189622896238962489625896268962789628896298963089631896328963389634896358963689637896388963989640896418964289643896448964589646896478964889649896508965189652896538965489655896568965789658896598966089661896628966389664896658966689667896688966989670896718967289673896748967589676896778967889679896808968189682896838968489685896868968789688896898969089691896928969389694896958969689697896988969989700897018970289703897048970589706897078970889709897108971189712897138971489715897168971789718897198972089721897228972389724897258972689727897288972989730897318973289733897348973589736897378973889739897408974189742897438974489745897468974789748897498975089751897528975389754897558975689757897588975989760897618976289763897648976589766897678976889769897708977189772897738977489775897768977789778897798978089781897828978389784897858978689787897888978989790897918979289793897948979589796897978979889799898008980189802898038980489805898068980789808898098981089811898128981389814898158981689817898188981989820898218982289823898248982589826898278982889829898308983189832898338983489835898368983789838898398984089841898428984389844898458984689847898488984989850898518985289853898548985589856898578985889859898608986189862898638986489865898668986789868898698987089871898728987389874898758987689877898788987989880898818988289883898848988589886898878988889889898908989189892898938989489895898968989789898898998990089901899028990389904899058990689907899088990989910899118991289913899148991589916899178991889919899208992189922899238992489925899268992789928899298993089931899328993389934899358993689937899388993989940899418994289943899448994589946899478994889949899508995189952899538995489955899568995789958899598996089961899628996389964899658996689967899688996989970899718997289973899748997589976899778997889979899808998189982899838998489985899868998789988899898999089991899928999389994899958999689997899988999990000900019000290003900049000590006900079000890009900109001190012900139001490015900169001790018900199002090021900229002390024900259002690027900289002990030900319003290033900349003590036900379003890039900409004190042900439004490045900469004790048900499005090051900529005390054900559005690057900589005990060900619006290063900649006590066900679006890069900709007190072900739007490075900769007790078900799008090081900829008390084900859008690087900889008990090900919009290093900949009590096900979009890099901009010190102901039010490105901069010790108901099011090111901129011390114901159011690117901189011990120901219012290123901249012590126901279012890129901309013190132901339013490135901369013790138901399014090141901429014390144901459014690147901489014990150901519015290153901549015590156901579015890159901609016190162901639016490165901669016790168901699017090171901729017390174901759017690177901789017990180901819018290183901849018590186901879018890189901909019190192901939019490195901969019790198901999020090201902029020390204902059020690207902089020990210902119021290213902149021590216902179021890219902209022190222902239022490225902269022790228902299023090231902329023390234902359023690237902389023990240902419024290243902449024590246902479024890249902509025190252902539025490255902569025790258902599026090261902629026390264902659026690267902689026990270902719027290273902749027590276902779027890279902809028190282902839028490285902869028790288902899029090291902929029390294902959029690297902989029990300903019030290303903049030590306903079030890309903109031190312903139031490315903169031790318903199032090321903229032390324903259032690327903289032990330903319033290333903349033590336903379033890339903409034190342903439034490345903469034790348903499035090351903529035390354903559035690357903589035990360903619036290363903649036590366903679036890369903709037190372903739037490375903769037790378903799038090381903829038390384903859038690387903889038990390903919039290393903949039590396903979039890399904009040190402904039040490405904069040790408904099041090411904129041390414904159041690417904189041990420904219042290423904249042590426904279042890429904309043190432904339043490435904369043790438904399044090441904429044390444904459044690447904489044990450904519045290453904549045590456904579045890459904609046190462904639046490465904669046790468904699047090471904729047390474904759047690477904789047990480904819048290483904849048590486904879048890489904909049190492904939049490495904969049790498904999050090501905029050390504905059050690507905089050990510905119051290513905149051590516905179051890519905209052190522905239052490525905269052790528905299053090531905329053390534905359053690537905389053990540905419054290543905449054590546905479054890549905509055190552905539055490555905569055790558905599056090561905629056390564905659056690567905689056990570905719057290573905749057590576905779057890579905809058190582905839058490585905869058790588905899059090591905929059390594905959059690597905989059990600906019060290603906049060590606906079060890609906109061190612906139061490615906169061790618906199062090621906229062390624906259062690627906289062990630906319063290633906349063590636906379063890639906409064190642906439064490645906469064790648906499065090651906529065390654906559065690657906589065990660906619066290663906649066590666906679066890669906709067190672906739067490675906769067790678906799068090681906829068390684906859068690687906889068990690906919069290693906949069590696906979069890699907009070190702907039070490705907069070790708907099071090711907129071390714907159071690717907189071990720907219072290723907249072590726907279072890729907309073190732907339073490735907369073790738907399074090741907429074390744907459074690747907489074990750907519075290753907549075590756907579075890759907609076190762907639076490765907669076790768907699077090771907729077390774907759077690777907789077990780907819078290783907849078590786907879078890789907909079190792907939079490795907969079790798907999080090801908029080390804908059080690807908089080990810908119081290813908149081590816908179081890819908209082190822908239082490825908269082790828908299083090831908329083390834908359083690837908389083990840908419084290843908449084590846908479084890849908509085190852908539085490855908569085790858908599086090861908629086390864908659086690867908689086990870908719087290873908749087590876908779087890879908809088190882908839088490885908869088790888908899089090891908929089390894908959089690897908989089990900909019090290903909049090590906909079090890909909109091190912909139091490915909169091790918909199092090921909229092390924909259092690927909289092990930909319093290933909349093590936909379093890939909409094190942909439094490945909469094790948909499095090951909529095390954909559095690957909589095990960909619096290963909649096590966909679096890969909709097190972909739097490975909769097790978909799098090981909829098390984909859098690987909889098990990909919099290993909949099590996909979099890999910009100191002910039100491005910069100791008910099101091011910129101391014910159101691017910189101991020910219102291023910249102591026910279102891029910309103191032910339103491035910369103791038910399104091041910429104391044910459104691047910489104991050910519105291053910549105591056910579105891059910609106191062910639106491065910669106791068910699107091071910729107391074910759107691077910789107991080910819108291083910849108591086910879108891089910909109191092910939109491095910969109791098910999110091101911029110391104911059110691107911089110991110911119111291113911149111591116911179111891119911209112191122911239112491125911269112791128911299113091131911329113391134911359113691137911389113991140911419114291143911449114591146911479114891149911509115191152911539115491155911569115791158911599116091161911629116391164911659116691167911689116991170911719117291173911749117591176911779117891179911809118191182911839118491185911869118791188911899119091191911929119391194911959119691197911989119991200912019120291203912049120591206912079120891209912109121191212912139121491215912169121791218912199122091221912229122391224912259122691227912289122991230912319123291233912349123591236912379123891239912409124191242912439124491245912469124791248912499125091251912529125391254912559125691257912589125991260912619126291263912649126591266912679126891269912709127191272912739127491275912769127791278912799128091281912829128391284912859128691287912889128991290912919129291293912949129591296912979129891299913009130191302913039130491305913069130791308913099131091311913129131391314913159131691317913189131991320913219132291323913249132591326913279132891329913309133191332913339133491335913369133791338913399134091341913429134391344913459134691347913489134991350913519135291353913549135591356913579135891359913609136191362913639136491365913669136791368913699137091371913729137391374913759137691377913789137991380913819138291383913849138591386913879138891389913909139191392913939139491395913969139791398913999140091401914029140391404914059140691407914089140991410914119141291413914149141591416914179141891419914209142191422914239142491425914269142791428914299143091431914329143391434914359143691437914389143991440914419144291443914449144591446914479144891449914509145191452914539145491455914569145791458914599146091461914629146391464914659146691467914689146991470914719147291473914749147591476914779147891479914809148191482914839148491485914869148791488914899149091491914929149391494914959149691497914989149991500915019150291503915049150591506915079150891509915109151191512915139151491515915169151791518915199152091521915229152391524915259152691527915289152991530915319153291533915349153591536915379153891539915409154191542915439154491545915469154791548915499155091551915529155391554915559155691557915589155991560915619156291563915649156591566915679156891569915709157191572915739157491575915769157791578915799158091581915829158391584915859158691587915889158991590915919159291593915949159591596915979159891599916009160191602916039160491605916069160791608916099161091611916129161391614916159161691617916189161991620916219162291623916249162591626916279162891629916309163191632916339163491635916369163791638916399164091641916429164391644916459164691647916489164991650916519165291653916549165591656916579165891659916609166191662916639166491665916669166791668916699167091671916729167391674916759167691677916789167991680916819168291683916849168591686916879168891689916909169191692916939169491695916969169791698916999170091701917029170391704917059170691707917089170991710917119171291713917149171591716917179171891719917209172191722917239172491725917269172791728917299173091731917329173391734917359173691737917389173991740917419174291743917449174591746917479174891749917509175191752917539175491755917569175791758917599176091761917629176391764917659176691767917689176991770917719177291773917749177591776917779177891779917809178191782917839178491785917869178791788917899179091791917929179391794917959179691797917989179991800918019180291803918049180591806918079180891809918109181191812918139181491815918169181791818918199182091821918229182391824918259182691827918289182991830918319183291833918349183591836918379183891839918409184191842918439184491845918469184791848918499185091851918529185391854918559185691857918589185991860918619186291863918649186591866918679186891869918709187191872918739187491875918769187791878918799188091881918829188391884918859188691887918889188991890918919189291893918949189591896918979189891899919009190191902919039190491905919069190791908919099191091911919129191391914919159191691917919189191991920919219192291923919249192591926919279192891929919309193191932919339193491935919369193791938919399194091941919429194391944919459194691947919489194991950919519195291953919549195591956919579195891959919609196191962919639196491965919669196791968919699197091971919729197391974919759197691977919789197991980919819198291983919849198591986919879198891989919909199191992919939199491995919969199791998919999200092001920029200392004920059200692007920089200992010920119201292013920149201592016920179201892019920209202192022920239202492025920269202792028920299203092031920329203392034920359203692037920389203992040920419204292043920449204592046920479204892049920509205192052920539205492055920569205792058920599206092061920629206392064920659206692067920689206992070920719207292073920749207592076920779207892079920809208192082920839208492085920869208792088920899209092091920929209392094920959209692097920989209992100921019210292103921049210592106921079210892109921109211192112921139211492115921169211792118921199212092121921229212392124921259212692127921289212992130921319213292133921349213592136921379213892139921409214192142921439214492145921469214792148921499215092151921529215392154921559215692157921589215992160921619216292163921649216592166921679216892169921709217192172921739217492175921769217792178921799218092181921829218392184921859218692187921889218992190921919219292193921949219592196921979219892199922009220192202922039220492205922069220792208922099221092211922129221392214922159221692217922189221992220922219222292223922249222592226922279222892229922309223192232922339223492235922369223792238922399224092241922429224392244922459224692247922489224992250922519225292253922549225592256922579225892259922609226192262922639226492265922669226792268922699227092271922729227392274922759227692277922789227992280922819228292283922849228592286922879228892289922909229192292922939229492295922969229792298922999230092301923029230392304923059230692307923089230992310923119231292313923149231592316923179231892319923209232192322923239232492325923269232792328923299233092331923329233392334923359233692337923389233992340923419234292343923449234592346923479234892349923509235192352923539235492355923569235792358923599236092361923629236392364923659236692367923689236992370923719237292373923749237592376923779237892379923809238192382923839238492385923869238792388923899239092391923929239392394923959239692397923989239992400924019240292403924049240592406924079240892409924109241192412924139241492415924169241792418924199242092421924229242392424924259242692427924289242992430924319243292433924349243592436924379243892439924409244192442924439244492445924469244792448924499245092451924529245392454924559245692457924589245992460924619246292463924649246592466924679246892469924709247192472924739247492475924769247792478924799248092481924829248392484924859248692487924889248992490924919249292493924949249592496924979249892499925009250192502925039250492505925069250792508925099251092511925129251392514925159251692517925189251992520925219252292523925249252592526925279252892529925309253192532925339253492535925369253792538925399254092541925429254392544925459254692547925489254992550925519255292553925549255592556925579255892559925609256192562925639256492565925669256792568925699257092571925729257392574925759257692577925789257992580925819258292583925849258592586925879258892589925909259192592925939259492595925969259792598925999260092601926029260392604926059260692607926089260992610926119261292613926149261592616926179261892619926209262192622926239262492625926269262792628926299263092631926329263392634926359263692637926389263992640926419264292643926449264592646926479264892649926509265192652926539265492655926569265792658926599266092661926629266392664926659266692667926689266992670926719267292673926749267592676926779267892679926809268192682926839268492685926869268792688926899269092691926929269392694926959269692697926989269992700927019270292703927049270592706927079270892709927109271192712927139271492715927169271792718927199272092721927229272392724927259272692727927289272992730927319273292733927349273592736927379273892739927409274192742927439274492745927469274792748927499275092751927529275392754927559275692757927589275992760927619276292763927649276592766927679276892769927709277192772927739277492775927769277792778927799278092781927829278392784927859278692787927889278992790927919279292793927949279592796927979279892799928009280192802928039280492805928069280792808928099281092811928129281392814928159281692817928189281992820928219282292823928249282592826928279282892829928309283192832928339283492835928369283792838928399284092841928429284392844928459284692847928489284992850928519285292853928549285592856928579285892859928609286192862928639286492865928669286792868928699287092871928729287392874928759287692877928789287992880928819288292883928849288592886928879288892889928909289192892928939289492895928969289792898928999290092901929029290392904929059290692907929089290992910929119291292913929149291592916929179291892919929209292192922929239292492925929269292792928929299293092931929329293392934929359293692937929389293992940929419294292943929449294592946929479294892949929509295192952929539295492955929569295792958929599296092961929629296392964929659296692967929689296992970929719297292973929749297592976929779297892979929809298192982929839298492985929869298792988929899299092991929929299392994929959299692997929989299993000930019300293003930049300593006930079300893009930109301193012930139301493015930169301793018930199302093021930229302393024930259302693027930289302993030930319303293033930349303593036930379303893039930409304193042930439304493045930469304793048930499305093051930529305393054930559305693057930589305993060930619306293063930649306593066930679306893069930709307193072930739307493075930769307793078930799308093081930829308393084930859308693087930889308993090930919309293093930949309593096930979309893099931009310193102931039310493105931069310793108931099311093111931129311393114931159311693117931189311993120931219312293123931249312593126931279312893129931309313193132931339313493135931369313793138931399314093141931429314393144931459314693147931489314993150931519315293153931549315593156931579315893159931609316193162931639316493165931669316793168931699317093171931729317393174931759317693177931789317993180931819318293183931849318593186931879318893189931909319193192931939319493195931969319793198931999320093201932029320393204932059320693207932089320993210932119321293213932149321593216932179321893219932209322193222932239322493225932269322793228932299323093231932329323393234932359323693237932389323993240932419324293243932449324593246932479324893249932509325193252932539325493255932569325793258932599326093261932629326393264932659326693267932689326993270932719327293273932749327593276932779327893279932809328193282932839328493285932869328793288932899329093291932929329393294932959329693297932989329993300933019330293303933049330593306933079330893309933109331193312933139331493315933169331793318933199332093321933229332393324933259332693327933289332993330933319333293333933349333593336933379333893339933409334193342933439334493345933469334793348933499335093351933529335393354933559335693357933589335993360933619336293363933649336593366933679336893369933709337193372933739337493375933769337793378933799338093381933829338393384933859338693387933889338993390933919339293393933949339593396933979339893399934009340193402934039340493405934069340793408934099341093411934129341393414934159341693417934189341993420934219342293423934249342593426934279342893429934309343193432934339343493435934369343793438934399344093441934429344393444934459344693447934489344993450934519345293453934549345593456934579345893459934609346193462934639346493465934669346793468934699347093471934729347393474934759347693477934789347993480934819348293483934849348593486934879348893489934909349193492934939349493495934969349793498934999350093501935029350393504935059350693507935089350993510935119351293513935149351593516935179351893519935209352193522935239352493525935269352793528935299353093531935329353393534935359353693537935389353993540935419354293543935449354593546935479354893549935509355193552935539355493555935569355793558935599356093561935629356393564935659356693567935689356993570935719357293573935749357593576935779357893579935809358193582935839358493585935869358793588935899359093591935929359393594935959359693597935989359993600936019360293603936049360593606936079360893609936109361193612936139361493615936169361793618936199362093621936229362393624936259362693627936289362993630936319363293633936349363593636936379363893639936409364193642936439364493645936469364793648936499365093651936529365393654936559365693657936589365993660936619366293663936649366593666936679366893669936709367193672936739367493675936769367793678936799368093681936829368393684936859368693687936889368993690936919369293693936949369593696936979369893699937009370193702937039370493705937069370793708937099371093711937129371393714937159371693717937189371993720937219372293723937249372593726937279372893729937309373193732937339373493735937369373793738937399374093741937429374393744937459374693747937489374993750937519375293753937549375593756937579375893759937609376193762937639376493765937669376793768937699377093771937729377393774937759377693777937789377993780937819378293783937849378593786937879378893789937909379193792937939379493795937969379793798937999380093801938029380393804938059380693807938089380993810938119381293813938149381593816938179381893819938209382193822938239382493825938269382793828938299383093831938329383393834938359383693837938389383993840938419384293843938449384593846938479384893849938509385193852938539385493855938569385793858938599386093861938629386393864938659386693867938689386993870938719387293873938749387593876938779387893879938809388193882938839388493885938869388793888938899389093891938929389393894938959389693897938989389993900939019390293903939049390593906939079390893909939109391193912939139391493915939169391793918939199392093921939229392393924939259392693927939289392993930939319393293933939349393593936939379393893939939409394193942939439394493945939469394793948939499395093951939529395393954939559395693957939589395993960939619396293963939649396593966939679396893969939709397193972939739397493975939769397793978939799398093981939829398393984939859398693987939889398993990939919399293993939949399593996939979399893999940009400194002940039400494005940069400794008940099401094011940129401394014940159401694017940189401994020940219402294023940249402594026940279402894029940309403194032940339403494035940369403794038940399404094041940429404394044940459404694047940489404994050940519405294053940549405594056940579405894059940609406194062940639406494065940669406794068940699407094071940729407394074940759407694077940789407994080940819408294083940849408594086940879408894089940909409194092940939409494095940969409794098940999410094101941029410394104941059410694107941089410994110941119411294113941149411594116941179411894119941209412194122941239412494125941269412794128941299413094131941329413394134941359413694137941389413994140941419414294143941449414594146941479414894149941509415194152941539415494155941569415794158941599416094161941629416394164941659416694167941689416994170941719417294173941749417594176941779417894179941809418194182941839418494185941869418794188941899419094191941929419394194941959419694197941989419994200942019420294203942049420594206942079420894209942109421194212942139421494215942169421794218942199422094221942229422394224942259422694227942289422994230942319423294233942349423594236942379423894239942409424194242942439424494245942469424794248942499425094251942529425394254942559425694257942589425994260942619426294263942649426594266942679426894269942709427194272942739427494275942769427794278942799428094281942829428394284942859428694287942889428994290942919429294293942949429594296942979429894299943009430194302943039430494305943069430794308943099431094311943129431394314943159431694317943189431994320943219432294323943249432594326943279432894329943309433194332943339433494335943369433794338943399434094341943429434394344943459434694347943489434994350943519435294353943549435594356943579435894359943609436194362943639436494365943669436794368943699437094371943729437394374943759437694377943789437994380943819438294383943849438594386943879438894389943909439194392943939439494395943969439794398943999440094401944029440394404944059440694407944089440994410944119441294413944149441594416944179441894419944209442194422944239442494425944269442794428944299443094431944329443394434944359443694437944389443994440944419444294443944449444594446944479444894449944509445194452944539445494455944569445794458944599446094461944629446394464944659446694467944689446994470944719447294473944749447594476944779447894479944809448194482944839448494485944869448794488944899449094491944929449394494944959449694497944989449994500945019450294503945049450594506945079450894509945109451194512945139451494515945169451794518945199452094521945229452394524945259452694527945289452994530945319453294533945349453594536945379453894539945409454194542945439454494545945469454794548945499455094551945529455394554945559455694557945589455994560945619456294563945649456594566945679456894569945709457194572945739457494575945769457794578945799458094581945829458394584945859458694587945889458994590945919459294593945949459594596945979459894599946009460194602946039460494605946069460794608946099461094611946129461394614946159461694617946189461994620946219462294623946249462594626946279462894629946309463194632946339463494635946369463794638946399464094641946429464394644946459464694647946489464994650946519465294653946549465594656946579465894659946609466194662946639466494665946669466794668946699467094671946729467394674946759467694677946789467994680946819468294683946849468594686946879468894689946909469194692946939469494695946969469794698946999470094701947029470394704947059470694707947089470994710947119471294713947149471594716947179471894719947209472194722947239472494725947269472794728947299473094731947329473394734947359473694737947389473994740947419474294743947449474594746947479474894749947509475194752947539475494755947569475794758947599476094761947629476394764947659476694767947689476994770947719477294773947749477594776947779477894779947809478194782947839478494785947869478794788947899479094791947929479394794947959479694797947989479994800948019480294803948049480594806948079480894809948109481194812948139481494815948169481794818948199482094821948229482394824948259482694827948289482994830948319483294833948349483594836948379483894839948409484194842948439484494845948469484794848948499485094851948529485394854948559485694857948589485994860948619486294863948649486594866948679486894869948709487194872948739487494875948769487794878948799488094881948829488394884948859488694887948889488994890948919489294893948949489594896948979489894899949009490194902949039490494905949069490794908949099491094911949129491394914949159491694917949189491994920949219492294923949249492594926949279492894929949309493194932949339493494935949369493794938949399494094941949429494394944949459494694947949489494994950949519495294953949549495594956949579495894959949609496194962949639496494965949669496794968949699497094971949729497394974949759497694977949789497994980949819498294983949849498594986949879498894989949909499194992949939499494995949969499794998949999500095001950029500395004950059500695007950089500995010950119501295013950149501595016950179501895019950209502195022950239502495025950269502795028950299503095031950329503395034950359503695037950389503995040950419504295043950449504595046950479504895049950509505195052950539505495055950569505795058950599506095061950629506395064950659506695067950689506995070950719507295073950749507595076950779507895079950809508195082950839508495085950869508795088950899509095091950929509395094950959509695097950989509995100951019510295103951049510595106951079510895109951109511195112951139511495115951169511795118951199512095121951229512395124951259512695127951289512995130951319513295133951349513595136951379513895139951409514195142951439514495145951469514795148951499515095151951529515395154951559515695157951589515995160951619516295163951649516595166951679516895169951709517195172951739517495175951769517795178951799518095181951829518395184951859518695187951889518995190951919519295193951949519595196951979519895199952009520195202952039520495205952069520795208952099521095211952129521395214952159521695217952189521995220952219522295223952249522595226952279522895229952309523195232952339523495235952369523795238952399524095241952429524395244952459524695247952489524995250952519525295253952549525595256952579525895259952609526195262952639526495265952669526795268952699527095271952729527395274952759527695277952789527995280952819528295283952849528595286952879528895289952909529195292952939529495295952969529795298952999530095301953029530395304953059530695307953089530995310953119531295313953149531595316953179531895319953209532195322953239532495325953269532795328953299533095331953329533395334953359533695337953389533995340953419534295343953449534595346953479534895349953509535195352953539535495355953569535795358953599536095361953629536395364953659536695367953689536995370953719537295373953749537595376953779537895379953809538195382953839538495385953869538795388953899539095391953929539395394953959539695397953989539995400954019540295403954049540595406954079540895409954109541195412954139541495415954169541795418954199542095421954229542395424954259542695427954289542995430954319543295433954349543595436954379543895439954409544195442954439544495445954469544795448954499545095451954529545395454954559545695457954589545995460954619546295463954649546595466954679546895469954709547195472954739547495475954769547795478954799548095481954829548395484954859548695487954889548995490954919549295493954949549595496954979549895499955009550195502955039550495505955069550795508955099551095511955129551395514955159551695517955189551995520955219552295523955249552595526955279552895529955309553195532955339553495535955369553795538955399554095541955429554395544955459554695547955489554995550955519555295553955549555595556955579555895559955609556195562955639556495565955669556795568955699557095571955729557395574955759557695577955789557995580955819558295583955849558595586955879558895589955909559195592955939559495595955969559795598955999560095601956029560395604956059560695607956089560995610956119561295613956149561595616956179561895619956209562195622956239562495625956269562795628956299563095631956329563395634956359563695637956389563995640956419564295643956449564595646956479564895649956509565195652956539565495655956569565795658956599566095661956629566395664956659566695667956689566995670956719567295673956749567595676956779567895679956809568195682956839568495685956869568795688956899569095691956929569395694956959569695697956989569995700957019570295703957049570595706957079570895709957109571195712957139571495715957169571795718957199572095721957229572395724957259572695727957289572995730957319573295733957349573595736957379573895739957409574195742957439574495745957469574795748957499575095751957529575395754957559575695757957589575995760957619576295763957649576595766957679576895769957709577195772957739577495775957769577795778957799578095781957829578395784957859578695787957889578995790957919579295793957949579595796957979579895799958009580195802958039580495805958069580795808958099581095811958129581395814958159581695817958189581995820958219582295823958249582595826958279582895829958309583195832958339583495835958369583795838958399584095841958429584395844958459584695847958489584995850958519585295853958549585595856958579585895859958609586195862958639586495865958669586795868958699587095871958729587395874958759587695877958789587995880958819588295883958849588595886958879588895889958909589195892958939589495895958969589795898958999590095901959029590395904959059590695907959089590995910959119591295913959149591595916959179591895919959209592195922959239592495925959269592795928959299593095931959329593395934959359593695937959389593995940959419594295943959449594595946959479594895949959509595195952959539595495955959569595795958959599596095961959629596395964959659596695967959689596995970959719597295973959749597595976959779597895979959809598195982959839598495985959869598795988959899599095991959929599395994959959599695997959989599996000960019600296003960049600596006960079600896009960109601196012960139601496015960169601796018960199602096021960229602396024960259602696027960289602996030960319603296033960349603596036960379603896039960409604196042960439604496045960469604796048960499605096051960529605396054960559605696057960589605996060960619606296063960649606596066960679606896069960709607196072960739607496075960769607796078960799608096081960829608396084960859608696087960889608996090960919609296093960949609596096960979609896099961009610196102961039610496105961069610796108961099611096111961129611396114961159611696117961189611996120961219612296123961249612596126961279612896129961309613196132961339613496135961369613796138961399614096141961429614396144961459614696147961489614996150961519615296153961549615596156961579615896159961609616196162961639616496165961669616796168961699617096171961729617396174961759617696177961789617996180961819618296183961849618596186961879618896189961909619196192961939619496195961969619796198961999620096201962029620396204962059620696207962089620996210962119621296213962149621596216962179621896219962209622196222962239622496225962269622796228962299623096231962329623396234962359623696237962389623996240962419624296243962449624596246962479624896249962509625196252962539625496255962569625796258962599626096261962629626396264962659626696267962689626996270962719627296273962749627596276962779627896279962809628196282962839628496285962869628796288962899629096291962929629396294962959629696297962989629996300963019630296303963049630596306963079630896309963109631196312963139631496315963169631796318963199632096321963229632396324963259632696327963289632996330963319633296333963349633596336963379633896339963409634196342963439634496345963469634796348963499635096351963529635396354963559635696357963589635996360963619636296363963649636596366963679636896369963709637196372963739637496375963769637796378963799638096381963829638396384963859638696387963889638996390963919639296393963949639596396963979639896399964009640196402964039640496405964069640796408964099641096411964129641396414964159641696417964189641996420964219642296423964249642596426964279642896429964309643196432964339643496435964369643796438964399644096441964429644396444964459644696447964489644996450964519645296453964549645596456964579645896459964609646196462964639646496465964669646796468964699647096471964729647396474964759647696477964789647996480964819648296483964849648596486964879648896489964909649196492964939649496495964969649796498964999650096501965029650396504965059650696507965089650996510965119651296513965149651596516965179651896519965209652196522965239652496525965269652796528965299653096531965329653396534965359653696537965389653996540965419654296543965449654596546965479654896549965509655196552965539655496555965569655796558965599656096561965629656396564965659656696567965689656996570965719657296573965749657596576965779657896579965809658196582965839658496585965869658796588965899659096591965929659396594965959659696597965989659996600966019660296603966049660596606966079660896609966109661196612966139661496615966169661796618966199662096621966229662396624966259662696627966289662996630966319663296633966349663596636966379663896639966409664196642966439664496645966469664796648966499665096651966529665396654966559665696657966589665996660966619666296663966649666596666966679666896669966709667196672966739667496675966769667796678966799668096681966829668396684966859668696687966889668996690966919669296693966949669596696966979669896699967009670196702967039670496705967069670796708967099671096711967129671396714967159671696717967189671996720967219672296723967249672596726967279672896729967309673196732967339673496735967369673796738967399674096741967429674396744967459674696747967489674996750967519675296753967549675596756967579675896759967609676196762967639676496765967669676796768967699677096771967729677396774967759677696777967789677996780967819678296783967849678596786967879678896789967909679196792967939679496795967969679796798967999680096801968029680396804968059680696807968089680996810968119681296813968149681596816968179681896819968209682196822968239682496825968269682796828968299683096831968329683396834968359683696837968389683996840968419684296843968449684596846968479684896849968509685196852968539685496855968569685796858968599686096861968629686396864968659686696867968689686996870968719687296873968749687596876968779687896879968809688196882968839688496885968869688796888968899689096891968929689396894968959689696897968989689996900969019690296903969049690596906969079690896909969109691196912969139691496915969169691796918969199692096921969229692396924969259692696927969289692996930969319693296933969349693596936969379693896939969409694196942969439694496945969469694796948969499695096951969529695396954969559695696957969589695996960969619696296963969649696596966969679696896969969709697196972969739697496975969769697796978969799698096981969829698396984969859698696987969889698996990969919699296993969949699596996969979699896999970009700197002970039700497005970069700797008970099701097011970129701397014970159701697017970189701997020970219702297023970249702597026970279702897029970309703197032970339703497035970369703797038970399704097041970429704397044970459704697047970489704997050970519705297053970549705597056970579705897059970609706197062970639706497065970669706797068970699707097071970729707397074970759707697077970789707997080970819708297083970849708597086970879708897089970909709197092970939709497095970969709797098970999710097101971029710397104971059710697107971089710997110971119711297113971149711597116971179711897119971209712197122971239712497125971269712797128971299713097131971329713397134971359713697137971389713997140971419714297143971449714597146971479714897149971509715197152971539715497155971569715797158971599716097161971629716397164971659716697167971689716997170971719717297173971749717597176971779717897179971809718197182971839718497185971869718797188971899719097191971929719397194971959719697197971989719997200972019720297203972049720597206972079720897209972109721197212972139721497215972169721797218972199722097221972229722397224972259722697227972289722997230972319723297233972349723597236972379723897239972409724197242972439724497245972469724797248972499725097251972529725397254972559725697257972589725997260972619726297263972649726597266972679726897269972709727197272972739727497275972769727797278972799728097281972829728397284972859728697287972889728997290972919729297293972949729597296972979729897299973009730197302973039730497305973069730797308973099731097311973129731397314973159731697317973189731997320973219732297323973249732597326973279732897329973309733197332973339733497335973369733797338973399734097341973429734397344973459734697347973489734997350973519735297353973549735597356973579735897359973609736197362973639736497365973669736797368973699737097371973729737397374973759737697377973789737997380973819738297383973849738597386973879738897389973909739197392973939739497395973969739797398973999740097401974029740397404974059740697407974089740997410974119741297413974149741597416974179741897419974209742197422974239742497425974269742797428974299743097431974329743397434974359743697437974389743997440974419744297443974449744597446974479744897449974509745197452974539745497455974569745797458974599746097461974629746397464974659746697467974689746997470974719747297473974749747597476974779747897479974809748197482974839748497485974869748797488974899749097491974929749397494974959749697497974989749997500975019750297503975049750597506975079750897509975109751197512975139751497515975169751797518975199752097521975229752397524975259752697527975289752997530975319753297533975349753597536975379753897539975409754197542975439754497545975469754797548975499755097551975529755397554975559755697557975589755997560975619756297563975649756597566975679756897569975709757197572975739757497575975769757797578975799758097581975829758397584975859758697587975889758997590975919759297593975949759597596975979759897599976009760197602976039760497605976069760797608976099761097611976129761397614976159761697617976189761997620976219762297623976249762597626976279762897629976309763197632976339763497635976369763797638976399764097641976429764397644976459764697647976489764997650976519765297653976549765597656976579765897659976609766197662976639766497665976669766797668976699767097671976729767397674976759767697677976789767997680976819768297683976849768597686976879768897689976909769197692976939769497695976969769797698976999770097701977029770397704977059770697707977089770997710977119771297713977149771597716977179771897719977209772197722977239772497725977269772797728977299773097731977329773397734977359773697737977389773997740977419774297743977449774597746977479774897749977509775197752977539775497755977569775797758977599776097761977629776397764977659776697767977689776997770977719777297773977749777597776977779777897779977809778197782977839778497785977869778797788977899779097791977929779397794977959779697797977989779997800978019780297803978049780597806978079780897809978109781197812978139781497815978169781797818978199782097821978229782397824978259782697827978289782997830978319783297833978349783597836978379783897839978409784197842978439784497845978469784797848978499785097851978529785397854978559785697857978589785997860978619786297863978649786597866978679786897869978709787197872978739787497875978769787797878978799788097881978829788397884978859788697887978889788997890978919789297893978949789597896978979789897899979009790197902979039790497905979069790797908979099791097911979129791397914979159791697917979189791997920979219792297923979249792597926979279792897929979309793197932979339793497935979369793797938979399794097941979429794397944979459794697947979489794997950979519795297953979549795597956979579795897959979609796197962979639796497965979669796797968979699797097971979729797397974979759797697977979789797997980979819798297983979849798597986979879798897989979909799197992979939799497995979969799797998979999800098001980029800398004980059800698007980089800998010980119801298013980149801598016980179801898019980209802198022980239802498025980269802798028980299803098031980329803398034980359803698037980389803998040980419804298043980449804598046980479804898049980509805198052980539805498055980569805798058980599806098061980629806398064980659806698067980689806998070980719807298073980749807598076980779807898079980809808198082980839808498085980869808798088980899809098091980929809398094980959809698097980989809998100981019810298103981049810598106981079810898109981109811198112981139811498115981169811798118981199812098121981229812398124981259812698127981289812998130981319813298133981349813598136981379813898139981409814198142981439814498145981469814798148981499815098151981529815398154981559815698157981589815998160981619816298163981649816598166981679816898169981709817198172981739817498175981769817798178981799818098181981829818398184981859818698187981889818998190981919819298193981949819598196981979819898199982009820198202982039820498205982069820798208982099821098211982129821398214982159821698217982189821998220982219822298223982249822598226982279822898229982309823198232982339823498235982369823798238982399824098241982429824398244982459824698247982489824998250982519825298253982549825598256982579825898259982609826198262982639826498265982669826798268982699827098271982729827398274982759827698277982789827998280982819828298283982849828598286982879828898289982909829198292982939829498295982969829798298982999830098301983029830398304983059830698307983089830998310983119831298313983149831598316983179831898319983209832198322983239832498325983269832798328983299833098331983329833398334983359833698337983389833998340983419834298343983449834598346983479834898349983509835198352983539835498355983569835798358983599836098361983629836398364983659836698367983689836998370983719837298373983749837598376983779837898379983809838198382983839838498385983869838798388983899839098391983929839398394983959839698397983989839998400984019840298403984049840598406984079840898409984109841198412984139841498415984169841798418984199842098421984229842398424984259842698427984289842998430984319843298433984349843598436984379843898439984409844198442984439844498445984469844798448984499845098451984529845398454984559845698457984589845998460984619846298463984649846598466984679846898469984709847198472984739847498475984769847798478984799848098481984829848398484984859848698487984889848998490984919849298493984949849598496984979849898499985009850198502985039850498505985069850798508985099851098511985129851398514985159851698517985189851998520985219852298523985249852598526985279852898529985309853198532985339853498535985369853798538985399854098541985429854398544985459854698547985489854998550985519855298553985549855598556985579855898559985609856198562985639856498565985669856798568985699857098571985729857398574985759857698577985789857998580985819858298583985849858598586985879858898589985909859198592985939859498595985969859798598985999860098601986029860398604986059860698607986089860998610986119861298613986149861598616986179861898619986209862198622986239862498625986269862798628986299863098631986329863398634986359863698637986389863998640986419864298643986449864598646986479864898649986509865198652986539865498655986569865798658986599866098661986629866398664986659866698667986689866998670986719867298673986749867598676986779867898679986809868198682986839868498685986869868798688986899869098691986929869398694986959869698697986989869998700987019870298703987049870598706987079870898709987109871198712987139871498715987169871798718987199872098721987229872398724987259872698727987289872998730987319873298733987349873598736987379873898739987409874198742987439874498745987469874798748987499875098751987529875398754987559875698757987589875998760987619876298763987649876598766987679876898769987709877198772987739877498775987769877798778987799878098781987829878398784987859878698787987889878998790987919879298793987949879598796987979879898799988009880198802988039880498805988069880798808988099881098811988129881398814988159881698817988189881998820988219882298823988249882598826988279882898829988309883198832988339883498835988369883798838988399884098841988429884398844988459884698847988489884998850988519885298853988549885598856988579885898859988609886198862988639886498865988669886798868988699887098871988729887398874988759887698877988789887998880988819888298883988849888598886988879888898889988909889198892988939889498895988969889798898988999890098901989029890398904989059890698907989089890998910989119891298913989149891598916989179891898919989209892198922989239892498925989269892798928989299893098931989329893398934989359893698937989389893998940989419894298943989449894598946989479894898949989509895198952989539895498955989569895798958989599896098961989629896398964989659896698967989689896998970989719897298973989749897598976989779897898979989809898198982989839898498985989869898798988989899899098991989929899398994989959899698997989989899999000990019900299003990049900599006990079900899009990109901199012990139901499015990169901799018990199902099021990229902399024990259902699027990289902999030990319903299033990349903599036990379903899039990409904199042990439904499045990469904799048990499905099051990529905399054990559905699057990589905999060990619906299063990649906599066990679906899069990709907199072990739907499075990769907799078990799908099081990829908399084990859908699087990889908999090990919909299093990949909599096990979909899099991009910199102991039910499105991069910799108991099911099111991129911399114991159911699117991189911999120991219912299123991249912599126991279912899129991309913199132991339913499135991369913799138991399914099141991429914399144991459914699147991489914999150991519915299153991549915599156991579915899159991609916199162991639916499165991669916799168991699917099171991729917399174991759917699177991789917999180991819918299183991849918599186991879918899189991909919199192991939919499195991969919799198991999920099201992029920399204992059920699207992089920999210992119921299213992149921599216992179921899219992209922199222992239922499225992269922799228992299923099231992329923399234992359923699237992389923999240992419924299243992449924599246992479924899249992509925199252992539925499255992569925799258992599926099261992629926399264992659926699267992689926999270992719927299273992749927599276992779927899279992809928199282992839928499285992869928799288992899929099291992929929399294992959929699297992989929999300993019930299303993049930599306993079930899309993109931199312993139931499315993169931799318993199932099321993229932399324993259932699327993289932999330993319933299333993349933599336993379933899339993409934199342993439934499345993469934799348993499935099351993529935399354993559935699357993589935999360993619936299363993649936599366993679936899369993709937199372993739937499375993769937799378993799938099381993829938399384993859938699387993889938999390993919939299393993949939599396993979939899399994009940199402994039940499405994069940799408994099941099411994129941399414994159941699417994189941999420994219942299423994249942599426994279942899429994309943199432994339943499435994369943799438994399944099441994429944399444994459944699447994489944999450994519945299453994549945599456994579945899459994609946199462994639946499465994669946799468994699947099471994729947399474994759947699477994789947999480994819948299483994849948599486994879948899489994909949199492994939949499495994969949799498994999950099501995029950399504995059950699507995089950999510995119951299513995149951599516995179951899519995209952199522995239952499525995269952799528995299953099531995329953399534995359953699537995389953999540995419954299543995449954599546995479954899549995509955199552995539955499555995569955799558995599956099561995629956399564995659956699567995689956999570995719957299573995749957599576995779957899579995809958199582995839958499585995869958799588995899959099591995929959399594995959959699597995989959999600996019960299603996049960599606996079960899609996109961199612996139961499615996169961799618996199962099621996229962399624996259962699627996289962999630996319963299633996349963599636996379963899639996409964199642996439964499645996469964799648996499965099651996529965399654996559965699657996589965999660996619966299663996649966599666996679966899669996709967199672996739967499675996769967799678996799968099681996829968399684996859968699687996889968999690996919969299693996949969599696996979969899699997009970199702997039970499705997069970799708997099971099711997129971399714997159971699717997189971999720997219972299723997249972599726997279972899729997309973199732997339973499735997369973799738997399974099741997429974399744997459974699747997489974999750997519975299753997549975599756997579975899759997609976199762997639976499765997669976799768997699977099771997729977399774997759977699777997789977999780997819978299783997849978599786997879978899789997909979199792997939979499795997969979799798997999980099801998029980399804998059980699807998089980999810998119981299813998149981599816998179981899819998209982199822998239982499825998269982799828998299983099831998329983399834998359983699837998389983999840998419984299843998449984599846998479984899849998509985199852998539985499855998569985799858998599986099861998629986399864998659986699867998689986999870998719987299873998749987599876998779987899879998809988199882998839988499885998869988799888998899989099891998929989399894998959989699897998989989999900999019990299903999049990599906999079990899909999109991199912999139991499915999169991799918999199992099921999229992399924999259992699927999289992999930999319993299933999349993599936999379993899939999409994199942999439994499945999469994799948999499995099951999529995399954999559995699957999589995999960999619996299963999649996599966999679996899969999709997199972999739997499975999769997799978999799998099981999829998399984999859998699987999889998999990999919999299993999949999599996999979999899999100000100001100002100003100004100005100006100007100008100009100010100011100012100013100014100015100016100017100018100019100020100021100022100023100024100025100026100027100028100029100030100031100032100033100034100035100036100037100038100039100040100041100042100043100044100045100046100047100048100049100050100051100052100053100054100055100056100057100058100059100060100061100062100063100064100065100066100067100068100069100070100071100072100073100074100075100076100077100078100079100080100081100082100083100084100085100086100087100088100089100090100091100092100093100094100095100096100097100098100099100100100101100102100103100104100105100106100107100108100109100110100111100112100113100114100115100116100117100118100119100120100121100122100123100124100125100126100127100128100129100130100131100132100133100134100135100136100137100138100139100140100141100142100143100144100145100146100147100148100149100150100151100152100153100154100155100156100157100158100159100160100161100162100163100164100165100166100167100168100169100170100171100172100173100174100175100176100177100178100179100180100181100182100183100184100185100186100187100188100189100190100191100192100193100194100195100196100197100198100199100200100201100202100203100204100205100206100207100208100209100210100211100212100213100214100215100216100217100218100219100220100221100222100223100224100225100226100227100228100229100230100231100232100233100234100235100236100237100238100239100240100241100242100243100244100245100246100247100248100249100250100251100252100253100254100255100256100257100258100259100260100261100262100263100264100265100266100267100268100269100270100271100272100273100274100275100276100277100278100279100280100281100282100283100284100285100286100287100288100289100290100291100292100293100294100295100296100297100298100299100300100301100302100303100304100305100306100307100308100309100310100311100312100313100314100315100316100317100318100319100320100321100322100323100324100325100326100327100328100329100330100331100332100333100334100335100336100337100338100339100340100341100342100343100344100345100346100347100348100349100350100351100352100353100354100355100356100357100358100359100360100361100362100363100364100365100366100367100368100369100370100371100372100373100374100375100376100377100378100379100380100381100382100383100384100385100386100387100388100389100390100391100392100393100394100395100396100397100398100399100400100401100402100403100404100405100406100407100408100409100410100411100412100413100414100415100416100417100418100419100420100421100422100423100424100425100426100427100428100429100430100431100432100433100434100435100436100437100438100439100440100441100442100443100444100445100446100447100448100449100450100451100452100453100454100455100456100457100458100459100460100461100462100463100464100465100466100467100468100469100470100471100472100473100474100475100476100477100478100479100480100481100482100483100484100485100486100487100488100489100490100491100492100493100494100495100496100497100498100499100500100501100502100503100504100505100506100507100508100509100510100511100512100513100514100515100516100517100518100519100520100521100522100523100524100525100526100527100528100529100530100531100532100533100534100535100536100537100538100539100540100541100542100543100544100545100546100547100548100549100550100551100552100553100554100555100556100557100558100559100560100561100562100563100564100565100566100567100568100569100570100571100572100573100574100575100576100577100578100579100580100581100582100583100584100585100586100587100588100589100590100591100592100593100594100595100596100597100598100599100600100601100602100603100604100605100606100607100608100609100610100611100612100613100614100615100616100617100618100619100620100621100622100623100624100625100626100627100628100629100630100631100632100633100634100635100636100637100638100639100640100641100642100643100644100645100646100647100648100649100650100651100652100653100654100655100656100657100658100659100660100661100662100663100664100665100666100667100668100669100670100671100672100673100674100675100676100677100678100679100680100681100682100683100684100685100686100687100688100689100690100691100692100693100694100695100696100697100698100699100700100701100702100703100704100705100706100707100708100709100710100711100712100713100714100715100716100717100718100719100720100721100722100723100724100725100726100727100728100729100730100731100732100733100734100735100736100737100738100739100740100741100742100743100744100745100746100747100748100749100750100751100752100753100754100755100756100757100758100759100760100761100762100763100764100765100766100767100768100769100770100771100772100773100774100775100776100777100778100779100780100781100782100783100784100785100786100787100788100789100790100791100792100793100794100795100796100797100798100799100800100801100802100803100804100805100806100807100808100809100810100811100812100813100814100815100816100817100818100819100820100821100822100823100824100825100826100827100828100829100830100831100832100833100834100835100836100837100838100839100840100841100842100843100844100845100846100847100848100849100850100851100852100853100854100855100856100857100858100859100860100861100862100863100864100865100866100867100868100869100870100871100872100873100874100875100876100877100878100879100880100881100882100883100884100885100886100887100888100889100890100891100892100893100894100895100896100897100898100899100900100901100902100903100904100905100906100907100908100909100910100911100912100913100914100915100916100917100918100919100920100921100922100923100924100925100926100927100928100929100930100931100932100933100934100935100936100937100938100939100940100941100942100943100944100945100946100947100948100949100950100951100952100953100954100955100956100957100958100959100960100961100962100963100964100965100966100967100968100969100970100971100972100973100974100975100976100977100978100979100980100981100982100983100984100985100986100987100988100989100990100991100992100993100994100995100996100997100998100999101000101001101002101003101004101005101006101007101008101009101010101011101012101013101014101015101016101017101018101019101020101021101022101023101024101025101026101027101028101029101030101031101032101033101034101035101036101037101038101039101040101041101042101043101044101045101046101047101048101049101050101051101052101053101054101055101056101057101058101059101060101061101062101063101064101065101066101067101068101069101070101071101072101073101074101075101076101077101078101079101080101081101082101083101084101085101086101087101088101089101090101091101092101093101094101095101096101097101098101099101100101101101102101103101104101105101106101107101108101109101110101111101112101113101114101115101116101117101118101119101120101121101122101123101124101125101126101127101128101129101130101131101132101133101134101135101136101137101138101139101140101141101142101143101144101145101146101147101148101149101150101151101152101153101154101155101156101157101158101159101160101161101162101163101164101165101166101167101168101169101170101171101172101173101174101175101176101177101178101179101180101181101182101183101184101185101186101187101188101189101190101191101192101193101194101195101196101197101198101199101200101201101202101203101204101205101206101207101208101209101210101211101212101213101214101215101216101217101218101219101220101221101222101223101224101225101226101227101228101229101230101231101232101233101234101235101236101237101238101239101240101241101242101243101244101245101246101247101248101249101250101251101252101253101254101255101256101257101258101259101260101261101262101263101264101265101266101267101268101269101270101271101272101273101274101275101276101277101278101279101280101281101282101283101284101285101286101287101288101289101290101291101292101293101294101295101296101297101298101299101300101301101302101303101304101305101306101307101308101309101310101311101312101313101314101315101316101317101318101319101320101321101322101323101324101325101326101327101328101329101330101331101332101333101334101335101336101337101338101339101340101341101342101343101344101345101346101347101348101349101350101351101352101353101354101355101356101357101358101359101360101361101362101363101364101365101366101367101368101369101370101371101372101373101374101375101376101377101378101379101380101381101382101383101384101385101386101387101388101389101390101391101392101393101394101395101396101397101398101399101400101401101402101403101404101405101406101407101408101409101410101411101412101413101414101415101416101417101418101419101420101421101422101423101424101425101426101427101428101429101430101431101432101433101434101435101436101437101438101439101440101441101442101443101444101445101446101447101448101449101450101451101452101453101454101455101456101457101458101459101460101461101462101463101464101465101466101467101468101469101470101471101472101473101474101475101476101477101478101479101480101481101482101483101484101485101486101487101488101489101490101491101492101493101494101495101496101497101498101499101500101501101502101503101504101505101506101507101508101509101510101511101512101513101514101515101516101517101518101519101520101521101522101523101524101525101526101527101528101529101530101531101532101533101534101535101536101537101538101539101540101541101542101543101544101545101546101547101548101549101550101551101552101553101554101555101556101557101558101559101560101561101562101563101564101565101566101567101568101569101570101571101572101573101574101575101576101577101578101579101580101581101582101583101584101585101586101587101588101589101590101591101592101593101594101595101596101597101598101599101600101601101602101603101604101605101606101607101608101609101610101611101612101613101614101615101616101617101618101619101620101621101622101623101624101625101626101627101628101629101630101631101632101633101634101635101636101637101638101639101640101641101642101643101644101645101646101647101648101649101650101651101652101653101654101655101656101657101658101659101660101661101662101663101664101665101666101667101668101669101670101671101672101673101674101675101676101677101678101679101680101681101682101683101684101685101686101687101688101689101690101691101692101693101694101695101696101697101698101699101700101701101702101703101704101705101706101707101708101709101710101711101712101713101714101715101716101717101718101719101720101721101722101723101724101725101726101727101728101729101730101731101732101733101734101735101736101737101738101739101740101741101742101743101744101745101746101747101748101749101750101751101752101753101754101755101756101757101758101759101760101761101762101763101764101765101766101767101768101769101770101771101772101773101774101775101776101777101778101779101780101781101782101783101784101785101786101787101788101789101790101791101792101793101794101795101796101797101798101799101800101801101802101803101804101805101806101807101808101809101810101811101812101813101814101815101816101817101818101819101820101821101822101823101824101825101826101827101828101829101830101831101832101833101834101835101836101837101838101839101840101841101842101843101844101845101846101847101848101849101850101851101852101853101854101855101856101857101858101859101860101861101862101863101864101865101866101867101868101869101870101871101872101873101874101875101876101877101878101879101880101881101882101883101884101885101886101887101888101889101890101891101892101893101894101895101896101897101898101899101900101901101902101903101904101905101906101907101908101909101910101911101912101913101914101915101916101917101918101919101920101921101922101923101924101925101926101927101928101929101930101931101932101933101934101935101936101937101938101939101940101941101942101943101944101945101946101947101948101949101950101951101952101953101954101955101956101957101958101959101960101961101962101963101964101965101966101967101968101969101970101971101972101973101974101975101976101977101978101979101980101981101982101983101984101985101986101987101988101989101990101991101992101993101994101995101996101997101998101999102000102001102002102003102004102005102006102007102008102009102010102011102012102013102014102015102016102017102018102019102020102021102022102023102024102025102026102027102028102029102030102031102032102033102034102035102036102037102038102039102040102041102042102043102044102045102046102047102048102049102050102051102052102053102054102055102056102057102058102059102060102061102062102063102064102065102066102067102068102069102070102071102072102073102074102075102076102077102078102079102080102081102082102083102084102085102086102087102088102089102090102091102092102093102094102095102096102097102098102099102100102101102102102103102104102105102106102107102108102109102110102111102112102113102114102115102116102117102118102119102120102121102122102123102124102125102126102127102128102129102130102131102132102133102134102135102136102137102138102139102140102141102142102143102144102145102146102147102148102149102150102151102152102153102154102155102156102157102158102159102160102161102162102163102164102165102166102167102168102169102170102171102172102173102174102175102176102177102178102179102180102181102182102183102184102185102186102187102188102189102190102191102192102193102194102195102196102197102198102199102200102201102202102203102204102205102206102207102208102209102210102211102212102213102214102215102216102217102218102219102220102221102222102223102224102225102226102227102228102229102230102231102232102233102234102235102236102237102238102239102240102241102242102243102244102245102246102247102248102249102250102251102252102253102254102255102256102257102258102259102260102261102262102263102264102265102266102267102268102269102270102271102272102273102274102275102276102277102278102279102280102281102282102283102284102285102286102287102288102289102290102291102292102293102294102295102296102297102298102299102300102301102302102303102304102305102306102307102308102309102310102311102312102313102314102315102316102317102318102319102320102321102322102323102324102325102326102327102328102329102330102331102332102333102334102335102336102337102338102339102340102341102342102343102344102345102346102347102348102349102350102351102352102353102354102355102356102357102358102359102360102361102362102363102364102365102366102367102368102369102370102371102372102373102374102375102376102377102378102379102380102381102382102383102384102385102386102387102388102389102390102391102392102393102394102395102396102397102398102399102400102401102402102403102404102405102406102407102408102409102410102411102412102413102414102415102416102417102418102419102420102421102422102423102424102425102426102427102428102429102430102431102432102433102434102435102436102437102438102439102440102441102442102443102444102445102446102447102448102449102450102451102452102453102454102455102456102457102458102459102460102461102462102463102464102465102466102467102468102469102470102471102472102473102474102475102476102477102478102479102480102481102482102483102484102485102486102487102488102489102490102491102492102493102494102495102496102497102498102499102500102501102502102503102504102505102506102507102508102509102510102511102512102513102514102515102516102517102518102519102520102521102522102523102524102525102526102527102528102529102530102531102532102533102534102535102536102537102538102539102540102541102542102543102544102545102546102547102548102549102550102551102552102553102554102555102556102557102558102559102560102561102562102563102564102565102566102567102568102569102570102571102572102573102574102575102576102577102578102579102580102581102582102583102584102585102586102587102588102589102590102591102592102593102594102595102596102597102598102599102600102601102602102603102604102605102606102607102608102609102610102611102612102613102614102615102616102617102618102619102620102621102622102623102624102625102626102627102628102629102630102631102632102633102634102635102636102637102638102639102640102641102642102643102644102645102646102647102648102649102650102651102652102653102654102655102656102657102658102659102660102661102662102663102664102665102666102667102668102669102670102671102672102673102674102675102676102677102678102679102680102681102682102683102684102685102686102687102688102689102690102691102692102693102694102695102696102697102698102699102700102701102702102703102704102705102706102707102708102709102710102711102712102713102714102715102716102717102718102719102720102721102722102723102724102725102726102727102728102729102730102731102732102733102734102735102736102737102738102739102740102741102742102743102744102745102746102747102748102749102750102751102752102753102754102755102756102757102758102759102760102761102762102763102764102765102766102767102768102769102770102771102772102773102774102775102776102777102778102779102780102781102782102783102784102785102786102787102788102789102790102791102792102793102794102795102796102797102798102799102800102801102802102803102804102805102806102807102808102809102810102811102812102813102814102815102816102817102818102819102820102821102822102823102824102825102826102827102828102829102830102831102832102833102834102835102836102837102838102839102840102841102842102843102844102845102846102847102848102849102850102851102852102853102854102855102856102857102858102859102860102861102862102863102864102865102866102867102868102869102870102871102872102873102874102875102876102877102878102879102880102881102882102883102884102885102886102887102888102889102890102891102892102893102894102895102896102897102898102899102900102901102902102903102904102905102906102907102908102909102910102911102912102913102914102915102916102917102918102919102920102921102922102923102924102925102926102927102928102929102930102931102932102933102934102935102936102937102938102939102940102941102942102943102944102945102946102947102948102949102950102951102952102953102954102955102956102957102958102959102960102961102962102963102964102965102966102967102968102969102970102971102972102973102974102975102976102977102978102979102980102981102982102983102984102985102986102987102988102989102990102991102992102993102994102995102996102997102998102999103000103001103002103003103004103005103006103007103008103009103010103011103012103013103014103015103016103017103018103019103020103021103022103023103024103025103026103027103028103029103030103031103032103033103034103035103036103037103038103039103040103041103042103043103044103045103046103047103048103049103050103051103052103053103054103055103056103057103058103059103060103061103062103063103064103065103066103067103068103069103070103071103072103073103074103075103076103077103078103079103080103081103082103083103084103085103086103087103088103089103090103091103092103093103094103095103096103097103098103099103100103101103102103103103104103105103106103107103108103109103110103111103112103113103114103115103116103117103118103119103120103121103122103123103124103125103126103127103128103129103130103131103132103133103134103135103136103137103138103139103140103141103142103143103144103145103146103147103148103149103150103151103152103153103154103155103156103157103158103159103160103161103162103163103164103165103166103167103168103169103170103171103172103173103174103175103176103177103178103179103180103181103182103183103184103185103186103187103188103189103190103191103192103193103194103195103196103197103198103199103200103201103202103203103204103205103206103207103208103209103210103211103212103213103214103215103216103217103218103219103220103221103222103223103224103225103226103227103228103229103230103231103232103233103234103235103236103237103238103239103240103241103242103243103244103245103246103247103248103249103250103251103252103253103254103255103256103257103258103259103260103261103262103263103264103265103266103267103268103269103270103271103272103273103274103275103276103277103278103279103280103281103282103283103284103285103286103287103288103289103290103291103292103293103294103295103296103297103298103299103300103301103302103303103304103305103306103307103308103309103310103311103312103313103314103315103316103317103318103319103320103321103322103323103324103325103326103327103328103329103330103331103332103333103334103335103336103337103338103339103340103341103342103343103344103345103346103347103348103349103350103351103352103353103354103355103356103357103358103359103360103361103362103363103364103365103366103367103368103369103370103371103372103373103374103375103376103377103378103379103380103381103382103383103384103385103386103387103388103389103390103391103392103393103394103395103396103397103398103399103400103401103402103403103404103405103406103407103408103409103410103411103412103413103414103415103416103417103418103419103420103421103422103423103424103425103426103427103428103429103430103431103432103433103434103435103436103437103438103439103440103441103442103443103444103445103446103447103448103449103450103451103452103453103454103455103456103457103458103459103460103461103462103463103464103465103466103467103468103469103470103471103472103473103474103475103476103477103478103479103480103481103482103483103484103485103486103487103488103489103490103491103492103493103494103495103496103497103498103499103500103501103502103503103504103505103506103507103508103509103510103511103512103513103514103515103516103517103518103519103520103521103522103523103524103525103526103527103528103529103530103531103532103533103534103535103536103537103538103539103540103541103542103543103544103545103546103547103548103549103550103551103552103553103554103555103556103557103558103559103560103561103562103563103564103565103566103567103568103569103570103571103572103573103574103575103576103577103578103579103580103581103582103583103584103585103586103587103588103589103590103591103592103593103594103595103596103597103598103599103600103601103602103603103604103605103606103607103608103609103610103611103612103613103614103615103616103617103618103619103620103621103622103623103624103625103626103627103628103629103630103631103632103633103634103635103636103637103638103639103640103641103642103643103644103645103646103647103648103649103650103651103652103653103654103655103656103657103658103659103660103661103662103663103664103665103666103667103668103669103670103671103672103673103674103675103676103677103678103679103680103681103682103683103684103685103686103687103688103689103690103691103692103693103694103695103696103697103698103699103700103701103702103703103704103705103706103707103708103709103710103711103712103713103714103715103716103717103718103719103720103721103722103723103724103725103726103727103728103729103730103731103732103733103734103735103736103737103738103739103740103741103742103743103744103745103746103747103748103749103750103751103752103753103754103755103756103757103758103759103760103761103762103763103764103765103766103767103768103769103770103771103772103773103774103775103776103777103778103779103780103781103782103783103784103785103786103787103788103789103790103791103792103793103794103795103796103797103798103799103800103801103802103803103804103805103806103807103808103809103810103811103812103813103814103815103816103817103818103819103820103821103822103823103824103825103826103827103828103829103830103831103832103833103834103835103836103837103838103839103840103841103842103843103844103845103846103847103848103849103850103851103852103853103854103855103856103857103858103859103860103861103862103863103864103865103866103867103868103869103870103871103872103873103874103875103876103877103878103879103880103881103882103883103884103885103886103887103888103889103890103891103892103893103894103895103896103897103898103899103900103901103902103903103904103905103906103907103908103909103910103911103912103913103914103915103916103917103918103919103920103921103922103923103924103925103926103927103928103929103930103931103932103933103934103935103936103937103938103939103940103941103942103943103944103945103946103947103948103949103950103951103952103953103954103955103956103957103958103959103960103961103962103963103964103965103966103967103968103969103970103971103972103973103974103975103976103977103978103979103980103981103982103983103984103985103986103987103988103989103990103991103992103993103994103995103996103997103998103999104000104001104002104003104004104005104006104007104008104009104010104011104012104013104014104015104016104017104018104019104020104021104022104023104024104025104026104027104028104029104030104031104032104033104034104035104036104037104038104039104040104041104042104043104044104045104046104047104048104049104050104051104052104053104054104055104056104057104058104059104060104061104062104063104064104065104066104067104068104069104070104071104072104073104074104075104076104077104078104079104080104081104082104083104084104085104086104087104088104089104090104091104092104093104094104095104096104097104098104099104100104101104102104103104104104105104106104107104108104109104110104111104112104113104114104115104116104117104118104119104120104121104122104123104124104125104126104127104128104129104130104131104132104133104134104135104136104137104138104139104140104141104142104143104144104145104146104147104148104149104150104151104152104153104154104155104156104157104158104159104160104161104162104163104164104165104166104167104168104169104170104171104172104173104174104175104176104177104178104179104180104181104182104183104184104185104186104187104188104189104190104191104192104193104194104195104196104197104198104199104200104201104202104203104204104205104206104207104208104209104210104211104212104213104214104215104216104217104218104219104220104221104222104223104224104225104226104227104228104229104230104231104232104233104234104235104236104237104238104239104240104241104242104243104244104245104246104247104248104249104250104251104252104253104254104255104256104257104258104259104260104261104262104263104264104265104266104267104268104269104270104271104272104273104274104275104276104277104278104279104280104281104282104283104284104285104286104287104288104289104290104291104292104293104294104295104296104297104298104299104300104301104302104303104304104305104306104307104308104309104310104311104312104313104314104315104316104317104318104319104320104321104322104323104324104325104326104327104328104329104330104331104332104333104334104335104336104337104338104339104340104341104342104343104344104345104346104347104348104349104350104351104352104353104354104355104356104357104358104359104360104361104362104363104364104365104366104367104368104369104370104371104372104373104374104375104376104377104378104379104380104381104382104383104384104385104386104387104388104389104390104391104392104393104394104395104396104397104398104399104400104401104402104403104404104405104406104407104408104409104410104411104412104413104414104415104416104417104418104419104420104421104422104423104424104425104426104427104428104429104430104431104432104433104434104435104436104437104438104439104440104441104442104443104444104445104446104447104448104449104450104451104452104453104454104455104456104457104458104459104460104461104462104463104464104465104466104467104468104469104470104471104472104473104474104475104476104477104478104479104480104481104482104483104484104485104486104487104488104489104490104491104492104493104494104495104496104497104498104499104500104501104502104503104504104505104506104507104508104509104510104511104512104513104514104515104516104517104518104519104520104521104522104523104524104525104526104527104528104529104530104531104532104533104534104535104536104537104538104539104540104541104542104543104544104545104546104547104548104549104550104551104552104553104554104555104556104557104558104559104560104561104562104563104564104565104566104567104568104569104570104571104572104573104574104575104576104577104578104579104580104581104582104583104584104585104586104587104588104589104590104591104592104593104594104595104596104597104598104599104600104601104602104603104604104605104606104607104608104609104610104611104612104613104614104615104616104617104618104619104620104621104622104623104624104625104626104627104628104629104630104631104632104633104634104635104636104637104638104639104640104641104642104643104644104645104646104647104648104649104650104651104652104653104654104655104656104657104658104659104660104661104662104663104664104665104666104667104668104669104670104671104672104673104674104675104676104677104678104679104680104681104682104683104684104685104686104687104688104689104690104691104692104693104694104695104696104697104698104699104700104701104702104703104704104705104706104707104708104709104710104711104712104713104714104715104716104717104718104719104720104721104722104723104724104725104726104727104728104729104730104731104732104733104734104735104736104737104738104739104740104741104742104743104744104745104746104747104748104749104750104751104752104753104754104755104756104757104758104759104760104761104762104763104764104765104766104767104768104769104770104771104772104773104774104775104776104777104778104779104780104781104782104783104784104785104786104787104788104789104790104791104792104793104794104795104796104797104798104799104800104801104802104803104804104805104806104807104808104809104810104811104812104813104814104815104816104817104818104819104820104821104822104823104824104825104826104827104828104829104830104831104832104833104834104835104836104837104838104839104840104841104842104843104844104845104846104847104848104849104850104851104852104853104854104855104856104857104858104859104860104861104862104863104864104865104866104867104868104869104870104871104872104873104874104875104876104877104878104879104880104881104882104883104884104885104886104887104888104889104890104891104892104893104894104895104896104897104898104899104900104901104902104903104904104905104906104907104908104909104910104911104912104913104914104915104916104917104918104919104920104921104922104923104924104925104926104927104928104929104930104931104932104933104934104935104936104937104938104939104940104941104942104943104944104945104946104947104948104949104950104951104952104953104954104955104956104957104958104959104960104961104962104963104964104965104966104967104968104969104970104971104972104973104974104975104976104977104978104979104980104981104982104983104984104985104986104987104988104989104990104991104992104993104994104995104996104997104998104999105000105001105002105003105004105005105006105007105008105009105010105011105012105013105014105015105016105017105018105019105020105021105022105023105024105025105026105027105028105029105030105031105032105033105034105035105036105037105038105039105040105041105042105043105044105045105046105047105048105049105050105051105052105053105054105055105056105057105058105059105060105061105062105063105064105065105066105067105068105069105070105071105072105073105074105075105076105077105078105079105080105081105082105083105084105085105086105087105088105089105090105091105092105093105094105095105096105097105098105099105100105101105102105103105104105105105106105107105108105109105110105111105112105113105114105115105116105117105118105119105120105121105122105123105124105125105126105127105128105129105130105131105132105133105134105135105136105137105138105139105140105141105142105143105144105145105146105147105148105149105150105151105152105153105154105155105156105157105158105159105160105161105162105163105164105165105166105167105168105169105170105171105172105173105174105175105176105177105178105179105180105181105182105183105184105185105186105187105188105189105190105191105192105193105194105195105196105197105198105199105200105201105202105203105204105205105206105207105208105209105210105211105212105213105214105215105216105217105218105219105220105221105222105223105224105225105226105227105228105229105230105231105232105233105234105235105236105237105238105239105240105241105242105243105244105245105246105247105248105249105250105251105252105253105254105255105256105257105258105259105260105261105262105263105264105265105266105267105268105269105270105271105272105273105274105275105276105277105278105279105280105281105282105283105284105285105286105287105288105289105290105291105292105293105294105295105296105297105298105299105300105301105302105303105304105305105306105307105308105309105310105311105312105313105314105315105316105317105318105319105320105321105322105323105324105325105326105327105328105329105330105331105332105333105334105335105336105337105338105339105340105341105342105343105344105345105346105347105348105349105350105351105352105353105354105355105356105357105358105359105360105361105362105363105364105365105366105367105368105369105370105371105372105373105374105375105376105377105378105379105380105381105382105383105384105385105386105387105388105389105390105391105392105393105394105395105396105397105398105399105400105401105402105403105404105405105406105407105408105409105410105411105412105413105414105415105416105417105418105419105420105421105422105423105424105425105426105427105428105429105430105431105432105433105434105435105436105437105438105439105440105441105442105443105444105445105446105447105448105449105450105451105452105453105454105455105456105457105458105459105460105461105462105463105464105465105466105467105468105469105470105471105472105473105474105475105476105477105478105479105480105481105482105483105484105485105486105487105488105489105490105491105492105493105494105495105496105497105498105499105500105501105502105503105504105505105506105507105508105509105510105511105512105513105514105515105516105517105518105519105520105521105522105523105524105525105526105527105528105529105530105531105532105533105534105535105536105537105538105539105540105541105542105543105544105545105546105547105548105549105550105551105552105553105554105555105556105557105558105559105560105561105562105563105564105565105566105567105568105569105570105571105572105573105574105575105576105577105578105579105580105581105582105583105584105585105586105587105588105589105590105591105592105593105594105595105596105597105598105599105600105601105602105603105604105605105606105607105608105609105610105611105612105613105614105615105616105617105618105619105620105621105622105623105624105625105626105627105628105629105630105631105632105633105634105635105636105637105638105639105640105641105642105643105644105645105646105647105648105649105650105651105652105653105654105655105656105657105658105659105660105661105662105663105664105665105666105667105668105669105670105671105672105673105674105675105676105677105678105679105680105681105682105683105684105685105686105687105688105689105690105691105692105693105694105695105696105697105698105699105700105701105702105703105704105705105706105707105708105709105710105711105712105713105714105715105716105717105718105719105720105721105722105723105724105725105726105727105728105729105730105731105732105733105734105735105736105737105738105739105740105741105742105743105744105745105746105747105748105749105750105751105752105753105754105755105756105757105758105759105760105761105762105763105764105765105766105767105768105769105770105771105772105773105774105775105776105777105778105779105780105781105782105783105784105785105786105787105788105789105790105791105792105793105794105795105796105797105798105799105800105801105802105803105804105805105806105807105808105809105810105811105812105813105814105815105816105817105818105819105820105821105822105823105824105825105826105827105828105829105830105831105832105833105834105835105836105837105838105839105840105841105842105843105844105845105846105847105848105849105850105851105852105853105854105855105856105857105858105859105860105861105862105863105864105865105866105867105868105869105870105871105872105873105874105875105876105877105878105879105880105881105882105883105884105885105886105887105888105889105890105891105892105893105894105895105896105897105898105899105900105901105902105903105904105905105906105907105908105909105910105911105912105913105914105915105916105917105918105919105920105921105922105923105924105925105926105927105928105929105930105931105932105933105934105935105936105937105938105939105940105941105942105943105944105945105946105947105948105949105950105951105952105953105954105955105956105957105958105959105960105961105962105963105964105965105966105967105968105969105970105971105972105973105974105975105976105977105978105979105980105981105982105983105984105985105986105987105988105989105990105991105992105993105994105995105996105997105998105999106000106001106002106003106004106005106006106007106008106009106010106011106012106013106014106015106016106017106018106019106020106021106022106023106024106025106026106027106028106029106030106031106032106033106034106035106036106037106038106039106040106041106042106043106044106045106046106047106048106049106050106051106052106053106054106055106056106057106058106059106060106061106062106063106064106065106066106067106068106069106070106071106072106073106074106075106076106077106078106079106080106081106082106083106084106085106086106087106088106089106090106091106092106093106094106095106096106097106098106099106100106101106102106103106104106105106106106107106108106109106110106111106112106113106114106115106116106117106118106119106120106121106122106123106124106125106126106127106128106129106130106131106132106133106134106135106136106137106138106139106140106141106142106143106144106145106146106147106148106149106150106151106152106153106154106155106156106157106158106159106160106161106162106163106164106165106166106167106168106169106170106171106172106173106174106175106176106177106178106179106180106181106182106183106184106185106186106187106188106189106190106191106192106193106194106195106196106197106198106199106200106201106202106203106204106205106206106207106208106209106210106211106212106213106214106215106216106217106218106219106220106221106222106223106224106225106226106227106228106229106230106231106232106233106234106235106236106237106238106239106240106241106242106243106244106245106246106247106248106249106250106251106252106253106254106255106256106257106258106259106260106261106262106263106264106265106266106267106268106269106270106271106272106273106274106275106276106277106278106279106280106281106282106283106284106285106286106287106288106289106290106291106292106293106294106295106296106297106298106299106300106301106302106303106304106305106306106307106308106309106310106311106312106313106314106315106316106317106318106319106320106321106322106323106324106325106326106327106328106329106330106331106332106333106334106335106336106337106338106339106340106341106342106343106344106345106346106347106348106349106350106351106352106353106354106355106356106357106358106359106360106361106362106363106364106365106366106367106368106369106370106371106372106373106374106375106376106377106378106379106380106381106382106383106384106385106386106387106388106389106390106391106392106393106394106395106396106397106398106399106400106401106402106403106404106405106406106407106408106409106410106411106412106413106414106415106416106417106418106419106420106421106422106423106424106425106426106427106428106429106430106431106432106433106434106435106436106437106438106439106440106441106442106443106444106445106446106447106448106449106450106451106452106453106454106455106456106457106458106459106460106461106462106463106464106465106466106467106468106469106470106471106472106473106474106475106476106477106478106479106480106481106482106483106484106485106486106487106488106489106490106491106492106493106494106495106496106497106498106499106500106501106502106503106504106505106506106507106508106509106510106511106512106513106514106515106516106517106518106519106520106521106522106523106524106525106526106527106528106529106530106531106532106533106534106535106536106537106538106539106540106541106542106543106544106545106546106547106548106549106550106551106552106553106554106555106556106557106558106559106560106561106562106563106564106565106566106567106568106569106570106571106572106573106574106575106576106577106578106579106580106581106582106583106584106585106586106587106588106589106590106591106592106593106594106595106596106597106598106599106600106601106602106603106604106605106606106607106608106609106610106611106612106613106614106615106616106617106618106619106620106621106622106623106624106625106626106627106628106629106630106631106632106633106634106635106636106637106638106639106640106641106642106643106644106645106646106647106648106649106650106651106652106653106654106655106656106657106658106659106660106661106662106663106664106665106666106667106668106669106670106671106672106673106674106675106676106677106678106679106680106681106682106683106684106685106686106687106688106689106690106691106692106693106694106695106696106697106698106699106700106701106702106703106704106705106706106707106708106709106710106711106712106713106714106715106716106717106718106719106720106721106722106723106724106725106726106727106728106729106730106731106732106733106734106735106736106737106738106739106740106741106742106743106744106745106746106747106748106749106750106751106752106753106754106755106756106757106758106759106760106761106762106763106764106765106766106767106768106769106770106771106772106773106774106775106776106777106778106779106780106781106782106783106784106785106786106787106788106789106790106791106792106793106794106795106796106797106798106799106800106801106802106803106804106805106806106807106808106809106810106811106812106813106814106815106816106817106818106819106820106821106822106823106824106825106826106827106828106829106830106831106832106833106834106835106836106837106838106839106840106841106842106843106844106845106846106847106848106849106850106851106852106853106854106855106856106857106858106859106860106861106862106863106864106865106866106867106868106869106870106871106872106873106874106875106876106877106878106879106880106881106882106883106884106885106886106887106888106889106890106891106892106893106894106895106896106897106898106899106900106901106902106903106904106905106906106907106908106909106910106911106912106913106914106915106916106917106918106919106920106921106922106923106924106925106926106927106928106929106930106931106932106933106934106935106936106937106938106939106940106941106942106943106944106945106946106947106948106949106950106951106952106953106954106955106956106957106958106959106960106961106962106963106964106965106966106967106968106969106970106971106972106973106974106975106976106977106978106979106980106981106982106983106984106985106986106987106988106989106990106991106992106993106994106995106996106997106998106999107000107001107002107003107004107005107006107007107008107009107010107011107012107013107014107015107016107017107018107019107020107021107022107023107024107025107026107027107028107029107030107031107032107033107034107035107036107037107038107039107040107041107042107043107044107045107046107047107048107049107050107051107052107053107054107055107056107057107058107059107060107061107062107063107064107065107066107067107068107069107070107071107072107073107074107075107076107077107078107079107080107081107082107083107084107085107086107087107088107089107090107091107092107093107094107095107096107097107098107099107100107101107102107103107104107105107106107107107108107109107110107111107112107113107114107115107116107117107118107119107120107121107122107123107124107125107126107127107128107129107130107131107132107133107134107135107136107137107138107139107140107141107142107143107144107145107146107147107148107149107150107151107152107153107154107155107156107157107158107159107160107161107162107163107164107165107166107167107168107169107170107171107172107173107174107175107176107177107178107179107180107181107182107183107184107185107186107187107188107189107190107191107192107193107194107195107196107197107198107199107200107201107202107203107204107205107206107207107208107209107210107211107212107213107214107215107216107217107218107219107220107221107222107223107224107225107226107227107228107229107230107231107232107233107234107235107236107237107238107239107240107241107242107243107244107245107246107247107248107249107250107251107252107253107254107255107256107257107258107259107260107261107262107263107264107265107266107267107268107269107270107271107272107273107274107275107276107277107278107279107280107281107282107283107284107285107286107287107288107289107290107291107292107293107294107295107296107297107298107299107300107301107302107303107304107305107306107307107308107309107310107311107312107313107314107315107316107317107318107319107320107321107322107323107324107325107326107327107328107329107330107331107332107333107334107335107336107337107338107339107340107341107342107343107344107345107346107347107348107349107350107351107352107353107354107355107356107357107358107359107360107361107362107363107364107365107366107367107368107369107370107371107372107373107374107375107376107377107378107379107380107381107382107383107384107385107386107387107388107389107390107391107392107393107394107395107396107397107398107399107400107401107402107403107404107405107406107407107408107409107410107411107412107413107414107415107416107417107418107419107420107421107422107423107424107425107426107427107428107429107430107431107432107433107434107435107436107437107438107439107440107441107442107443107444107445107446107447107448107449107450107451107452107453107454107455107456107457107458107459107460107461107462107463107464107465107466107467107468107469107470107471107472107473107474107475107476107477107478107479107480107481107482107483107484107485107486107487107488107489107490107491107492107493107494107495107496107497107498107499107500107501107502107503107504107505107506107507107508107509107510107511107512107513107514107515107516107517107518107519107520107521107522107523107524107525107526107527107528107529107530107531107532107533107534107535107536107537107538107539107540107541107542107543107544107545107546107547107548107549107550107551107552107553107554107555107556107557107558107559107560107561107562107563107564107565107566107567107568107569107570107571107572107573107574107575107576107577107578107579107580107581107582107583107584107585107586107587107588107589107590107591107592107593107594107595107596107597107598107599107600107601107602107603107604107605107606107607107608107609107610107611107612107613107614107615107616107617107618107619107620107621107622107623107624107625107626107627107628107629107630107631107632107633107634107635107636107637107638107639107640107641107642107643107644107645107646107647107648107649107650107651107652107653107654107655107656107657107658107659107660107661107662107663107664107665107666107667107668107669107670107671107672107673107674107675107676107677107678107679107680107681107682107683107684107685107686107687107688107689107690107691107692107693107694107695107696107697107698107699107700107701107702107703107704107705107706107707107708107709107710107711107712107713107714107715107716107717107718107719107720107721107722107723107724107725107726107727107728107729107730107731107732107733107734107735107736107737107738107739107740107741107742107743107744107745107746107747107748107749107750107751107752107753107754107755107756107757107758107759107760107761107762107763107764107765107766107767107768107769107770107771107772107773107774107775107776107777107778107779107780107781107782107783107784107785107786107787107788107789107790107791107792107793107794107795107796107797107798107799107800107801107802107803107804107805107806107807107808107809107810107811107812107813107814107815107816107817107818107819107820107821107822107823107824107825107826107827107828107829107830107831107832107833107834107835107836107837107838107839107840107841107842107843107844107845107846107847107848107849107850107851107852107853107854107855107856107857107858107859107860107861107862107863107864107865107866107867107868107869107870107871107872107873107874107875107876107877107878107879107880107881107882107883107884107885107886107887107888107889107890107891107892107893107894107895107896107897107898107899107900107901107902107903107904107905107906107907107908107909107910107911107912107913107914107915107916107917107918107919107920107921107922107923107924107925107926107927107928107929107930107931107932107933107934107935107936107937107938107939107940107941107942107943107944107945107946107947107948107949107950107951107952107953107954107955107956107957107958107959107960107961107962107963107964107965107966107967107968107969107970107971107972107973107974107975107976107977107978107979107980107981107982107983107984107985107986107987107988107989107990107991107992107993107994107995107996107997107998107999108000108001108002108003108004108005108006108007108008108009108010108011108012108013108014108015108016108017108018108019108020108021108022108023108024108025108026108027108028108029108030108031108032108033108034108035108036108037108038108039108040108041108042108043108044108045108046108047108048108049108050108051108052108053108054108055108056108057108058108059108060108061108062108063108064108065108066108067108068108069108070108071108072108073108074108075108076108077108078108079108080108081108082108083108084108085108086108087108088108089108090108091108092108093108094108095108096108097108098108099108100108101108102108103108104108105108106108107108108108109108110108111108112108113108114108115108116108117108118108119108120108121108122108123108124108125108126108127108128108129108130108131108132108133108134108135108136108137108138108139108140108141108142108143108144108145108146108147108148108149108150108151108152108153108154108155108156108157108158108159108160108161108162108163108164108165108166108167108168108169108170108171108172108173108174108175108176108177108178108179108180108181108182108183108184108185108186108187108188108189108190108191108192108193108194108195108196108197108198108199108200108201108202108203108204108205108206108207108208108209108210108211108212108213108214108215108216108217108218108219108220108221108222108223108224108225108226108227108228108229108230108231108232108233108234108235108236108237108238108239108240108241108242108243108244108245108246108247108248108249108250108251108252108253108254108255108256108257108258108259108260108261108262108263108264108265108266108267108268108269108270108271108272108273108274108275108276108277108278108279108280108281108282108283108284108285108286108287108288108289108290108291108292108293108294108295108296108297108298108299108300108301108302108303108304108305108306108307108308108309108310108311108312108313108314108315108316108317108318108319108320108321108322108323108324108325108326108327108328108329108330108331108332108333108334108335108336108337108338108339108340108341108342108343108344108345108346108347108348108349108350108351108352108353108354108355108356108357108358108359108360108361108362108363108364108365108366108367108368108369108370108371108372108373108374108375108376108377108378108379108380108381108382108383108384108385108386108387108388108389108390108391108392108393108394108395108396108397108398108399108400108401108402108403108404108405108406108407108408108409108410108411108412108413108414108415108416108417108418108419108420108421108422108423108424108425108426108427108428108429108430108431108432108433108434108435108436108437108438108439108440108441108442108443108444108445108446108447108448108449108450108451108452108453108454108455108456108457108458108459108460108461108462108463108464108465108466108467108468108469108470108471108472108473108474108475108476108477108478108479108480108481108482108483108484108485108486108487108488108489108490108491108492108493108494108495108496108497108498108499108500108501108502108503108504108505108506108507108508108509108510108511108512108513108514108515108516108517108518108519108520108521108522108523108524108525108526108527108528108529108530108531108532108533108534108535108536108537108538108539108540108541108542108543108544108545108546108547108548108549108550108551108552108553108554108555108556108557108558108559108560108561108562108563108564108565108566108567108568108569108570108571108572108573108574108575108576108577108578108579108580108581108582108583108584108585108586108587108588108589108590108591108592108593108594108595108596108597108598108599108600108601108602108603108604108605108606108607108608108609108610108611108612108613108614108615108616108617108618108619108620108621108622108623108624108625108626108627108628108629108630108631108632108633108634108635108636108637108638108639108640108641108642108643108644108645108646108647108648108649108650108651108652108653108654108655108656108657108658108659108660108661108662108663108664108665108666108667108668108669108670108671108672108673108674108675108676108677108678108679108680108681108682108683108684108685108686108687108688108689108690108691108692108693108694108695108696108697108698108699108700108701108702108703108704108705108706108707108708108709108710108711108712108713108714108715108716108717108718108719108720108721108722108723108724108725108726108727108728108729108730108731108732108733108734108735108736108737108738108739108740108741108742108743108744108745108746108747108748108749108750108751108752108753108754108755108756108757108758108759108760108761108762108763108764108765108766108767108768108769108770108771108772108773108774108775108776108777108778108779108780108781108782108783108784108785108786108787108788108789108790108791108792108793108794108795108796108797108798108799108800108801108802108803108804108805108806108807108808108809108810108811108812108813108814108815108816108817108818108819108820108821108822108823108824108825108826108827108828108829108830108831108832108833108834108835108836108837108838108839108840108841108842108843108844108845108846108847108848108849108850108851108852108853108854108855108856108857108858108859108860108861108862108863108864108865108866108867108868108869108870108871108872108873108874108875108876108877108878108879108880108881108882108883108884108885108886108887108888108889108890108891108892108893108894108895108896108897108898108899108900108901108902108903108904108905108906108907108908108909108910108911108912108913108914108915108916108917108918108919108920108921108922108923108924108925108926108927108928108929108930108931108932108933108934108935108936108937108938108939108940108941108942108943108944108945108946108947108948108949108950108951108952108953108954108955108956108957108958108959108960108961108962108963108964108965108966108967108968108969108970108971108972108973108974108975108976108977108978108979108980108981108982108983108984108985108986108987108988108989108990108991108992108993108994108995108996108997108998108999109000109001109002109003109004109005109006109007109008109009109010109011109012109013109014109015109016109017109018109019109020109021109022109023109024109025109026109027109028109029109030109031109032109033109034109035109036109037109038109039109040109041109042109043109044109045109046109047109048109049109050109051109052109053109054109055109056109057109058109059109060109061109062109063109064109065109066109067109068109069109070109071109072109073109074109075109076109077109078109079109080109081109082109083109084109085109086109087109088109089109090109091109092109093109094109095109096109097109098109099109100109101109102109103109104109105109106109107109108109109109110109111109112109113109114109115109116109117109118109119109120109121109122109123109124109125109126109127109128109129109130109131109132109133109134109135109136109137109138109139109140109141109142109143109144109145109146109147109148109149109150109151109152109153109154109155109156109157109158109159109160109161109162109163109164109165109166109167109168109169109170109171109172109173109174109175109176109177109178109179109180109181109182109183109184109185109186109187109188109189109190109191109192109193109194109195109196109197109198109199109200109201109202109203109204109205109206109207109208109209109210109211109212109213109214109215109216109217109218109219109220109221109222109223109224109225109226109227109228109229109230109231109232109233109234109235109236109237109238109239109240109241109242109243109244109245109246109247109248109249109250109251109252109253109254109255109256109257109258109259109260109261109262109263109264109265109266109267109268109269109270109271109272109273109274109275109276109277109278109279109280109281109282109283109284109285109286109287109288109289109290109291109292109293109294109295109296109297109298109299109300109301109302109303109304109305109306109307109308109309109310109311109312109313109314109315109316109317109318109319109320109321109322109323109324109325109326109327109328109329109330109331109332109333109334109335109336109337109338109339109340109341109342109343109344109345109346109347109348109349109350109351109352109353109354109355109356109357109358109359109360109361109362109363109364109365109366109367109368109369109370109371109372109373109374109375109376109377109378109379109380109381109382109383109384109385109386109387109388109389109390109391109392109393109394109395109396109397109398109399109400109401109402109403109404109405109406109407109408109409109410109411109412109413109414109415109416109417109418109419109420109421109422109423109424109425109426109427109428109429109430109431109432109433109434109435109436109437109438109439109440109441109442109443109444109445109446109447109448109449109450109451109452109453109454109455109456109457109458109459109460109461109462109463109464109465109466109467109468109469109470109471109472109473109474109475109476109477109478109479109480109481109482109483109484109485109486109487109488109489109490109491109492109493109494109495109496109497109498109499109500109501109502109503109504109505109506109507109508109509109510109511109512109513109514109515109516109517109518109519109520109521109522109523109524109525109526109527109528109529109530109531109532109533109534109535109536109537109538109539109540109541109542109543109544109545109546109547109548109549109550109551109552109553109554109555109556109557109558109559109560109561109562109563109564109565109566109567109568109569109570109571109572109573109574109575109576109577109578109579109580109581109582109583109584109585109586109587109588109589109590109591109592109593109594109595109596109597109598109599109600109601109602109603109604109605109606109607109608109609109610109611109612109613109614109615109616109617109618109619109620109621109622109623109624109625109626109627109628109629109630109631109632109633109634109635109636109637109638109639109640109641109642109643109644109645109646109647109648109649109650109651109652109653109654109655109656109657109658109659109660109661109662109663109664109665109666109667109668109669109670109671109672109673109674109675109676109677109678109679109680109681109682109683109684109685109686109687109688109689109690109691109692109693109694109695109696109697109698109699109700109701109702109703109704109705109706109707109708109709109710109711109712109713109714109715109716109717109718109719109720109721109722109723109724109725109726109727109728109729109730109731109732109733109734109735109736109737109738109739109740109741109742109743109744109745109746109747109748109749109750109751109752109753109754109755109756109757109758109759109760109761109762109763109764109765109766109767109768109769109770109771109772109773109774109775109776109777109778109779109780109781109782109783109784109785109786109787109788109789109790109791109792109793109794109795109796109797109798109799109800109801109802109803109804109805109806109807109808109809109810109811109812109813109814109815109816109817109818109819109820109821109822109823109824109825109826109827109828109829109830109831109832109833109834109835109836109837109838109839109840109841109842109843109844109845109846109847109848109849109850109851109852109853109854109855109856109857109858109859109860109861109862109863109864109865109866109867109868109869109870109871109872109873109874109875109876109877109878109879109880109881109882109883109884109885109886109887109888109889109890109891109892109893109894109895109896109897109898109899109900109901109902109903109904109905109906109907109908109909109910109911109912109913109914109915109916109917109918109919109920109921109922109923109924109925109926109927109928109929109930109931109932109933109934109935109936109937109938109939109940109941109942109943109944109945109946109947109948109949109950109951109952109953109954109955109956109957109958109959109960109961109962109963109964109965109966109967109968109969109970109971109972109973109974109975109976109977109978109979109980109981109982109983109984109985109986109987109988109989109990109991109992109993109994109995109996109997109998109999110000110001110002110003110004110005110006110007110008110009110010110011110012110013110014110015110016110017110018110019110020110021110022110023110024110025110026110027110028110029110030110031110032110033110034110035110036110037110038110039110040110041110042110043110044110045110046110047110048110049110050110051110052110053110054110055110056110057110058110059110060110061110062110063110064110065110066110067110068110069110070110071110072110073110074110075110076110077110078110079110080110081110082110083110084110085110086110087110088110089110090110091110092110093110094110095110096110097110098110099110100110101110102110103110104110105110106110107110108110109110110110111110112110113110114110115110116110117110118110119110120110121110122110123110124110125110126110127110128110129110130110131110132110133110134110135110136110137110138110139110140110141110142110143110144110145110146110147110148110149110150110151110152110153110154110155110156110157110158110159110160110161110162110163110164110165110166110167110168110169110170110171110172110173110174110175110176110177110178110179110180110181110182110183110184110185110186110187110188110189110190110191110192110193110194110195110196110197110198110199110200110201110202110203110204110205110206110207110208110209110210110211110212110213110214110215110216110217110218110219110220110221110222110223110224110225110226110227110228110229110230110231110232110233110234110235110236110237110238110239110240110241110242110243110244110245110246110247110248110249110250110251110252110253110254110255110256110257110258110259110260110261110262110263110264110265110266110267110268110269110270110271110272110273110274110275110276110277110278110279110280110281110282110283110284110285110286110287110288110289110290110291110292110293110294110295110296110297110298110299110300110301110302110303110304110305110306110307110308110309110310110311110312110313110314110315110316110317110318110319110320110321110322110323110324110325110326110327110328110329110330110331110332110333110334110335110336110337110338110339110340110341110342110343110344110345110346110347110348110349110350110351110352110353110354110355110356110357110358110359110360110361110362110363110364110365110366110367110368110369110370110371110372110373110374110375110376110377110378110379110380110381110382110383110384110385110386110387110388110389110390110391110392110393110394110395110396110397110398110399110400110401110402110403110404110405110406110407110408110409110410110411110412110413110414110415110416110417110418110419110420110421110422110423110424110425110426110427110428110429110430110431110432110433110434110435110436110437110438110439110440110441110442110443110444110445110446110447110448110449110450110451110452110453110454110455110456110457110458110459110460110461110462110463110464110465110466110467110468110469110470110471110472110473110474110475110476110477110478110479110480110481110482110483110484110485110486110487110488110489110490110491110492110493110494110495110496110497110498110499110500110501110502110503110504110505110506110507110508110509110510110511110512110513110514110515110516110517110518110519110520110521110522110523110524110525110526110527110528110529110530110531110532110533110534110535110536110537110538110539110540110541110542110543110544110545110546110547110548110549110550110551110552110553110554110555110556110557110558110559110560110561110562110563110564110565110566110567110568110569110570110571110572110573110574110575110576110577110578110579110580110581110582110583110584110585110586110587110588110589110590110591110592110593110594110595110596110597110598110599110600110601110602110603110604110605110606110607110608110609110610110611110612110613110614110615110616110617110618110619110620110621110622110623110624110625110626110627110628110629110630110631110632110633110634110635110636110637110638110639110640110641110642110643110644110645110646110647110648110649110650110651110652110653110654110655110656110657110658110659110660110661110662110663110664110665110666110667110668110669110670110671110672110673110674110675110676110677110678110679110680110681110682110683110684110685110686110687110688110689110690110691110692110693110694110695110696110697110698110699110700110701110702110703110704110705110706110707110708110709110710110711110712110713110714110715110716110717110718110719110720110721110722110723110724110725110726110727110728110729110730110731110732110733110734110735110736110737110738110739110740110741110742110743110744110745110746110747110748110749110750110751110752110753110754110755110756110757110758110759110760110761110762110763110764110765110766110767110768110769110770110771110772110773110774110775110776110777110778110779110780110781110782110783110784110785110786110787110788110789110790110791110792110793110794110795110796110797110798110799110800110801110802110803110804110805110806110807110808110809110810110811110812110813110814110815110816110817110818110819110820110821110822110823110824110825110826110827110828110829110830110831110832110833110834110835110836110837110838110839110840110841110842110843110844110845110846110847110848110849110850110851110852110853110854110855110856110857110858110859110860110861110862110863110864110865110866110867110868110869110870110871110872110873110874110875110876110877110878110879110880110881110882110883110884110885110886110887110888110889110890110891110892110893110894110895110896110897110898110899110900110901110902110903110904110905110906110907110908110909110910110911110912110913110914110915110916110917110918110919110920110921110922110923110924110925110926110927110928110929110930110931110932110933110934110935110936110937110938110939110940110941110942110943110944110945110946110947110948110949110950110951110952110953110954110955110956110957110958110959110960110961110962110963110964110965110966110967110968110969110970110971110972110973110974110975110976110977110978110979110980110981110982110983110984110985110986110987110988110989110990110991110992110993110994110995110996110997110998110999111000111001111002111003111004111005111006111007111008111009111010111011111012111013111014111015111016111017111018111019111020111021111022111023111024111025111026111027111028111029111030111031111032111033111034111035111036111037111038111039111040111041111042111043111044111045111046111047111048111049111050111051111052111053111054111055111056111057111058111059111060111061111062111063111064111065111066111067111068111069111070111071111072111073111074111075111076111077111078111079111080111081111082111083111084111085111086111087111088111089111090111091111092111093111094111095111096111097111098111099111100111101111102111103111104111105111106111107111108111109111110111111111112111113111114111115111116111117111118111119111120111121111122111123111124111125111126111127111128111129111130111131111132111133111134111135111136111137111138111139111140111141111142111143111144111145111146111147111148111149111150111151111152111153111154111155111156111157111158111159111160111161111162111163111164111165111166111167111168111169111170111171111172111173111174111175111176111177111178111179111180111181111182111183111184111185111186111187111188111189111190111191111192111193111194111195111196111197111198111199111200111201111202111203111204111205111206111207111208111209111210111211111212111213111214111215111216111217111218111219111220111221111222111223111224111225111226111227111228111229111230111231111232111233111234111235111236111237111238111239111240111241111242111243111244111245111246111247111248111249111250111251111252111253111254111255111256111257111258111259111260111261111262111263111264111265111266111267111268111269111270111271111272111273111274111275111276111277111278111279111280111281111282111283111284111285111286111287111288111289111290111291111292111293111294111295111296111297111298111299111300111301111302111303111304111305111306111307111308111309111310111311111312111313111314111315111316111317111318111319111320111321111322111323111324111325111326111327111328111329111330111331111332111333111334111335111336111337111338111339111340111341111342111343111344111345111346111347111348111349111350111351111352111353111354111355111356111357111358111359111360111361111362111363111364111365111366111367111368111369111370111371111372111373111374111375111376111377111378111379111380111381111382111383111384111385111386111387111388111389111390111391111392111393111394111395111396111397111398111399111400111401111402111403111404111405111406111407111408111409111410111411111412111413111414111415111416111417111418111419111420111421111422111423111424111425111426111427111428111429111430111431111432111433111434111435111436111437111438111439111440111441111442111443111444111445111446111447111448111449111450111451111452111453111454111455111456111457111458111459111460111461111462111463111464111465111466111467111468111469111470111471111472111473111474111475111476111477111478111479111480111481111482111483111484111485111486111487111488111489111490111491111492111493111494111495111496111497111498111499111500111501111502111503111504111505111506111507111508111509111510111511111512111513111514111515111516111517111518111519111520111521111522111523111524111525111526111527111528111529111530111531111532111533111534111535111536111537111538111539111540111541111542111543111544111545111546111547111548111549111550111551111552111553111554111555111556111557111558111559111560111561111562111563111564111565111566111567111568111569111570111571111572111573111574111575111576111577111578111579111580111581111582111583111584111585111586111587111588111589111590111591111592111593111594111595111596111597111598111599111600111601111602111603111604111605111606111607111608111609111610111611111612111613111614111615111616111617111618111619111620111621111622111623111624111625111626111627111628111629111630111631111632111633111634111635111636111637111638111639111640111641111642111643111644111645111646111647111648111649111650111651111652111653111654111655111656111657111658111659111660111661111662111663111664111665111666111667111668111669111670111671111672111673111674111675111676111677111678111679111680111681111682111683111684111685111686111687111688111689111690111691111692111693111694111695111696111697111698111699111700111701111702111703111704111705111706111707111708111709111710111711111712111713111714111715111716111717111718111719111720111721111722111723111724111725111726111727111728111729111730111731111732111733111734111735111736111737111738111739111740111741111742111743111744111745111746111747111748111749111750111751111752111753111754111755111756111757111758111759111760111761111762111763111764111765111766111767111768111769111770111771111772111773111774111775111776111777111778111779111780111781111782111783111784111785111786111787111788111789111790111791111792111793111794111795111796111797111798111799111800111801111802111803111804111805111806111807111808111809111810111811111812111813111814111815111816111817111818111819111820111821111822111823111824111825111826111827111828111829111830111831111832111833111834111835111836111837111838111839111840111841111842111843111844111845111846111847111848111849111850111851111852111853111854111855111856111857111858111859111860111861111862111863111864111865111866111867111868111869111870111871111872111873111874111875111876111877111878111879111880111881111882111883111884111885111886111887111888111889111890111891111892111893111894111895111896111897111898111899111900111901111902111903111904111905111906111907111908111909111910111911111912111913111914111915111916111917111918111919111920111921111922111923111924111925111926111927111928111929111930111931111932111933111934111935111936111937111938111939111940111941111942111943111944111945111946111947111948111949111950111951111952111953111954111955111956111957111958111959111960111961111962111963111964111965111966111967111968111969111970111971111972111973111974111975111976111977111978111979111980111981111982111983111984111985111986111987111988111989111990111991111992111993111994111995111996111997111998111999112000112001112002112003112004112005112006112007112008112009112010112011112012112013112014112015112016112017112018112019112020112021112022112023112024112025112026112027112028112029112030112031112032112033112034112035112036112037112038112039112040112041112042112043112044112045112046112047112048112049112050112051112052112053112054112055112056112057112058112059112060112061112062112063112064112065112066112067112068112069112070112071112072112073112074112075112076112077112078112079112080112081112082112083112084112085112086112087112088112089112090112091112092112093112094112095112096112097112098112099112100112101112102112103112104112105112106112107112108112109112110112111112112112113112114112115112116112117112118112119112120112121112122112123112124112125112126112127112128112129112130112131112132112133112134112135112136112137112138112139112140112141112142112143112144112145112146112147112148112149112150112151112152112153112154112155112156112157112158112159112160112161112162112163112164112165112166112167112168112169112170112171112172112173112174112175112176112177112178112179112180112181112182112183112184112185112186112187112188112189112190112191112192112193112194112195112196112197112198112199112200112201112202112203112204112205112206112207112208112209112210112211112212112213112214112215112216112217112218112219112220112221112222112223112224112225112226112227112228112229112230112231112232112233112234112235112236112237112238112239112240112241112242112243112244112245112246112247112248112249112250112251112252112253112254112255112256112257112258112259112260112261112262112263112264112265112266112267112268112269112270112271112272112273112274112275112276112277112278112279112280112281112282112283112284112285112286112287112288112289112290112291112292112293112294112295112296112297112298112299112300112301112302112303112304112305112306112307112308112309112310112311112312112313112314112315112316112317112318112319112320112321112322112323112324112325112326112327112328112329112330112331112332112333112334112335112336112337112338112339112340112341112342112343112344112345112346112347112348112349112350112351112352112353112354112355112356112357112358112359112360112361112362112363112364112365112366112367112368112369112370112371112372112373112374112375112376112377112378112379112380112381112382112383112384112385112386112387112388112389112390112391112392112393112394112395112396112397112398112399112400112401112402112403112404112405112406112407112408112409112410112411112412112413112414112415112416112417112418112419112420112421112422112423112424112425112426112427112428112429112430112431112432112433112434112435112436112437112438112439112440112441112442112443112444112445112446112447112448112449112450112451112452112453112454112455112456112457112458112459112460112461112462112463112464112465112466112467112468112469112470112471112472112473112474112475112476112477112478112479112480112481112482112483112484112485112486112487112488112489112490112491112492112493112494112495112496112497112498112499112500112501112502112503112504112505112506112507112508112509112510112511112512112513112514112515112516112517112518112519112520112521112522112523112524112525112526112527112528112529112530112531112532112533112534112535112536112537112538112539112540112541112542112543112544112545112546112547112548112549112550112551112552112553112554112555112556112557112558112559112560112561112562112563112564112565112566112567112568112569112570112571112572112573112574112575112576112577112578112579112580112581112582112583112584112585112586112587112588112589112590112591112592112593112594112595112596112597112598112599112600112601112602112603112604112605112606112607112608112609112610112611112612112613112614112615112616112617112618112619112620112621112622112623112624112625112626112627112628112629112630112631112632112633112634112635112636112637112638112639112640112641112642112643112644112645112646112647112648112649112650112651112652112653112654112655112656112657112658112659112660112661112662112663112664112665112666112667112668112669112670112671112672112673112674112675112676112677112678112679112680112681112682112683112684112685112686112687112688112689112690112691112692112693112694112695112696112697112698112699112700112701112702112703112704112705112706112707112708112709112710112711112712112713112714112715112716112717112718112719112720112721112722112723112724112725112726112727112728112729112730112731112732112733112734112735112736112737112738112739112740112741112742112743112744112745112746112747112748112749112750112751112752112753112754112755112756112757112758112759112760112761112762112763112764112765112766112767112768112769112770112771112772112773112774112775112776112777112778112779112780112781112782112783112784112785112786112787112788112789112790112791112792112793112794112795112796112797112798112799112800112801112802112803112804112805112806112807112808112809112810112811112812112813112814112815112816112817112818112819112820112821112822112823112824112825112826112827112828112829112830112831112832112833112834112835112836112837112838112839112840112841112842112843112844112845112846112847112848112849112850112851112852112853112854112855112856112857112858112859112860112861112862112863112864112865112866112867112868112869112870112871112872112873112874112875112876112877112878112879112880112881112882112883112884112885112886112887112888112889112890112891112892112893112894112895112896112897112898112899112900112901112902112903112904112905112906112907112908112909112910112911112912112913112914112915112916112917112918112919112920112921112922112923112924112925112926112927112928112929112930112931112932112933112934112935112936112937112938112939112940112941112942112943112944112945112946112947112948112949112950112951112952112953112954112955112956112957112958112959112960112961112962112963112964112965112966112967112968112969112970112971112972112973112974112975112976112977112978112979112980112981112982112983112984112985112986112987112988112989112990112991112992112993112994112995112996112997112998112999113000113001113002113003113004113005113006113007113008113009113010113011113012113013113014113015113016113017113018113019113020113021113022113023113024113025113026113027113028113029113030113031113032113033113034113035113036113037113038113039113040113041113042113043113044113045113046113047113048113049113050113051113052113053113054113055113056113057113058113059113060113061113062113063113064113065113066113067113068113069113070113071113072113073113074113075113076113077113078113079113080113081113082113083113084113085113086113087113088113089113090113091113092113093113094113095113096113097113098113099113100113101113102113103113104113105113106113107113108113109113110113111113112113113113114113115113116113117113118113119113120113121113122113123113124113125113126113127113128113129113130113131113132113133113134113135113136113137113138113139113140113141113142113143113144113145113146113147113148113149113150113151113152113153113154113155113156113157113158113159113160113161113162113163113164113165113166113167113168113169113170113171113172113173113174113175113176113177113178113179113180113181113182113183113184113185113186113187113188113189113190113191113192113193113194113195113196113197113198113199113200113201113202113203113204113205113206113207113208113209113210113211113212113213113214113215113216113217113218113219113220113221113222113223113224113225113226113227113228113229113230113231113232113233113234113235113236113237113238113239113240113241113242113243113244113245113246113247113248113249113250113251113252113253113254113255113256113257113258113259113260113261113262113263113264113265113266113267113268113269113270113271113272113273113274113275113276113277113278113279113280113281113282113283113284113285113286113287113288113289113290113291113292113293113294113295113296113297113298113299113300113301113302113303113304113305113306113307113308113309113310113311113312113313113314113315113316113317113318113319113320113321113322113323113324113325113326113327113328113329113330113331113332113333113334113335113336113337113338113339113340113341113342113343113344113345113346113347113348113349113350113351113352113353113354113355113356113357113358113359113360113361113362113363113364113365113366113367113368113369113370113371113372113373113374113375113376113377113378113379113380113381113382113383113384113385113386113387113388113389113390113391113392113393113394113395113396113397113398113399113400113401113402113403113404113405113406113407113408113409113410113411113412113413113414113415113416113417113418113419113420113421113422113423113424113425113426113427113428113429113430113431113432113433113434113435113436113437113438113439113440113441113442113443113444113445113446113447113448113449113450113451113452113453113454113455113456113457113458113459113460113461113462113463113464113465113466113467113468113469113470113471113472113473113474113475113476113477113478113479113480113481113482113483113484113485113486113487113488113489113490113491113492113493113494113495113496113497113498113499113500113501113502113503113504113505113506113507113508113509113510113511113512113513113514113515113516113517113518113519113520113521113522113523113524113525113526113527113528113529113530113531113532113533113534113535113536113537113538113539113540113541113542113543113544113545113546113547113548113549113550113551113552113553113554113555113556113557113558113559113560113561113562113563113564113565113566113567113568113569113570113571113572113573113574113575113576113577113578113579113580113581113582113583113584113585113586113587113588113589113590113591113592113593113594113595113596113597113598113599113600113601113602113603113604113605113606113607113608113609113610113611113612113613113614113615113616113617113618113619113620113621113622113623113624113625113626113627113628113629113630113631113632113633113634113635113636113637113638113639113640113641113642113643113644113645113646113647113648113649113650113651113652113653113654113655113656113657113658113659113660113661113662113663113664113665113666113667113668113669113670113671113672113673113674113675113676113677113678113679113680113681113682113683113684113685113686113687113688113689113690113691113692113693113694113695113696113697113698113699113700113701113702113703113704113705113706113707113708113709113710113711113712113713113714113715113716113717113718113719113720113721113722113723113724113725113726113727113728113729113730113731113732113733113734113735113736113737113738113739113740113741113742113743113744113745113746113747113748113749113750113751113752113753113754113755113756113757113758113759113760113761113762113763113764113765113766113767113768113769113770113771113772113773113774113775113776113777113778113779113780113781113782113783113784113785113786113787113788113789113790113791113792113793113794113795113796113797113798113799113800113801113802113803113804113805113806113807113808113809113810113811113812113813113814113815113816113817113818113819113820113821113822113823113824113825113826113827113828113829113830113831113832113833113834113835113836113837113838113839113840113841113842113843113844113845113846113847113848113849113850113851113852113853113854113855113856113857113858113859113860113861113862113863113864113865113866113867113868113869113870113871113872113873113874113875113876113877113878113879113880113881113882113883113884113885113886113887113888113889113890113891113892113893113894113895113896113897113898113899113900113901113902113903113904113905113906113907113908113909113910113911113912113913113914113915113916113917113918113919113920113921113922113923113924113925113926113927113928113929113930113931113932113933113934113935113936113937113938113939113940113941113942113943113944113945113946113947113948113949113950113951113952113953113954113955113956113957113958113959113960113961113962113963113964113965113966113967113968113969113970113971113972113973113974113975113976113977113978113979113980113981113982113983113984113985113986113987113988113989113990113991113992113993113994113995113996113997113998113999114000114001114002114003114004114005114006114007114008114009114010114011114012114013114014114015114016114017114018114019114020114021114022114023114024114025114026114027114028114029114030114031114032114033114034114035114036114037114038114039114040114041114042114043114044114045114046114047114048114049114050114051114052114053114054114055114056114057114058114059114060114061114062114063114064114065114066114067114068114069114070114071114072114073114074114075114076114077114078114079114080114081114082114083114084114085114086114087114088114089114090114091114092114093114094114095114096114097114098114099114100114101114102114103114104114105114106114107114108114109114110114111114112114113114114114115114116114117114118114119114120114121114122114123114124114125114126114127114128114129114130114131114132114133114134114135114136114137114138114139114140114141114142114143114144114145114146114147114148114149114150114151114152114153114154114155114156114157114158114159114160114161114162114163114164114165114166114167114168114169114170114171114172114173114174114175114176114177114178114179114180114181114182114183114184114185114186114187114188114189114190114191114192114193114194114195114196114197114198114199114200114201114202114203114204114205114206114207114208114209114210114211114212114213114214114215114216114217114218114219114220114221114222114223114224114225114226114227114228114229114230114231114232114233114234114235114236114237114238114239114240114241114242114243114244114245114246114247114248114249114250114251114252114253114254114255114256114257114258114259114260114261114262114263114264114265114266114267114268114269114270114271114272114273114274114275114276114277114278114279114280114281114282114283114284114285114286114287114288114289114290114291114292114293114294114295114296114297114298114299114300114301114302114303114304114305114306114307114308114309114310114311114312114313114314114315114316114317114318114319114320114321114322114323114324114325114326114327114328114329114330114331114332114333114334114335114336114337114338114339114340114341114342114343114344114345114346114347114348114349114350114351114352114353114354114355114356114357114358114359114360114361114362114363114364114365114366114367114368114369114370114371114372114373114374114375114376114377114378114379114380114381114382114383114384114385114386114387114388114389114390114391114392114393114394114395114396114397114398114399114400114401114402114403114404114405114406114407114408114409114410114411114412114413114414114415114416114417114418114419114420114421114422114423114424114425114426114427114428114429114430114431114432114433114434114435114436114437114438114439114440114441114442114443114444114445114446114447114448114449114450114451114452114453114454114455114456114457114458114459114460114461114462114463114464114465114466114467114468114469114470114471114472114473114474114475114476114477114478114479114480114481114482114483114484114485114486114487114488114489114490114491114492114493114494114495114496114497114498114499114500114501114502114503114504114505114506114507114508114509114510114511114512114513114514114515114516114517114518114519114520114521114522114523114524114525114526114527114528114529114530114531114532114533114534114535114536114537114538114539114540114541114542114543114544114545114546114547114548114549114550114551114552114553114554114555114556114557114558114559114560114561114562114563114564114565114566114567114568114569114570114571114572114573114574114575114576114577114578114579114580114581114582114583114584114585114586114587114588114589114590114591114592114593114594114595114596114597114598114599114600114601114602114603114604114605114606114607114608114609114610114611114612114613114614114615114616114617114618114619114620114621114622114623114624114625114626114627114628114629114630114631114632114633114634114635114636114637114638114639114640114641114642114643114644114645114646114647114648114649114650114651114652114653114654114655114656114657114658114659114660114661114662114663114664114665114666114667114668114669114670114671114672114673114674114675114676114677114678114679114680114681114682114683114684114685114686114687114688114689114690114691114692114693114694114695114696114697114698114699114700114701114702114703114704114705114706114707114708114709114710114711114712114713114714114715114716114717114718114719114720114721114722114723114724114725114726114727114728114729114730114731114732114733114734114735114736114737114738114739114740114741114742114743114744114745114746114747114748114749114750114751114752114753114754114755114756114757114758114759114760114761114762114763114764114765114766114767114768114769114770114771114772114773114774114775114776114777114778114779114780114781114782114783114784114785114786114787114788114789114790114791114792114793114794114795114796114797114798114799114800114801114802114803114804114805114806114807114808114809114810114811114812114813114814114815114816114817114818114819114820114821114822114823114824114825114826114827114828114829114830114831114832114833114834114835114836114837114838114839114840114841114842114843114844114845114846114847114848114849114850114851114852114853114854114855114856114857114858114859114860114861114862114863114864114865114866114867114868114869114870114871114872114873114874114875114876114877114878114879114880114881114882114883114884114885114886114887114888114889114890114891114892114893114894114895114896114897114898114899114900114901114902114903114904114905114906114907114908114909114910114911114912114913114914114915114916114917114918114919114920114921114922114923114924114925114926114927114928114929114930114931114932114933114934114935114936114937114938114939114940114941114942114943114944114945114946114947114948114949114950114951114952114953114954114955114956114957114958114959114960114961114962114963114964114965114966114967114968114969114970114971114972114973114974114975114976114977114978114979114980114981114982114983114984114985114986114987114988114989114990114991114992114993114994114995114996114997114998114999115000115001115002115003115004115005115006115007115008115009115010115011115012115013115014115015115016115017115018115019115020115021115022115023115024115025115026115027115028115029115030115031115032115033115034115035115036115037115038115039115040115041115042115043115044115045115046115047115048115049115050115051115052115053115054115055115056115057115058115059115060115061115062115063115064115065115066115067115068115069115070115071115072115073115074115075115076115077115078115079115080115081115082115083115084115085115086115087115088115089115090115091115092115093115094115095115096115097115098115099115100115101115102115103115104115105115106115107115108115109115110115111115112115113115114115115115116115117115118115119115120115121115122115123115124115125115126115127115128115129115130115131115132115133115134115135115136115137115138115139115140115141115142115143115144115145115146115147115148115149115150115151115152115153115154115155115156115157115158115159115160115161115162115163115164115165115166115167115168115169115170115171115172115173115174115175115176115177115178115179115180115181115182115183115184115185115186115187115188115189115190115191115192115193115194115195115196115197115198115199115200115201115202115203115204115205115206115207115208115209115210115211115212115213115214115215115216115217115218115219115220115221115222115223115224115225115226115227115228115229115230115231115232115233115234115235115236115237115238115239115240115241115242115243115244115245115246115247115248115249115250115251115252115253115254115255115256115257115258115259115260115261115262115263115264115265115266115267115268115269115270115271115272115273115274115275115276115277115278115279115280115281115282115283115284115285115286115287115288115289115290115291115292115293115294115295115296115297115298115299115300115301115302115303115304115305115306115307115308115309115310115311115312115313115314115315115316115317115318115319115320115321115322115323115324115325115326115327115328115329115330115331115332115333115334115335115336115337115338115339115340115341115342115343115344115345115346115347115348115349115350115351115352115353115354115355115356115357115358115359115360115361115362115363115364115365115366115367115368115369115370115371115372115373115374115375115376115377115378115379115380115381115382115383115384115385115386115387115388115389115390115391115392115393115394115395115396115397115398115399115400115401115402115403115404115405115406115407115408115409115410115411115412115413115414115415115416115417115418115419115420115421115422115423115424115425115426115427115428115429115430115431115432115433115434115435115436115437115438115439115440115441115442115443115444115445115446115447115448115449115450115451115452115453115454115455115456115457115458115459115460115461115462115463115464115465115466115467115468115469115470115471115472115473115474115475115476115477115478115479115480115481115482115483115484115485115486115487115488115489115490115491115492115493115494115495115496115497115498115499115500115501115502115503115504115505115506115507115508115509115510115511115512115513115514115515115516115517115518115519115520115521115522115523115524115525115526115527115528115529115530115531115532115533115534115535115536115537115538115539115540115541115542115543115544115545115546115547115548115549115550115551115552115553115554115555115556115557115558115559115560115561115562115563115564115565115566115567115568115569115570115571115572115573115574115575115576115577115578115579115580115581115582115583115584115585115586115587115588115589115590115591115592115593115594115595115596115597115598115599115600115601115602115603115604115605115606115607115608115609115610115611115612115613115614115615115616115617115618115619115620115621115622115623115624115625115626115627115628115629115630115631115632115633115634115635115636115637115638115639115640115641115642115643115644115645115646115647115648115649115650115651115652115653115654115655115656115657115658115659115660115661115662115663115664115665115666115667115668115669115670115671115672115673115674115675115676115677115678115679115680115681115682115683115684115685115686115687115688115689115690115691115692115693115694115695115696115697115698115699115700115701115702115703115704115705115706115707115708115709115710115711115712115713115714115715115716115717115718115719115720115721115722115723115724115725115726115727115728115729115730115731115732115733115734115735115736115737115738115739115740115741115742115743115744115745115746115747115748115749115750115751115752115753115754115755115756115757115758115759115760115761115762115763115764115765115766115767115768115769115770115771115772115773115774115775115776115777115778115779115780115781115782115783115784115785115786115787115788115789115790115791115792115793115794115795115796115797115798115799115800115801115802115803115804115805115806115807115808115809115810115811115812115813115814115815115816115817115818115819115820115821115822115823115824115825115826115827115828115829115830115831115832115833115834115835115836115837115838115839115840115841115842115843115844115845115846115847115848115849115850115851115852115853115854115855115856115857115858115859115860115861115862115863115864115865115866115867115868115869115870115871115872115873115874115875115876115877115878115879115880115881115882115883115884115885115886115887115888115889115890115891115892115893115894115895115896115897115898115899115900115901115902115903115904115905115906115907115908115909115910115911115912115913115914115915115916115917115918115919115920115921115922115923115924115925115926115927115928115929115930115931115932115933115934115935115936115937115938115939115940115941115942115943115944115945115946115947115948115949115950115951115952115953115954115955115956115957115958115959115960115961115962115963115964115965115966115967115968115969115970115971115972115973115974115975115976115977115978115979115980115981115982115983115984115985115986115987115988115989115990115991115992115993115994115995115996115997115998115999116000116001116002116003116004116005116006116007116008116009116010116011116012116013116014116015116016116017116018116019116020116021116022116023116024116025116026116027116028116029116030116031116032116033116034116035116036116037116038116039116040116041116042116043116044116045116046116047116048116049116050116051116052116053116054116055116056116057116058116059116060116061116062116063116064116065116066116067116068116069116070116071116072116073116074116075116076116077116078116079116080116081116082116083116084116085116086116087116088116089116090116091116092116093116094116095116096116097116098116099116100116101116102116103116104116105116106116107116108116109116110116111116112116113116114116115116116116117116118116119116120116121116122116123116124116125116126116127116128116129116130116131116132116133116134116135116136116137116138116139116140116141116142116143116144116145116146116147116148116149116150116151116152116153116154116155116156116157116158116159116160116161116162116163116164116165116166116167116168116169116170116171116172116173116174116175116176116177116178116179116180116181116182116183116184116185116186116187116188116189116190116191116192116193116194116195116196116197116198116199116200116201116202116203116204116205116206116207116208116209116210116211116212116213116214116215116216116217116218116219116220116221116222116223116224116225116226116227116228116229116230116231116232116233116234116235116236116237116238116239116240116241116242116243116244116245116246116247116248116249116250116251116252116253116254116255116256116257116258116259116260116261116262116263116264116265116266116267116268116269116270116271116272116273116274116275116276116277116278116279116280116281116282116283116284116285116286116287116288116289116290116291116292116293116294116295116296116297116298116299116300116301116302116303116304116305116306116307116308116309116310116311116312116313116314116315116316116317116318116319116320116321116322116323116324116325116326116327116328116329116330116331116332116333116334116335116336116337116338116339116340116341116342116343116344116345116346116347116348116349116350116351116352116353116354116355116356116357116358116359116360116361116362116363116364116365116366116367116368116369116370116371116372116373116374116375116376116377116378116379116380116381116382116383116384116385116386116387116388116389116390116391116392116393116394116395116396116397116398116399116400116401116402116403116404116405116406116407116408116409116410116411116412116413116414116415116416116417116418116419116420116421116422116423116424116425116426116427116428116429116430116431116432116433116434116435116436116437116438116439116440116441116442116443116444116445116446116447116448116449116450116451116452116453116454116455116456116457116458116459116460116461116462116463116464116465116466116467116468116469116470116471116472116473116474116475116476116477116478116479116480116481116482116483116484116485116486116487116488116489116490116491116492116493116494116495116496116497116498116499116500116501116502116503116504116505116506116507116508116509116510116511116512116513116514116515116516116517116518116519116520116521116522116523116524116525116526116527116528116529116530116531116532116533116534116535116536116537116538116539116540116541116542116543116544116545116546116547116548116549116550116551116552116553116554116555116556116557116558116559116560116561116562116563116564116565116566116567116568116569116570116571116572116573116574116575116576116577116578116579116580116581116582116583116584116585116586116587116588116589116590116591116592116593116594116595116596116597116598116599116600116601116602116603116604116605116606116607116608116609116610116611116612116613116614116615116616116617116618116619116620116621116622116623116624116625116626116627116628116629116630116631116632116633116634116635116636116637116638116639116640116641116642116643116644116645116646116647116648116649116650116651116652116653116654116655116656116657116658116659116660116661116662116663116664116665116666116667116668116669116670116671116672116673116674116675116676116677116678116679116680116681116682116683116684116685116686116687116688116689116690116691116692116693116694116695116696116697116698116699116700116701116702116703116704116705116706116707116708116709116710116711116712116713116714116715116716116717116718116719116720116721116722116723116724116725116726116727116728116729116730116731116732116733116734116735116736116737116738116739116740116741116742116743116744116745116746116747116748116749116750116751116752116753116754116755116756116757116758116759116760116761116762116763116764116765116766116767116768116769116770116771116772116773116774116775116776116777116778116779116780116781116782116783116784116785116786116787116788116789116790116791116792116793116794116795116796116797116798116799116800116801116802116803116804116805116806116807116808116809116810116811116812116813116814116815116816116817116818116819116820116821116822116823116824116825116826116827116828116829116830116831116832116833116834116835116836116837116838116839116840116841116842116843116844116845116846116847116848116849116850116851116852116853116854116855116856116857116858116859116860116861116862116863116864116865116866116867116868116869116870116871116872116873116874116875116876116877116878116879116880116881116882116883116884116885116886116887116888116889116890116891116892116893116894116895116896116897116898116899116900116901116902116903116904116905116906116907116908116909116910116911116912116913116914116915116916116917116918116919116920116921116922116923116924116925116926116927116928116929116930116931116932116933116934116935116936116937116938116939116940116941116942116943116944116945116946116947116948116949116950116951116952116953116954116955116956116957116958116959116960116961116962116963116964116965116966116967116968116969116970116971116972116973116974116975116976116977116978116979116980116981116982116983116984116985116986116987116988116989116990116991116992116993116994116995116996116997116998116999117000117001117002117003117004117005117006117007117008117009117010117011117012117013117014117015117016117017117018117019117020117021117022117023117024117025117026117027117028117029117030117031117032117033117034117035117036117037117038117039117040117041117042117043117044117045117046117047117048117049117050117051117052117053117054117055117056117057117058117059117060117061117062117063117064117065117066117067117068117069117070117071117072117073117074117075117076117077117078117079117080117081117082117083117084117085117086117087117088117089117090117091117092117093117094117095117096117097117098117099117100117101117102117103117104117105117106117107117108117109117110117111117112117113117114117115117116117117117118117119117120117121117122117123117124117125117126117127117128117129117130117131117132117133117134117135117136117137117138117139117140117141117142117143117144117145117146117147117148117149117150117151117152117153117154117155117156117157117158117159117160117161117162117163117164117165117166117167117168117169117170117171117172117173117174117175117176117177117178117179117180117181117182117183117184117185117186117187117188117189117190117191117192117193117194117195117196117197117198117199117200117201117202117203117204117205117206117207117208117209117210117211117212117213117214117215117216117217117218117219117220117221117222117223117224117225117226117227117228117229117230117231117232117233117234117235117236117237117238117239117240117241117242117243117244117245117246117247117248117249117250117251117252117253117254117255117256117257117258117259117260117261117262117263117264117265117266117267117268117269117270117271117272117273117274117275117276117277117278117279117280117281117282117283117284117285117286117287117288117289117290117291117292117293117294117295117296117297117298117299117300117301117302117303117304117305117306117307117308117309117310117311117312117313117314117315117316117317117318117319117320117321117322117323117324117325117326117327117328117329117330117331117332117333117334117335117336117337117338117339117340117341117342117343117344117345117346117347117348117349117350117351117352117353117354117355117356117357117358117359117360117361117362117363117364117365117366117367117368117369117370117371117372117373117374117375117376117377117378117379117380117381117382117383117384117385117386117387117388117389117390117391117392117393117394117395117396117397117398117399117400117401117402117403117404117405117406117407117408117409117410117411117412117413117414117415117416117417117418117419117420117421117422117423117424117425117426117427117428117429117430117431117432117433117434117435117436117437117438117439117440117441117442117443117444117445117446117447117448117449117450117451117452117453117454117455117456117457117458117459117460117461117462117463117464117465117466117467117468117469117470117471117472117473117474117475117476117477117478117479117480117481117482117483117484117485117486117487117488117489117490117491117492117493117494117495117496117497117498117499117500117501117502117503117504117505117506117507117508117509117510117511117512117513117514117515117516117517117518117519117520117521117522117523117524117525117526117527117528117529117530117531117532117533117534117535117536117537117538117539117540117541117542117543117544117545117546117547117548117549117550117551117552117553117554117555117556117557117558117559117560117561117562117563117564117565117566117567117568117569117570117571117572117573117574117575117576117577117578117579117580117581117582117583117584117585117586117587117588117589117590117591117592117593117594117595117596117597117598117599117600117601117602117603117604117605117606117607117608117609117610117611117612117613117614117615117616117617117618117619117620117621117622117623117624117625117626117627117628117629117630117631117632117633117634117635117636117637117638117639117640117641117642117643117644117645117646117647117648117649117650117651117652117653117654117655117656117657117658117659117660117661117662117663117664117665117666117667117668117669117670117671117672117673117674117675117676117677117678117679117680117681117682117683117684117685117686117687117688117689117690117691117692117693117694117695117696117697117698117699117700117701117702117703117704117705117706117707117708117709117710117711117712117713117714117715117716117717117718117719117720117721117722117723117724117725117726117727117728117729117730117731117732117733117734117735117736117737117738117739117740117741117742117743117744117745117746117747117748117749117750117751117752117753117754117755117756117757117758117759117760117761117762117763117764117765117766117767117768117769117770117771117772117773117774117775117776117777117778117779117780117781117782117783117784117785117786117787117788117789117790117791117792117793117794117795117796117797117798117799117800117801117802117803117804117805117806117807117808117809117810117811117812117813117814117815117816117817117818117819117820117821117822117823117824117825117826117827117828117829117830117831117832117833117834117835117836117837117838117839117840117841117842117843117844117845117846117847117848117849117850117851117852117853117854117855117856117857117858117859117860117861117862117863117864117865117866117867117868117869117870117871117872117873117874117875117876117877117878117879117880117881117882117883117884117885117886117887117888117889117890117891117892117893117894117895117896117897117898117899117900117901117902117903117904117905117906117907117908117909117910117911117912117913117914117915117916117917117918117919117920117921117922117923117924117925117926117927117928117929117930117931117932117933117934117935117936117937117938117939117940117941117942117943117944117945117946117947117948117949117950117951117952117953117954117955117956117957117958117959117960117961117962117963117964117965117966117967117968117969117970117971117972117973117974117975117976117977117978117979117980117981117982117983117984117985117986117987117988117989117990117991117992117993117994117995117996117997117998117999118000118001118002118003118004118005118006118007118008118009118010118011118012118013118014118015118016118017118018118019118020118021118022118023118024118025118026118027118028118029118030118031118032118033118034118035118036118037118038118039118040118041118042118043118044118045118046118047118048118049118050118051118052118053118054118055118056118057118058118059118060118061118062118063118064118065118066118067118068118069118070118071118072118073118074118075118076118077118078118079118080118081118082118083118084118085118086118087118088118089118090118091118092118093118094118095118096118097118098118099118100118101118102118103118104118105118106118107118108118109118110118111118112118113118114118115118116118117118118118119118120118121118122118123118124118125118126118127118128118129118130118131118132118133118134118135118136118137118138118139118140118141118142118143118144118145118146118147118148118149118150118151118152118153118154118155118156118157118158118159118160118161118162118163118164118165118166118167118168118169118170118171118172118173118174118175118176118177118178118179118180118181118182118183118184118185118186118187118188118189118190118191118192118193118194118195118196118197118198118199118200118201118202118203118204118205118206118207118208118209118210118211118212118213118214118215118216118217118218118219118220118221118222118223118224118225118226118227118228118229118230118231118232118233118234118235118236118237118238118239118240118241118242118243118244118245118246118247118248118249118250118251118252118253118254118255118256118257118258118259118260118261118262118263118264118265118266118267118268118269118270118271118272118273118274118275118276118277118278118279118280118281118282118283118284118285118286118287118288118289118290118291118292118293118294118295118296118297118298118299118300118301118302118303118304118305118306118307118308118309118310118311118312118313118314118315118316118317118318118319118320118321118322118323118324118325118326118327118328118329118330118331118332118333118334118335118336118337118338118339118340118341118342118343118344118345118346118347118348118349118350118351118352118353118354118355118356118357118358118359118360118361118362118363118364118365118366118367118368118369118370118371118372118373118374118375118376118377118378118379118380118381118382118383118384118385118386118387118388118389118390118391118392118393118394118395118396118397118398118399118400118401118402118403118404118405118406118407118408118409118410118411118412118413118414118415118416118417118418118419118420118421118422118423118424118425118426118427118428118429118430118431118432118433118434118435118436118437118438118439118440118441118442118443118444118445118446118447118448118449118450118451118452118453118454118455118456118457118458118459118460118461118462118463118464118465118466118467118468118469118470118471118472118473118474118475118476118477118478118479118480118481118482118483118484118485118486118487118488118489118490118491118492118493118494118495118496118497118498118499118500118501118502118503118504118505118506118507118508118509118510118511118512118513118514118515118516118517118518118519118520118521118522118523118524118525118526118527118528118529118530118531118532118533118534118535118536118537118538118539118540118541118542118543118544118545118546118547118548118549118550118551118552118553118554118555118556118557118558118559118560118561118562118563118564118565118566118567118568118569118570118571118572118573118574118575118576118577118578118579118580118581118582118583118584118585118586118587118588118589118590118591118592118593118594118595118596118597118598118599118600118601118602118603118604118605118606118607118608118609118610118611118612118613118614118615118616118617118618118619118620118621118622118623118624118625118626118627118628118629118630118631118632118633118634118635118636118637118638118639118640118641118642118643118644118645118646118647118648118649118650118651118652118653118654118655118656118657118658118659118660118661118662118663118664118665118666118667118668118669118670118671118672118673118674118675118676118677118678118679118680118681118682118683118684118685118686118687118688118689118690118691118692118693118694118695118696118697118698118699118700118701118702118703118704118705118706118707118708118709118710118711118712118713118714118715118716118717118718118719118720118721118722118723118724118725118726118727118728118729118730118731118732118733118734118735118736118737118738118739118740118741118742118743118744118745118746118747118748118749118750118751118752118753118754118755118756118757118758118759118760118761118762118763118764118765118766118767118768118769118770118771118772118773118774118775118776118777118778118779118780118781118782118783118784118785118786118787118788118789118790118791118792118793118794118795118796118797118798118799118800118801118802118803118804118805118806118807118808118809118810118811118812118813118814118815118816118817118818118819118820118821118822118823118824118825118826118827118828118829118830118831118832118833118834118835118836118837118838118839118840118841118842118843118844118845118846118847118848118849118850118851118852118853118854118855118856118857118858118859118860118861118862118863118864118865118866118867118868118869118870118871118872118873118874118875118876118877118878118879118880118881118882118883118884118885118886118887118888118889118890118891118892118893118894118895118896118897118898118899118900118901118902118903118904118905118906118907118908118909118910118911118912118913118914118915118916118917118918118919118920118921118922118923118924118925118926118927118928118929118930118931118932118933118934118935118936118937118938118939118940118941118942118943118944118945118946118947118948118949118950118951118952118953118954118955118956118957118958118959118960118961118962118963118964118965118966118967118968118969118970118971118972118973118974118975118976118977118978118979118980118981118982118983118984118985118986118987118988118989118990118991118992118993118994118995118996118997118998118999119000119001119002119003119004119005119006119007119008119009119010119011119012119013119014119015119016119017119018119019119020119021119022119023119024119025119026119027119028119029119030119031119032119033119034119035119036119037119038119039119040119041119042119043119044119045119046119047119048119049119050119051119052119053119054119055119056119057119058119059119060119061119062119063119064119065119066119067119068119069119070119071119072119073119074119075119076119077119078119079119080119081119082119083119084119085119086119087119088119089119090119091119092119093119094119095119096119097119098119099119100119101119102119103119104119105119106119107119108119109119110119111119112119113119114119115119116119117119118119119119120119121119122119123119124119125119126119127119128119129119130119131119132119133119134119135119136119137119138119139119140119141119142119143119144119145119146119147119148119149119150119151119152119153119154119155119156119157119158119159119160119161119162119163119164119165119166119167119168119169119170119171119172119173119174119175119176119177119178119179119180119181119182119183119184119185119186119187119188119189119190119191119192119193119194119195119196119197119198119199119200119201119202119203119204119205119206119207119208119209119210119211119212119213119214119215119216119217119218119219119220119221119222119223119224119225119226119227119228119229119230119231119232119233119234119235119236119237119238119239119240119241119242119243119244119245119246119247119248119249119250119251119252119253119254119255119256119257119258119259119260119261119262119263119264119265119266119267119268119269119270119271119272119273119274119275119276119277119278119279119280119281119282119283119284119285119286119287119288119289119290119291119292119293119294119295119296119297119298119299119300119301119302119303119304119305119306119307119308119309119310119311119312119313119314119315119316119317119318119319119320119321119322119323119324119325119326119327119328119329119330119331119332119333119334119335119336119337119338119339119340119341119342119343119344119345119346119347119348119349119350119351119352119353119354119355119356119357119358119359119360119361119362119363119364119365119366119367119368119369119370119371119372119373119374119375119376119377119378119379119380119381119382119383119384119385119386119387119388119389119390119391119392119393119394119395119396119397119398119399119400119401119402119403119404119405119406119407119408119409119410119411119412119413119414119415119416119417119418119419119420119421119422119423119424119425119426119427119428119429119430119431119432119433119434119435119436119437119438119439119440119441119442119443119444119445119446119447119448119449119450119451119452119453119454119455119456119457119458119459119460119461119462119463119464119465119466119467119468119469119470119471119472119473119474119475119476119477119478119479119480119481119482119483119484119485119486119487119488119489119490119491119492119493119494119495119496119497119498119499119500119501119502119503119504119505119506119507119508119509119510119511119512119513119514119515119516119517119518119519119520119521119522119523119524119525119526119527119528119529119530119531119532119533119534119535119536119537119538119539119540119541119542119543119544119545119546119547119548119549119550119551119552119553119554119555119556119557119558119559119560119561119562119563119564119565119566119567119568119569119570119571119572119573119574119575119576119577119578119579119580119581119582119583119584119585119586119587119588119589119590119591119592119593119594119595119596119597119598119599119600119601119602119603119604119605119606119607119608119609119610119611119612119613119614119615119616119617119618119619119620119621119622119623119624119625119626119627119628119629119630119631119632119633119634119635119636119637119638119639119640119641119642119643119644119645119646119647119648119649119650119651119652119653119654119655119656119657119658119659119660119661119662119663119664119665119666119667119668119669119670119671119672119673119674119675119676119677119678119679119680119681119682119683119684119685119686119687119688119689119690119691119692119693119694119695119696119697119698119699119700119701119702119703119704119705119706119707119708119709119710119711119712119713119714119715119716119717119718119719119720119721119722119723119724119725119726119727119728119729119730119731119732119733119734119735119736119737119738119739119740119741119742119743119744119745119746119747119748119749119750119751119752119753119754119755119756119757119758119759119760119761119762119763119764119765119766119767119768119769119770119771119772119773119774119775119776119777119778119779119780119781119782119783119784119785119786119787119788119789119790119791119792119793119794119795119796119797119798119799119800119801119802119803119804119805119806119807119808119809119810119811119812119813119814119815119816119817119818119819119820119821119822119823119824119825119826119827119828119829119830119831119832119833119834119835119836119837119838119839119840119841119842119843119844119845119846119847119848119849119850119851119852119853119854119855119856119857119858119859119860119861119862119863119864119865119866119867119868119869119870119871119872119873119874119875119876119877119878119879119880119881119882119883119884119885119886119887119888119889119890119891119892119893119894119895119896119897119898119899119900119901119902119903119904119905119906119907119908119909119910119911119912119913119914119915119916119917119918119919119920119921119922119923119924119925119926119927119928119929119930119931119932119933119934119935119936119937119938119939119940119941119942119943119944119945119946119947119948119949119950119951119952119953119954119955119956119957119958119959119960119961119962119963119964119965119966119967119968119969119970119971119972119973119974119975119976119977119978119979119980119981119982119983119984119985119986119987119988119989119990119991119992119993119994119995119996119997119998119999120000120001120002120003120004120005120006120007120008120009120010120011120012120013120014120015120016120017120018120019120020120021120022120023120024120025120026120027120028120029120030120031120032120033120034120035120036120037120038120039120040120041120042120043120044120045120046120047120048120049120050120051120052120053120054120055120056120057120058120059120060120061120062120063120064120065120066120067120068120069120070120071120072120073120074120075120076120077120078120079120080120081120082120083120084120085120086120087120088120089120090120091120092120093120094120095120096120097120098120099120100120101120102120103120104120105120106120107120108120109120110120111120112120113120114120115120116120117120118120119120120120121120122120123120124120125120126120127120128120129120130120131120132120133120134120135120136120137120138120139120140120141120142120143120144120145120146120147120148120149120150120151120152120153120154120155120156120157120158120159120160120161120162120163120164120165120166120167120168120169120170120171120172120173120174120175120176120177120178120179120180120181120182120183120184120185120186120187120188120189120190120191120192120193120194120195120196120197120198120199120200120201120202120203120204120205120206120207120208120209120210120211120212120213120214120215120216120217120218120219120220120221120222120223120224120225120226120227120228120229120230120231120232120233120234120235120236120237120238120239120240120241120242120243120244120245120246120247120248120249120250120251120252120253120254120255120256120257120258120259120260120261120262120263120264120265120266120267120268120269120270120271120272120273120274120275120276120277120278120279120280120281120282120283120284120285120286120287120288120289120290120291120292120293120294120295120296120297120298120299120300120301120302120303120304120305120306120307120308120309120310120311120312120313120314120315120316120317120318120319120320120321120322120323120324120325120326120327120328120329120330120331120332120333120334120335120336120337120338120339120340120341120342120343120344120345120346120347120348120349120350120351120352120353120354120355120356120357120358120359120360120361120362120363120364120365120366120367120368120369120370120371120372120373120374120375120376120377120378120379120380120381120382120383120384120385120386120387120388120389120390120391120392120393120394120395120396120397120398120399120400120401120402120403120404120405120406120407120408120409120410120411120412120413120414120415120416120417120418120419120420120421120422120423120424120425120426120427120428120429120430120431120432120433120434120435120436120437120438120439120440120441120442120443120444120445120446120447120448120449120450120451120452120453120454120455120456120457120458120459120460120461120462120463120464120465120466120467120468120469120470120471120472120473120474120475120476120477120478120479120480120481120482120483120484120485120486120487120488120489120490120491120492120493120494120495120496120497120498120499120500120501120502120503120504120505120506120507120508120509120510120511120512120513120514120515120516120517120518120519120520120521120522120523120524120525120526120527120528120529120530120531120532120533120534120535120536120537120538120539120540120541120542120543120544120545120546120547120548120549120550120551120552120553120554120555120556120557120558120559120560120561120562120563120564120565120566120567120568120569120570120571120572120573120574120575120576120577120578120579120580120581120582120583120584120585120586120587120588120589120590120591120592120593120594120595120596120597120598120599120600120601120602120603120604120605120606120607120608120609120610120611120612120613120614120615120616120617120618120619120620120621120622120623120624120625120626120627120628120629120630120631120632120633120634120635120636120637120638120639120640120641120642120643120644120645120646120647120648120649120650120651120652120653120654120655120656120657120658120659120660120661120662120663120664120665120666120667120668120669120670120671120672120673120674120675120676120677120678120679120680120681120682120683120684120685120686120687120688120689120690120691120692120693120694120695120696120697120698120699120700120701120702120703120704120705120706120707120708120709120710120711120712120713120714120715120716120717120718120719120720120721120722120723120724120725120726120727120728120729120730120731120732120733120734120735120736120737120738120739120740120741120742120743120744120745120746120747120748120749120750120751120752120753120754120755120756120757120758120759120760120761120762120763120764120765120766120767120768120769120770120771120772120773120774120775120776120777120778120779120780120781120782120783120784120785120786120787120788120789120790120791120792120793120794120795120796120797120798120799120800120801120802120803120804120805120806120807120808120809120810120811120812120813120814120815120816120817120818120819120820120821120822120823120824120825120826120827120828120829120830120831120832120833120834120835120836120837120838120839120840120841120842120843120844120845120846120847120848120849120850120851120852120853120854120855120856120857120858120859120860120861120862120863120864120865120866120867120868120869120870120871120872120873120874120875120876120877120878120879120880120881120882120883120884120885120886120887120888120889120890120891120892120893120894120895120896120897120898120899120900120901120902120903120904120905120906120907120908120909120910120911120912120913120914120915120916120917120918120919120920120921120922120923120924120925120926120927120928120929120930120931120932120933120934120935120936120937120938120939120940120941120942120943120944120945120946120947120948120949120950120951120952120953120954120955120956120957120958120959120960120961120962120963120964120965120966120967120968120969120970120971120972120973120974120975120976120977120978120979120980120981120982120983120984120985120986120987120988120989120990120991120992120993120994120995120996120997120998120999121000121001121002121003121004121005121006121007121008121009121010121011121012121013121014121015121016121017121018121019121020121021121022121023121024121025121026121027121028121029121030121031121032121033121034121035121036121037121038121039121040121041121042121043121044121045121046121047121048121049121050121051121052121053121054121055121056121057121058121059121060121061121062121063121064121065121066121067121068121069121070121071121072121073121074121075121076121077121078121079121080121081121082121083121084121085121086121087121088121089121090121091121092121093121094121095121096121097121098121099121100121101121102121103121104121105121106121107121108121109121110121111121112121113121114121115121116121117121118121119121120121121121122121123121124121125121126121127121128121129121130121131121132121133121134121135121136121137121138121139121140121141121142121143121144121145121146121147121148121149121150121151121152121153121154121155121156121157121158121159121160121161121162121163121164121165121166121167121168121169121170121171121172121173121174121175121176121177121178121179121180121181121182121183121184121185121186121187121188121189121190121191121192121193121194121195121196121197121198121199121200121201121202121203121204121205121206121207121208121209121210121211121212121213121214121215121216121217121218121219121220121221121222121223121224121225121226121227121228121229121230121231121232121233121234121235121236121237121238121239121240121241121242121243121244121245121246121247121248121249121250121251121252121253121254121255121256121257121258121259121260121261121262121263121264121265121266121267121268121269121270121271121272121273121274121275121276121277121278121279121280121281121282121283121284121285121286121287121288121289121290121291121292121293121294121295121296121297121298121299121300121301121302121303121304121305121306121307121308121309121310121311121312121313121314121315121316121317121318121319121320121321121322121323121324121325121326121327121328121329121330121331121332121333121334121335121336121337121338121339121340121341121342121343121344121345121346121347121348121349121350121351121352121353121354121355121356121357121358121359121360121361121362121363121364121365121366121367121368121369121370121371121372121373121374121375121376121377121378121379121380121381121382121383121384121385121386121387121388121389121390121391121392121393121394121395121396121397121398121399121400121401121402121403121404121405121406121407121408121409121410121411121412121413121414121415121416121417121418121419121420121421121422121423121424121425121426121427121428121429121430121431121432121433121434121435121436121437121438121439121440121441121442121443121444121445121446121447121448121449121450121451121452121453121454121455121456121457121458121459121460121461121462121463121464121465121466121467121468121469121470121471121472121473121474121475121476121477121478121479121480121481121482121483121484121485121486121487121488121489121490121491121492121493121494121495121496121497121498121499121500121501121502121503121504121505121506121507121508121509121510121511121512121513121514121515121516121517121518121519121520121521121522121523121524121525121526121527121528121529121530121531121532121533121534121535121536121537121538121539121540121541121542121543121544121545121546121547121548121549121550121551121552121553121554121555121556121557121558121559121560121561121562121563121564121565121566121567121568121569121570121571121572121573121574121575121576121577121578121579121580121581121582121583121584121585121586121587121588121589121590121591121592121593121594121595121596121597121598121599121600121601121602121603121604121605121606121607121608121609121610121611121612121613121614121615121616121617121618121619121620121621121622121623121624121625121626121627121628121629121630121631121632121633121634121635121636121637121638121639121640121641121642121643121644121645121646121647121648121649121650121651121652121653121654121655121656121657121658121659121660121661121662121663121664121665121666121667121668121669121670121671121672121673121674121675121676121677121678121679121680121681121682121683121684121685121686121687121688121689121690121691121692121693121694121695121696121697121698121699121700121701121702121703121704121705121706121707121708121709121710121711121712121713121714121715121716121717121718121719121720121721121722121723121724121725121726121727121728121729121730121731121732121733121734121735121736121737121738121739121740121741121742121743121744121745121746121747121748121749121750121751121752121753121754121755121756121757121758121759121760121761121762121763121764121765121766121767121768121769121770121771121772121773121774121775121776121777121778121779121780121781121782121783121784121785121786121787121788121789121790121791121792121793121794121795121796121797121798121799121800121801121802121803121804121805121806121807121808121809121810121811121812121813121814121815121816121817121818121819121820121821121822121823121824121825121826121827121828121829121830121831121832121833121834121835121836121837121838121839121840121841121842121843121844121845121846121847121848121849121850121851121852121853121854121855121856121857121858121859121860121861121862121863121864121865121866121867121868121869121870121871121872121873121874121875121876121877121878121879121880121881121882121883121884121885121886121887121888121889121890121891121892121893121894121895121896121897121898121899121900121901121902121903121904121905121906121907121908121909121910121911121912121913121914121915121916121917121918121919121920121921121922121923121924121925121926121927121928121929121930121931121932121933121934121935121936121937121938121939121940121941121942121943121944121945121946121947121948121949121950121951121952121953121954121955121956121957121958121959121960121961121962121963121964121965121966121967121968121969121970121971121972121973121974121975121976121977121978121979121980121981121982121983121984121985121986121987121988121989121990121991121992121993121994121995121996121997121998121999122000122001122002122003122004122005122006122007122008122009122010122011122012122013122014122015122016122017122018122019122020122021122022122023122024122025122026122027122028122029122030122031122032122033122034122035122036122037122038122039122040122041122042122043122044122045122046122047122048122049122050122051122052122053122054122055122056122057122058122059122060122061122062122063122064122065122066122067122068122069122070122071122072122073122074122075122076122077122078122079122080122081122082122083122084122085122086122087122088122089122090122091122092122093122094122095122096122097122098122099122100122101122102122103122104122105122106122107122108122109122110122111122112122113122114122115122116122117122118122119122120122121122122122123122124122125122126122127122128122129122130122131122132122133122134122135122136122137122138122139122140122141122142122143122144122145122146122147122148122149122150122151122152122153122154122155122156122157122158122159122160122161122162122163122164122165122166122167122168122169122170122171122172122173122174122175122176122177122178122179122180122181122182122183122184122185122186122187122188122189122190122191122192122193122194122195122196122197122198122199122200122201122202122203122204122205122206122207122208122209122210122211122212122213122214122215122216122217122218122219122220122221122222122223122224122225122226122227122228122229122230122231122232122233122234122235122236122237122238122239122240122241122242122243122244122245122246122247122248122249122250122251122252122253122254122255122256122257122258122259122260122261122262122263122264122265122266122267122268122269122270122271122272122273122274122275122276122277122278122279122280122281122282122283122284122285122286122287122288122289122290122291122292122293122294122295122296122297122298122299122300122301122302122303122304122305122306122307122308122309122310122311122312122313122314122315122316122317122318122319122320122321122322122323122324122325122326122327122328122329122330122331122332122333122334122335122336122337122338122339122340122341122342122343122344122345122346122347122348122349122350122351122352122353122354122355122356122357122358122359122360122361122362122363122364122365122366122367122368122369122370122371122372122373122374122375122376122377122378122379122380122381122382122383122384122385122386122387122388122389122390122391122392122393122394122395122396122397122398122399122400122401122402122403122404122405122406122407122408122409122410122411122412122413122414122415122416122417122418122419122420122421122422122423122424122425122426122427122428122429122430122431122432122433122434122435122436122437122438122439122440122441122442122443122444122445122446122447122448122449122450122451122452122453122454122455122456122457122458122459122460122461122462122463122464122465122466122467122468122469122470122471122472122473122474122475122476122477122478122479122480122481122482122483122484122485122486122487122488122489122490122491122492122493122494122495122496122497122498122499122500122501122502122503122504122505122506122507122508122509122510122511122512122513122514122515122516122517122518122519122520122521122522122523122524122525122526122527122528122529122530122531122532122533122534122535122536122537122538122539122540122541122542122543122544122545122546122547122548122549122550122551122552122553122554122555122556122557122558122559122560122561122562122563122564122565122566122567122568122569122570122571122572122573122574122575122576122577122578122579122580122581122582122583122584122585122586122587122588122589122590122591122592122593122594122595122596122597122598122599122600122601122602122603122604122605122606122607122608122609122610122611122612122613122614122615122616122617122618122619122620122621122622122623122624122625122626122627122628122629122630122631122632122633122634122635122636122637122638122639122640122641122642122643122644122645122646122647122648122649122650122651122652122653122654122655122656122657122658122659122660122661122662122663122664122665122666122667122668122669122670122671122672122673122674122675122676122677122678122679122680122681122682122683122684122685122686122687122688122689122690122691122692122693122694122695122696122697122698122699122700122701122702122703122704122705122706122707122708122709122710122711122712122713122714122715122716122717122718122719122720122721122722122723122724122725122726122727122728122729122730122731122732122733122734122735122736122737122738122739122740122741122742122743122744122745122746122747122748122749122750122751122752122753122754122755122756122757122758122759122760122761122762122763122764122765122766122767122768122769122770122771122772122773122774122775122776122777122778122779122780122781122782122783122784122785122786122787122788122789122790122791122792122793122794122795122796122797122798122799122800122801122802122803122804122805122806122807122808122809122810122811122812122813122814122815122816122817122818122819122820122821122822122823122824122825122826122827122828122829122830122831122832122833122834122835122836122837122838122839122840122841122842122843122844122845122846122847122848122849122850122851122852122853122854122855122856122857122858122859122860122861122862122863122864122865122866122867122868122869122870122871122872122873122874122875122876122877122878122879122880122881122882122883122884122885122886122887122888122889122890122891122892122893122894122895122896122897122898122899122900122901122902122903122904122905122906122907122908122909122910122911122912122913122914122915122916122917122918122919122920122921122922122923122924122925122926122927122928122929122930122931122932122933122934122935122936122937122938122939122940122941122942122943122944122945122946122947122948122949122950122951122952122953122954122955122956122957122958122959122960122961122962122963122964122965122966122967122968122969122970122971122972122973122974122975122976122977122978122979122980122981122982122983122984122985122986122987122988122989122990122991122992122993122994122995122996122997122998122999123000123001123002123003123004123005123006123007123008123009123010123011123012123013123014123015123016123017123018123019123020123021123022123023123024123025123026123027123028123029123030123031123032123033123034123035123036123037123038123039123040123041123042123043123044123045123046123047123048123049123050123051123052123053123054123055123056123057123058123059123060123061123062123063123064123065123066123067123068123069123070123071123072123073123074123075123076123077123078123079123080123081123082123083123084123085123086123087123088123089123090123091123092123093123094123095123096123097123098123099123100123101123102123103123104123105123106123107123108123109123110123111123112123113123114123115123116123117123118123119123120123121123122123123123124123125123126123127123128123129123130123131123132123133123134123135123136123137123138123139123140123141123142123143123144123145123146123147123148123149123150123151123152123153123154123155123156123157123158123159123160123161123162123163123164123165123166123167123168123169123170123171123172123173123174123175123176123177123178123179123180123181123182123183123184123185123186123187123188123189123190123191123192123193123194123195123196123197123198123199123200123201123202123203123204123205123206123207123208123209123210123211123212123213123214123215123216123217123218123219123220123221123222123223123224123225123226123227123228123229123230123231123232123233123234123235123236123237123238123239123240123241123242123243123244123245123246123247123248123249123250123251123252123253123254123255123256123257123258123259123260123261123262123263123264123265123266123267123268123269123270123271123272123273123274123275123276123277123278123279123280123281123282123283123284123285123286123287123288123289123290123291123292123293123294123295123296123297123298123299123300123301123302123303123304123305123306123307123308123309123310123311123312123313123314123315123316123317123318123319123320123321123322123323123324123325123326123327123328123329123330123331123332123333123334123335123336123337123338123339123340123341123342123343123344123345123346123347123348123349123350123351123352123353123354123355123356123357123358123359123360123361123362123363123364123365123366123367123368123369123370123371123372123373123374123375123376123377123378123379123380123381123382123383123384123385123386123387123388123389123390123391123392123393123394123395123396123397123398123399123400123401123402123403123404123405123406123407123408123409123410123411123412123413123414123415123416123417123418123419123420123421123422123423123424123425123426123427123428123429123430123431123432123433123434123435123436123437123438123439123440123441123442123443123444123445123446123447123448123449123450123451123452123453123454123455123456123457123458123459123460123461123462123463123464123465123466123467123468123469123470123471123472123473123474123475123476123477123478123479123480123481123482123483123484123485123486123487123488123489123490123491123492123493123494123495123496123497123498123499123500123501123502123503123504123505123506123507123508123509123510123511123512123513123514123515123516123517123518123519123520123521123522123523123524123525123526123527123528123529123530123531123532123533123534123535123536123537123538123539123540123541123542123543123544123545123546123547123548123549123550123551123552123553123554123555123556123557123558123559123560123561123562123563123564123565123566123567123568123569123570123571123572123573123574123575123576123577123578123579123580123581123582123583123584123585123586123587123588123589123590123591123592123593123594123595123596123597123598123599123600123601123602123603123604123605123606123607123608123609123610123611123612123613123614123615123616123617123618123619123620123621123622123623123624123625123626123627123628123629123630123631123632123633123634123635123636123637123638123639123640123641123642123643123644123645123646123647123648123649123650123651123652123653123654123655123656123657123658123659123660123661123662123663123664123665123666123667123668123669123670123671123672123673123674123675123676123677123678123679123680123681123682123683123684123685123686123687123688123689123690123691123692123693123694123695123696123697123698123699123700123701123702123703123704123705123706123707123708123709123710123711123712123713123714123715123716123717123718123719123720123721123722123723123724123725123726123727123728123729123730123731123732123733123734123735123736123737123738123739123740123741123742123743123744123745123746123747123748123749123750123751123752123753123754123755123756123757123758123759123760123761123762123763123764123765123766123767123768123769123770123771123772123773123774123775123776123777123778123779123780123781123782123783123784123785123786123787123788123789123790123791123792123793123794123795123796123797123798123799123800123801123802123803123804123805123806123807123808123809123810123811123812123813123814123815123816123817123818123819123820123821123822123823123824123825123826123827123828123829123830123831123832123833123834123835123836123837123838123839123840123841123842123843123844123845123846123847123848123849123850123851123852123853123854123855123856123857123858123859123860123861123862123863123864123865123866123867123868123869123870123871123872123873123874123875123876123877123878123879123880123881123882123883123884123885123886123887123888123889123890123891123892123893123894123895123896123897123898123899123900123901123902123903123904123905123906123907123908123909123910123911123912123913123914123915123916123917123918123919123920123921123922123923123924123925123926123927123928123929123930123931123932123933123934123935123936123937123938123939123940123941123942123943123944123945123946123947123948123949123950123951123952123953123954123955123956123957123958123959123960123961123962123963123964123965123966123967123968123969123970123971123972123973123974123975123976123977123978123979123980123981123982123983123984123985123986123987123988123989123990123991123992123993123994123995123996123997123998123999124000124001124002124003124004124005124006124007124008124009124010124011124012124013124014124015124016124017124018124019124020124021124022124023124024124025124026124027124028124029124030124031124032124033124034124035124036124037124038124039124040124041124042124043124044124045124046124047124048124049124050124051124052124053124054124055124056124057124058124059124060124061124062124063124064124065124066124067124068124069124070124071124072124073124074124075124076124077124078124079124080124081124082124083124084124085124086124087124088124089124090124091124092124093124094124095124096124097124098124099124100124101124102124103124104124105124106124107124108124109124110124111124112124113124114124115124116124117124118124119124120124121124122124123124124124125124126124127124128124129124130124131124132124133124134124135124136124137124138124139124140124141124142124143124144124145124146124147124148124149124150124151124152124153124154124155124156124157124158124159124160124161124162124163124164124165124166124167124168124169124170124171124172124173124174124175124176124177124178124179124180124181124182124183124184124185124186124187124188124189124190124191124192124193124194124195124196124197124198124199124200124201124202124203124204124205124206124207124208124209124210124211124212124213124214124215124216124217124218124219124220124221124222124223124224124225124226124227124228124229124230124231124232124233124234124235124236124237124238124239124240124241124242124243124244124245124246124247124248124249124250124251124252124253124254124255124256124257124258124259124260124261124262124263124264124265124266124267124268124269124270124271124272124273124274124275124276124277124278124279124280124281124282124283124284124285124286124287124288124289124290124291124292124293124294124295124296124297124298124299124300124301124302124303124304124305124306124307124308124309124310124311124312124313124314124315124316124317124318124319124320124321124322124323124324124325124326124327124328124329124330124331124332124333124334124335124336124337124338124339124340124341124342124343124344124345124346124347124348124349124350124351124352124353124354124355124356124357124358124359124360124361124362124363124364124365124366124367124368124369124370124371124372124373124374124375124376124377124378124379124380124381124382124383124384124385124386124387124388124389124390124391124392124393124394124395124396124397124398124399124400124401124402124403124404124405124406124407124408124409124410124411124412124413124414124415124416124417124418124419124420124421124422124423124424124425124426124427124428124429124430124431124432124433124434124435124436124437124438124439124440124441124442124443124444124445124446124447124448124449124450124451124452124453124454124455124456124457124458124459124460124461124462124463124464124465124466124467124468124469124470124471124472124473124474124475124476124477124478124479124480124481124482124483124484124485124486124487124488124489124490124491124492124493124494124495124496124497124498124499124500124501124502124503124504124505124506124507124508124509124510124511124512124513124514124515124516124517124518124519124520124521124522124523124524124525124526124527124528124529124530124531124532124533124534124535124536124537124538124539124540124541124542124543124544124545124546124547124548124549124550124551124552124553124554124555124556124557124558124559124560124561124562124563124564124565124566124567124568124569124570124571124572124573124574124575124576124577124578124579124580124581124582124583124584124585124586124587124588124589124590124591124592124593124594124595124596124597124598124599124600124601124602124603124604124605124606124607124608124609124610124611124612124613124614124615124616124617124618124619124620124621124622124623124624124625124626124627124628124629124630124631124632124633124634124635124636124637124638124639124640124641124642124643124644124645124646124647124648124649124650124651124652124653124654124655124656124657124658124659124660124661124662124663124664124665124666124667124668124669124670124671124672124673124674124675124676124677124678124679124680124681124682124683124684124685124686124687124688124689124690124691124692124693124694124695124696124697124698124699124700124701124702124703124704124705124706124707124708124709124710124711124712124713124714124715124716124717124718124719124720124721124722124723124724124725124726124727124728124729124730124731124732124733124734124735124736124737124738124739124740124741124742124743124744124745124746124747124748124749124750124751124752124753124754124755124756124757124758124759124760124761124762124763124764124765124766124767124768124769124770124771124772124773124774124775124776124777124778124779124780124781124782124783124784124785124786124787124788124789124790124791124792124793124794124795124796124797124798124799124800124801124802124803124804124805124806124807124808124809124810124811124812124813124814124815124816124817124818124819124820124821124822124823124824124825124826124827124828124829124830124831124832124833124834124835124836124837124838124839124840124841124842124843124844124845124846124847124848124849124850124851124852124853124854124855124856124857124858124859124860124861124862124863124864124865124866124867124868124869124870124871124872124873124874124875124876124877124878124879124880124881124882124883124884124885124886124887124888124889124890124891124892124893124894124895124896124897124898124899124900124901124902124903124904124905124906124907124908124909124910124911124912124913124914124915124916124917124918124919124920124921124922124923124924124925124926124927124928124929124930124931124932124933124934124935124936124937124938124939124940124941124942124943124944124945124946124947124948124949124950124951124952124953124954124955124956124957124958124959124960124961124962124963124964124965124966124967124968124969124970124971124972124973124974124975124976124977124978124979124980124981124982124983124984124985124986124987124988124989124990124991124992124993124994124995124996124997124998124999125000125001125002125003125004125005125006125007125008125009125010125011125012125013125014125015125016125017125018125019125020125021125022125023125024125025125026125027125028125029125030125031125032125033125034125035125036125037125038125039125040125041125042125043125044125045125046125047125048125049125050125051125052125053125054125055125056125057125058125059125060125061125062125063125064125065125066125067125068125069125070125071125072125073125074125075125076125077125078125079125080125081125082125083125084125085125086125087125088125089125090125091125092125093125094125095125096125097125098125099125100125101125102125103125104125105125106125107125108125109125110125111125112125113125114125115125116125117125118125119125120125121125122125123125124125125125126125127125128125129125130125131125132125133125134125135125136125137125138125139125140125141125142125143125144125145125146125147125148125149125150125151125152125153125154125155125156125157125158125159125160125161125162125163125164125165125166125167125168125169125170125171125172125173125174125175125176125177125178125179125180125181125182125183125184125185125186125187125188125189125190125191125192125193125194125195125196125197125198125199125200125201125202125203125204125205125206125207125208125209125210125211125212125213125214125215125216125217125218125219125220125221125222125223125224125225125226125227125228125229125230125231125232125233125234125235125236125237125238125239125240125241125242125243125244125245125246125247125248125249125250125251125252125253125254125255125256125257125258125259125260125261125262125263125264125265125266125267125268125269125270125271125272125273125274125275125276125277125278125279125280125281125282125283125284125285125286125287125288125289125290125291125292125293125294125295125296125297125298125299125300125301125302125303125304125305125306125307125308125309125310125311125312125313125314125315125316125317125318125319125320125321125322125323125324125325125326125327125328125329125330125331125332125333125334125335125336125337125338125339125340125341125342125343125344125345125346125347125348125349125350125351125352125353125354125355125356125357125358125359125360125361125362125363125364125365125366125367125368125369125370125371125372125373125374125375125376125377125378125379125380125381125382125383125384125385125386125387125388125389125390125391125392125393125394125395125396125397125398125399125400125401125402125403125404125405125406125407125408125409125410125411125412125413125414125415125416125417125418125419125420125421125422125423125424125425125426125427125428125429125430125431125432125433125434125435125436125437125438125439125440125441125442125443125444125445125446125447125448125449125450125451125452125453125454125455125456125457125458125459125460125461125462125463125464125465125466125467125468125469125470125471125472125473125474125475125476125477125478125479125480125481125482125483125484125485125486125487125488125489125490125491125492125493125494125495125496125497125498125499125500125501125502125503125504125505125506125507125508125509125510125511125512125513125514125515125516125517125518125519125520125521125522125523125524125525125526125527125528125529125530125531125532125533125534125535125536125537125538125539125540125541125542125543125544125545125546125547125548125549125550125551125552125553125554125555125556125557125558125559125560125561125562125563125564125565125566125567125568125569125570125571125572125573125574125575125576125577125578125579125580125581125582125583125584125585125586125587125588125589125590125591125592125593125594125595125596125597125598125599125600125601125602125603125604125605125606125607125608125609125610125611125612125613125614125615125616125617125618125619125620125621125622125623125624125625125626125627125628125629125630125631125632125633125634125635125636125637125638125639125640125641125642125643125644125645125646125647125648125649125650125651125652125653125654125655125656125657125658125659125660125661125662125663125664125665125666125667125668125669125670125671125672125673125674125675125676125677125678125679125680125681125682125683125684125685125686125687125688125689125690125691125692125693125694125695125696125697125698125699125700125701125702125703125704125705125706125707125708125709125710125711125712125713125714125715125716125717125718125719125720125721125722125723125724125725125726125727125728125729125730125731125732125733125734125735125736125737125738125739125740125741125742125743125744125745125746125747125748125749125750125751125752125753125754125755125756125757125758125759125760125761125762125763125764125765125766125767125768125769125770125771125772125773125774125775125776125777125778125779125780125781125782125783125784125785125786125787125788125789125790125791125792125793125794125795125796125797125798125799125800125801125802125803125804125805125806125807125808125809125810125811125812125813125814125815125816125817125818125819125820125821125822125823125824125825125826125827125828125829125830125831125832125833125834125835125836125837125838125839125840125841125842125843125844125845125846125847125848125849125850125851125852125853125854125855125856125857125858125859125860125861125862125863125864125865125866125867125868125869125870125871125872125873125874125875125876125877125878125879125880125881125882125883125884125885125886125887125888125889125890125891125892125893125894125895125896125897125898125899125900125901125902125903125904125905125906125907125908125909125910125911125912125913125914125915125916125917125918125919125920125921125922125923125924125925125926125927125928125929125930125931125932125933125934125935125936125937125938125939125940125941125942125943125944125945125946125947125948125949125950125951125952125953125954125955125956125957125958125959125960125961125962125963125964125965125966125967125968125969125970125971125972125973125974125975125976125977125978125979125980125981125982125983125984125985125986125987125988125989125990125991125992125993125994125995125996125997125998125999126000126001126002126003126004126005126006126007126008126009126010126011126012126013126014126015126016126017126018126019126020126021126022126023126024126025126026126027126028126029126030126031126032126033126034126035126036126037126038126039126040126041126042126043126044126045126046126047126048126049126050126051126052126053126054126055126056126057126058126059126060126061126062126063126064126065126066126067126068126069126070126071126072126073126074126075126076126077126078126079126080126081126082126083126084126085126086126087126088126089126090126091126092126093126094126095126096126097126098126099126100126101126102126103126104126105126106126107126108126109126110126111126112126113126114126115126116126117126118126119126120126121126122126123126124126125126126126127126128126129126130126131126132126133126134126135126136126137126138126139126140126141126142126143126144126145126146126147126148126149126150126151126152126153126154126155126156126157126158126159126160126161126162126163126164126165126166126167126168126169126170126171126172126173126174126175126176126177126178126179126180126181126182126183126184126185126186126187126188126189126190126191126192126193126194126195126196126197126198126199126200126201126202126203126204126205126206126207126208126209126210126211126212126213126214126215126216126217126218126219126220126221126222126223126224126225126226126227126228126229126230126231126232126233126234126235126236126237126238126239126240126241126242126243126244126245126246126247126248126249126250126251126252126253126254126255126256126257126258126259126260126261126262126263126264126265126266126267126268126269126270126271126272126273126274126275126276126277126278126279126280126281126282126283126284126285126286126287126288126289126290126291126292126293126294126295126296126297126298126299126300126301126302126303126304126305126306126307126308126309126310126311126312126313126314126315126316126317126318126319126320126321126322126323126324126325126326126327126328126329126330126331126332126333126334126335126336126337126338126339126340126341126342126343126344126345126346126347126348126349126350126351126352126353126354126355126356126357126358126359126360126361126362126363126364126365126366126367126368126369126370126371126372126373126374126375126376126377126378126379126380126381126382126383126384126385126386126387126388126389126390126391126392126393126394126395126396126397126398126399126400126401126402126403126404126405126406126407126408126409126410126411126412126413126414126415126416126417126418126419126420126421126422126423126424126425126426126427126428126429126430126431126432126433126434126435126436126437126438126439126440126441126442126443126444126445126446126447126448126449126450126451126452126453126454126455126456126457126458126459126460126461126462126463126464126465126466126467126468126469126470126471126472126473126474126475126476126477126478126479126480126481126482126483126484126485126486126487126488126489126490126491126492126493126494126495126496126497126498126499126500126501126502126503126504126505126506126507126508126509126510126511126512126513126514126515126516126517126518126519126520126521126522126523126524126525126526126527126528126529126530126531126532126533126534126535126536126537126538126539126540126541126542126543126544126545126546126547126548126549126550126551126552126553126554126555126556126557126558126559126560126561126562126563126564126565126566126567126568126569126570126571126572126573126574126575126576126577126578126579126580126581126582126583126584126585126586126587126588126589126590126591126592126593126594126595126596126597126598126599126600126601126602126603126604126605126606126607126608126609126610126611126612126613126614126615126616126617126618126619126620126621126622126623126624126625126626126627126628126629126630126631126632126633126634126635126636126637126638126639126640126641126642126643126644126645126646126647126648126649126650126651126652126653126654126655126656126657126658126659126660126661126662126663126664126665126666126667126668126669126670126671126672126673126674126675126676126677126678126679126680126681126682126683126684126685126686126687126688126689126690126691126692126693126694126695126696126697126698126699126700126701126702126703126704126705126706126707126708126709126710126711126712126713126714126715126716126717126718126719126720126721126722126723126724126725126726126727126728126729126730126731126732126733126734126735126736126737126738126739126740126741126742126743126744126745126746126747126748126749126750126751126752126753126754126755126756126757126758126759126760126761126762126763126764126765126766126767126768126769126770126771126772126773126774126775126776126777126778126779126780126781126782126783126784126785126786126787126788126789126790126791126792126793126794126795126796126797126798126799126800126801126802126803126804126805126806126807126808126809126810126811126812126813126814126815126816126817126818126819126820126821126822126823126824126825126826126827126828126829126830126831126832126833126834126835126836126837126838126839126840126841126842126843126844126845126846126847126848126849126850126851126852126853126854126855126856126857126858126859126860126861126862126863126864126865126866126867126868126869126870126871126872126873126874126875126876126877126878126879126880126881126882126883126884126885126886126887126888126889126890126891126892126893126894126895126896126897126898126899126900126901126902126903126904126905126906126907126908126909126910126911126912126913126914126915126916126917126918126919126920126921126922126923126924126925126926126927126928126929126930126931126932126933126934126935126936126937126938126939126940126941126942126943126944126945126946126947126948126949126950126951126952126953126954126955126956126957126958126959126960126961126962126963126964126965126966126967126968126969126970126971126972126973126974126975126976126977126978126979126980126981126982126983126984126985126986126987126988126989126990126991126992126993126994126995126996126997126998126999127000127001127002127003127004127005127006127007127008127009127010127011127012127013127014127015127016127017127018127019127020127021127022127023127024127025127026127027127028127029127030127031127032127033127034127035127036127037127038127039127040127041127042127043127044127045127046127047127048127049127050127051127052127053127054127055127056127057127058127059127060127061127062127063127064127065127066127067127068127069127070127071127072127073127074127075127076127077127078127079127080127081127082127083127084127085127086127087127088127089127090127091127092127093127094127095127096127097127098127099127100127101127102127103127104127105127106127107127108127109127110127111127112127113127114127115127116127117127118127119127120127121127122127123127124127125127126127127127128127129127130127131127132127133127134127135127136127137127138127139127140127141127142127143127144127145127146127147127148127149127150127151127152127153127154127155127156127157127158127159127160127161127162127163127164127165127166127167127168127169127170127171127172127173127174127175127176127177127178127179127180127181127182127183127184127185127186127187127188127189127190127191127192127193127194127195127196127197127198127199127200127201127202127203127204127205127206127207127208127209127210127211127212127213127214127215127216127217127218127219127220127221127222127223127224127225127226127227127228127229127230127231127232127233127234127235127236127237127238127239127240127241127242127243127244127245127246127247127248127249127250127251127252127253127254127255127256127257127258127259127260127261127262127263127264127265127266127267127268127269127270127271127272127273127274127275127276127277127278127279127280127281127282127283127284127285127286127287127288127289127290127291127292127293127294127295127296127297127298127299127300127301127302127303127304127305127306127307127308127309127310127311127312127313127314127315127316127317127318127319127320127321127322127323127324127325127326127327127328127329127330127331127332127333127334127335127336127337127338127339127340127341127342127343127344127345127346127347127348127349127350127351127352127353127354127355127356127357127358127359127360127361127362127363127364127365127366127367127368127369127370127371127372127373127374127375127376127377127378127379127380127381127382127383127384127385127386127387127388127389127390127391127392127393127394127395127396127397127398127399127400127401127402127403127404127405127406127407127408127409127410127411127412127413127414127415127416127417127418127419127420127421127422127423127424127425127426127427127428127429127430127431127432127433127434127435127436127437127438127439127440127441127442127443127444127445127446127447127448127449127450127451127452127453127454127455127456127457127458127459127460127461127462127463127464127465127466127467127468127469127470127471127472127473127474127475127476127477127478127479127480127481127482127483127484127485127486127487127488127489127490127491127492127493127494127495127496127497127498127499127500127501127502127503127504127505127506127507127508127509127510127511127512127513127514127515127516127517127518127519127520127521127522127523127524127525127526127527127528127529127530127531127532127533127534127535127536127537127538127539127540127541127542127543127544127545127546127547127548127549127550127551127552127553127554127555127556127557127558127559127560127561127562127563127564127565127566127567127568127569127570127571127572127573127574127575127576127577127578127579127580127581127582127583127584127585127586127587127588127589127590127591127592127593127594127595127596127597127598127599127600127601127602127603127604127605127606127607127608127609127610127611127612127613127614127615127616127617127618127619127620127621127622127623127624127625127626127627127628127629127630127631127632127633127634127635127636127637127638127639127640127641127642127643127644127645127646127647127648127649127650127651127652127653127654127655127656127657127658127659127660127661127662127663127664127665127666127667127668127669127670127671127672127673127674127675127676127677127678127679127680127681127682127683127684127685127686127687127688127689127690127691127692127693127694127695127696127697127698127699127700127701127702127703127704127705127706127707127708127709127710127711127712127713127714127715127716127717127718127719127720127721127722127723127724127725127726127727127728127729127730127731127732127733127734127735127736127737127738127739127740127741127742127743127744127745127746127747127748127749127750127751127752127753127754127755127756127757127758127759127760127761127762127763127764127765127766127767127768127769127770127771127772127773127774127775127776127777127778127779127780127781127782127783127784127785127786127787127788127789127790127791127792127793127794127795127796127797127798127799127800127801127802127803127804127805127806127807127808127809127810127811127812127813127814127815127816127817127818127819127820127821127822127823127824127825127826127827127828127829127830127831127832127833127834127835127836127837127838127839127840127841127842127843127844127845127846127847127848127849127850127851127852127853127854127855127856127857127858127859127860127861127862127863127864127865127866127867127868127869127870127871127872127873127874127875127876127877127878127879127880127881127882127883127884127885127886127887127888127889127890127891127892127893127894127895127896127897127898127899127900127901127902127903127904127905127906127907127908127909127910127911127912127913127914127915127916127917127918127919127920127921127922127923127924127925127926127927127928127929127930127931127932127933127934127935127936127937127938127939127940127941127942127943127944127945127946127947127948127949127950127951127952127953127954127955127956127957127958127959127960127961127962127963127964127965127966127967127968127969127970127971127972127973127974127975127976127977127978127979127980127981127982127983127984127985127986127987127988127989127990127991127992127993127994127995127996127997127998127999128000128001128002128003128004128005128006128007128008128009128010128011128012128013128014128015128016128017128018128019128020128021128022128023128024128025128026128027128028128029128030128031128032128033128034128035128036128037128038128039128040128041128042128043128044128045128046128047128048128049128050128051128052128053128054128055128056128057128058128059128060128061128062128063128064128065128066128067128068128069128070128071128072128073128074128075128076128077128078128079128080128081128082128083128084128085128086128087128088128089128090128091128092128093128094128095128096128097128098128099128100128101128102128103128104128105128106128107128108128109128110128111128112128113128114128115128116128117128118128119128120128121128122128123128124128125128126128127128128128129128130128131128132128133128134128135128136128137128138128139128140128141128142128143128144128145128146128147128148128149128150128151128152128153128154128155128156128157128158128159128160128161128162128163128164128165128166128167128168128169128170128171128172128173128174128175128176128177128178128179128180128181128182128183128184128185128186128187128188128189128190128191128192128193128194128195128196128197128198128199128200128201128202128203128204128205128206128207128208128209128210128211128212128213128214128215128216128217128218128219128220128221128222128223128224128225128226128227128228128229128230128231128232128233128234128235128236128237128238128239128240128241128242128243128244128245128246128247128248128249128250128251128252128253128254128255128256128257128258128259128260128261128262128263128264128265128266128267128268128269128270128271128272128273128274128275128276128277128278128279128280128281128282128283128284128285128286128287128288128289128290128291128292128293128294128295128296128297128298128299128300128301128302128303128304128305128306128307128308128309128310128311128312128313128314128315128316128317128318128319128320128321128322128323128324128325128326128327128328128329128330128331128332128333128334128335128336128337128338128339128340128341128342128343128344128345128346128347128348128349128350128351128352128353128354128355128356128357128358128359128360128361128362128363128364128365128366128367128368128369128370128371128372128373128374128375128376128377128378128379128380128381128382128383128384128385128386128387128388128389128390128391128392128393128394128395128396128397128398128399128400128401128402128403128404128405128406128407128408128409128410128411128412128413128414128415128416128417128418128419128420128421128422128423128424128425128426128427128428128429128430128431128432128433128434128435128436128437128438128439128440128441128442128443128444128445128446128447128448128449128450128451128452128453128454128455128456128457128458128459128460128461128462128463128464128465128466128467128468128469128470128471128472128473128474128475128476128477128478128479128480128481128482128483128484128485128486128487128488128489128490128491128492128493128494128495128496128497128498128499128500128501128502128503128504128505128506128507128508128509128510128511128512128513128514128515128516128517128518128519128520128521128522128523128524128525128526128527128528128529128530128531128532128533128534128535128536128537128538128539128540128541128542128543128544128545128546128547128548128549128550128551128552128553128554128555128556128557128558128559128560128561128562128563128564128565128566128567128568128569128570128571128572128573128574128575128576128577128578128579128580128581128582128583128584128585128586128587128588128589128590128591128592128593128594128595128596128597128598128599128600128601128602128603128604128605128606128607128608128609128610128611128612128613128614128615128616128617128618128619128620128621128622128623128624128625128626128627128628128629128630128631128632128633128634128635128636128637128638128639128640128641128642128643128644128645128646128647128648128649128650128651128652128653128654128655128656128657128658128659128660128661128662128663128664128665128666128667128668128669128670128671128672128673128674128675128676128677128678128679128680128681128682128683128684128685128686128687128688128689128690128691128692128693128694128695128696128697128698128699128700128701128702128703128704128705128706128707128708128709128710128711128712128713128714128715128716128717128718128719128720128721128722128723128724128725128726128727128728128729128730128731128732128733128734128735128736128737128738128739128740128741128742128743128744128745128746128747128748128749128750128751128752128753128754128755128756128757128758128759128760128761128762128763128764128765128766128767128768128769128770128771128772128773128774128775128776128777128778128779128780128781128782128783128784128785128786128787128788128789128790128791128792128793128794128795128796128797128798128799128800128801128802128803128804128805128806128807128808128809128810128811128812128813128814128815128816128817128818128819128820128821128822128823128824128825128826128827128828128829128830128831128832128833128834128835128836128837128838128839128840128841128842128843128844128845128846128847128848128849128850128851128852128853128854128855128856128857128858128859128860128861128862128863128864128865128866128867128868128869128870128871128872128873128874128875128876128877128878128879128880128881128882128883128884128885128886128887128888128889128890128891128892128893128894128895128896128897128898128899128900128901128902128903128904128905128906128907128908128909128910128911128912128913128914128915128916128917128918128919128920128921128922128923128924128925128926128927128928128929128930128931128932128933128934128935128936128937128938128939128940128941128942128943128944128945128946128947128948128949128950128951128952128953128954128955128956128957128958128959128960128961128962128963128964128965128966128967128968128969128970128971128972128973128974128975128976128977128978128979128980128981128982128983128984128985128986128987128988128989128990128991128992128993128994128995128996128997128998128999129000129001129002129003129004129005129006129007129008129009129010129011129012129013129014129015129016129017129018129019129020129021129022129023129024129025129026129027129028129029129030129031129032129033129034129035129036129037129038129039129040129041129042129043129044129045129046129047129048129049129050129051129052129053129054129055129056129057129058129059129060129061129062129063129064129065129066129067129068129069129070129071129072129073129074129075129076129077129078129079129080129081129082129083129084129085129086129087129088129089129090129091129092129093129094129095129096129097129098129099129100129101129102129103129104129105129106129107129108129109129110129111129112129113129114129115129116129117129118129119129120129121129122129123129124129125129126129127129128129129129130129131129132129133129134129135129136129137129138129139129140129141129142129143129144129145129146129147129148129149129150129151129152129153129154129155129156129157129158129159129160129161129162129163129164129165129166129167129168129169129170129171129172129173129174129175129176129177129178129179129180129181129182129183 |
- #!/usr/bin/env php
- <?php
- /*
- * This file is part of Composer.
- *
- * (c) Nils Adermann <naderman@naderman.de>
- * Jordi Boggiano <j.boggiano@seld.be>
- *
- * For the full copyright and license information, please view
- * the license that is located at the bottom of this file.
- */
- // Avoid APC causing random fatal errors per https://github.com/composer/composer/issues/264
- 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)) {
- if (version_compare(phpversion('apc'), '3.0.12', '>=')) {
- ini_set('apc.cache_by_default', 0);
- } else {
- fwrite(STDERR, 'Warning: APC <= 3.0.12 may cause fatal errors when running composer commands.'.PHP_EOL);
- fwrite(STDERR, 'Update APC, or set apc.enable_cli or apc.cache_by_default to 0 in your php.ini.'.PHP_EOL);
- }
- }
- if (!class_exists('Phar')) {
- 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;
- exit(1);
- }
- Phar::mapPhar('composer.phar');
- require 'phar://composer.phar/bin/composer';
- __HALT_COMPILER(); ?>
- ¶¿��„������
���composer.phar����!���src/Composer/Advisory/Auditor.php���c���‘À¤������1���src/Composer/Advisory/PartialSecurityAdvisory.php
- ���c
- ��$}zߤ������*���src/Composer/Advisory/SecurityAdvisory.phpÓ���cÓ��ª!Ž«¤������+���src/Composer/Autoload/AutoloadGenerator.phpö€���cö€��£gš¤������+���src/Composer/Autoload/ClassMapGenerator.php’���c’���¨|S¤������(���src/Composer/Autoload/PhpFileCleaner.phpþ���cþ��àÑkg¤���������src/Composer/Cache.phpÂ���cÂ��ý!åë¤������%���src/Composer/Command/AboutCommand.phpW���cW��â:†!¤������'���src/Composer/Command/ArchiveCommand.phpY���cY��7c®µ¤������%���src/Composer/Command/AuditCommand.php2
- ���c2
- �� hņ¤������$���src/Composer/Command/BaseCommand.phpå&���cå&��K°1-¤������.���src/Composer/Command/BaseDependencyCommand.php,���c,��ò_Õ¤������$���src/Composer/Command/BumpCommand.php×���c×��y¥_¦¤������1���src/Composer/Command/CheckPlatformReqsCommand.phpy���cy��Ïáî�¤������*���src/Composer/Command/ClearCacheCommand.php ���c ��Å*¤������(���src/Composer/Command/CompletionTrait.phpW���cW��@Ίö¤������&���src/Composer/Command/ConfigCommand.php `���c `��²aló¤������-���src/Composer/Command/CreateProjectCommand.phpJ���cJ���J$¤������'���src/Composer/Command/DependsCommand.phpF���cF��{eüî¤������(���src/Composer/Command/DiagnoseCommand.phpäN���cäN��;Ôív¤������,���src/Composer/Command/DumpAutoloadCommand.phpÈ���cÈ��çâ,K¤������$���src/Composer/Command/ExecCommand.phpl
- ���cl
- ��ó;º
- ¤������$���src/Composer/Command/FundCommand.phpÁ���cÁ��5`ÈG¤������&���src/Composer/Command/GlobalCommand.php����c���Š¤������$���src/Composer/Command/HomeCommand.php^���c^��ë"+C¤������$���src/Composer/Command/InitCommand.php¶B���c¶B��¢S‚Ȥ������'���src/Composer/Command/InstallCommand.phpŒ���cŒ��– í!¤������(���src/Composer/Command/LicensesCommand.php½���c½��ƃi]¤������(���src/Composer/Command/OutdatedCommand.php…���c…��¦¶…÷¤������.���src/Composer/Command/PackageDiscoveryTrait.phpŒ4���cŒ4��Šl¿¤������)���src/Composer/Command/ProhibitsCommand.phpæ���cæ��Òñ¡�¤������)���src/Composer/Command/ReinstallCommand.phpd���cd��Ôfçú¤������&���src/Composer/Command/RemoveCommand.php�-���c�-��úµP<¤������'���src/Composer/Command/RequireCommand.phpkI���ckI��†ýI,¤������)���src/Composer/Command/RunScriptCommand.phpø���cø��–ˆ6%¤������+���src/Composer/Command/ScriptAliasCommand.php»���c»��,HDͤ������&���src/Composer/Command/SearchCommand.phpc���cc��6¼Æ¤������*���src/Composer/Command/SelfUpdateCommand.phpwK���cwK��ÆÚiu¤������$���src/Composer/Command/ShowCommand.phpb£���cb£��v“½G¤������&���src/Composer/Command/StatusCommand.phpU���cU��ªÞ©ª¤������(���src/Composer/Command/SuggestsCommand.phpÉ���cÉ��ùÏfk¤������&���src/Composer/Command/UpdateCommand.phpê2���cê2��¾Ã%¤������(���src/Composer/Command/ValidateCommand.php³ ���c³ ���Ýëþ¤���������src/Composer/Composer.php����c���N%çĤ���������src/Composer/Config.phpò4���cò4��Â~«V¤������-���src/Composer/Config/ConfigSourceInterface.phpº���cº��½Ó¤������(���src/Composer/Config/JsonConfigSource.phpc���cc��È!T-¤������$���src/Composer/Console/Application.php¦H���c¦H��îØwä������*���src/Composer/Console/GithubActionError.php���c��`±‰æ¤������,���src/Composer/Console/HtmlOutputFormatter.php���c��[¿K*¤������,���src/Composer/Console/Input/InputArgument.php¶���c¶��ª¼K¤������*���src/Composer/Console/Input/InputOption.phpg���cg��ˆ7'4¤������-���src/Composer/DependencyResolver/Decisions.phpŒ���cŒ��¿]¢¤������1���src/Composer/DependencyResolver/DefaultPolicy.phpx���cx��£Ë/U¤������/���src/Composer/DependencyResolver/GenericRule.php–���c–��Z)í¤������8���src/Composer/DependencyResolver/LocalRepoTransaction.php½���c½��ßšHš¤������3���src/Composer/DependencyResolver/LockTransaction.phpI���cI��Vè�¯¤������5���src/Composer/DependencyResolver/MultiConflictRule.php+���c+��Ãwì¤������>���src/Composer/DependencyResolver/Operation/InstallOperation.phpÿ���cÿ��=ú§§¤������I���src/Composer/DependencyResolver/Operation/MarkAliasInstalledOperation.php���c���1NJ¤������K���src/Composer/DependencyResolver/Operation/MarkAliasUninstalledOperation.php���c��tw
¤������@���src/Composer/DependencyResolver/Operation/OperationInterface.phpø����cø���÷Wý¤������=���src/Composer/DependencyResolver/Operation/SolverOperation.phpH���cH��§¤������@���src/Composer/DependencyResolver/Operation/UninstallOperation.phpç���cç��|ÁR¤������=���src/Composer/DependencyResolver/Operation/UpdateOperation.phpŸ���cŸ��Ü7椤������3���src/Composer/DependencyResolver/PolicyInterface.phpž���cž��øÎá¤������(���src/Composer/DependencyResolver/Pool.php ���c ��xF!¤������/���src/Composer/DependencyResolver/PoolBuilder.phpûA���cûA��GV¤������1���src/Composer/DependencyResolver/PoolOptimizer.phpÛ)���cÛ)��¥!\¤������+���src/Composer/DependencyResolver/Problem.phpL���cL���ÀO¤������+���src/Composer/DependencyResolver/Request.php���c��Í*¬Ö¤������(���src/Composer/DependencyResolver/Rule.php<0���c<0��À³ù¤������1���src/Composer/DependencyResolver/Rule2Literals.php���c��3vþ¤������+���src/Composer/DependencyResolver/RuleSet.php¯���c¯��T:·¤������4���src/Composer/DependencyResolver/RuleSetGenerator.php6���c6��¯R\s¤������3���src/Composer/DependencyResolver/RuleSetIterator.phpõ���cõ��œy¤������2���src/Composer/DependencyResolver/RuleWatchChain.php{���c{��‚hóD¤������2���src/Composer/DependencyResolver/RuleWatchGraph.phpœ ���cœ ��Zœ{|¤������1���src/Composer/DependencyResolver/RuleWatchNode.phpv���cv��p™·¤������*���src/Composer/DependencyResolver/Solver.phpž9���cž9��v‹{þ¤������6���src/Composer/DependencyResolver/SolverBugException.php¹���c¹��z=¤������;���src/Composer/DependencyResolver/SolverProblemsException.phpœ���cœ��¼.½À¤������/���src/Composer/DependencyResolver/Transaction.php-���c-��É铤������-���src/Composer/Downloader/ArchiveDownloader.phpÇ���cÇ��"6FB¤������1���src/Composer/Downloader/ChangeReportInterface.phpõ����cõ���ÃÂB¤������+���src/Composer/Downloader/DownloadManager.php¤���c¤��´c¾¤������/���src/Composer/Downloader/DownloaderInterface.phpÍ���cÍ��•ÊGÞ¤������3���src/Composer/Downloader/DvcsDownloaderInterface.phpú����cú���à%'¤������*���src/Composer/Downloader/FileDownloader.phpé/���cé/��‡zÖá¤������/���src/Composer/Downloader/FilesystemException.php/���c/��!‹å&¤������,���src/Composer/Downloader/FossilDownloader.phpi
���ci
��¡‹Z¤������)���src/Composer/Downloader/GitDownloader.phpÎD���cÎD��Jþ¢¤������*���src/Composer/Downloader/GzipDownloader.php±���c±��í‰v÷¤������(���src/Composer/Downloader/HgDownloader.php?���c?��€/Œ¤������8���src/Composer/Downloader/MaxFileSizeExceededException.phpŒ����cŒ���ÚºÔ¤������*���src/Composer/Downloader/PathDownloader.php*���c*��¯?a¤������.���src/Composer/Downloader/PerforceDownloader.php‹ ���c‹ ���<�¤������*���src/Composer/Downloader/PharDownloader.phpª���cª��XÈȤ������)���src/Composer/Downloader/RarDownloader.php›���c›��GU¤������)���src/Composer/Downloader/SvnDownloader.phpt���ct��à /*¤������)���src/Composer/Downloader/TarDownloader.php¨���c¨��×rß‚¤������.���src/Composer/Downloader/TransportException.phps���cs��ø
¤������9���src/Composer/Downloader/VcsCapableDownloaderInterface.phpý����cý���ä6¤¤������)���src/Composer/Downloader/VcsDownloader.php5���c5��笤������(���src/Composer/Downloader/XzDownloader.php���c��&Ør‚¤������)���src/Composer/Downloader/ZipDownloader.phpG ���cG ��òß[&¤������&���src/Composer/EventDispatcher/Event.phpØ���cØ��…÷¡ð¤������0���src/Composer/EventDispatcher/EventDispatcher.php86���c86��/' G¤������9���src/Composer/EventDispatcher/EventSubscriberInterface.phpÂ����cÂ���}=é¤������9���src/Composer/EventDispatcher/ScriptExecutionException.php‘����c‘���XvèϤ������9���src/Composer/Exception/IrrecoverableDownloadException.php�����c����0Þ4
¤������)���src/Composer/Exception/NoSslException.php�����c����ØU¦Ò¤���������src/Composer/Factory.php¬O���c¬O��DÝÚ2¤������T���src/Composer/Filter/PlatformRequirementFilter/IgnoreAllPlatformRequirementFilter.phpS���cS��~Jå¤������U���src/Composer/Filter/PlatformRequirementFilter/IgnoreListPlatformRequirementFilter.php���c��Àš€¤������X���src/Composer/Filter/PlatformRequirementFilter/IgnoreNothingPlatformRequirementFilter.php���c��~º&#¤������R���src/Composer/Filter/PlatformRequirementFilter/PlatformRequirementFilterFactory.phpw���cw��ÑT¿¤������T���src/Composer/Filter/PlatformRequirementFilter/PlatformRequirementFilterInterface.php¿����c¿���×€n¤���������src/Composer/IO/BaseIO.php—���c—��4ëÕ¤���������src/Composer/IO/BufferIO.php;���c;��ÐUv§¤���������src/Composer/IO/ConsoleIO.php}���c}��M¯ÍÓ¤���������src/Composer/IO/IOInterface.phpÏ���cÏ��¼Ê+¤���������src/Composer/IO/NullIO.phpO���cO��bˆ¨s¤���������src/Composer/Installer.phpÄ���cÄ��HSJL¤������*���src/Composer/Installer/BinaryInstaller.phpS)���cS)��¬Ì]€¤������2���src/Composer/Installer/BinaryPresenceInterface.phpæ����cæ���®3—Œ¤������.���src/Composer/Installer/InstallationManager.phpã3���cã3��Vÿ
- ¤������)���src/Composer/Installer/InstallerEvent.php*���c*��FZäÙ¤������*���src/Composer/Installer/InstallerEvents.php¥����c¥���>•íǤ������-���src/Composer/Installer/InstallerInterface.phpx���cx��îب¶¤������+���src/Composer/Installer/LibraryInstaller.php
- ���c
- ��¶^öÁ¤������/���src/Composer/Installer/MetapackageInstaller.phpÒ���cÒ��sí¾¤������(���src/Composer/Installer/NoopInstaller.phpa���ca��êxQn¤������'���src/Composer/Installer/PackageEvent.phpô���cô��b‘\A¤������(���src/Composer/Installer/PackageEvents.phpû���cû��ò«K¤������*���src/Composer/Installer/PluginInstaller.php÷���c÷��Poˆ»¤������+���src/Composer/Installer/ProjectInstaller.php9 ���c9 ��Uц¤������4���src/Composer/Installer/SuggestedPackagesReporter.php¥���c¥��ö”Oë¤���������src/Composer/Json/JsonFile.php¡���c¡��õ:é¤������#���src/Composer/Json/JsonFormatter.php…���c…��_Æi¤¤������%���src/Composer/Json/JsonManipulator.php)4���c)4��#§óŽ¤������-���src/Composer/Json/JsonValidationException.php—���c—���^^´¤������2���src/Composer/PHPStan/ConfigReturnTypeExtension.php¶���c¶��Ý—B¤������:���src/Composer/PHPStan/RuleReasonDataReturnTypeExtension.php~���c~��¦ç¬H¤������%���src/Composer/Package/AliasPackage.phpk���ck��®‰é¤������7���src/Composer/Package/Archiver/ArchivableFilesFilter.php1���c1��{7ÑŽ¤������7���src/Composer/Package/Archiver/ArchivableFilesFinder.phpJ���cJ��š³2£¤������0���src/Composer/Package/Archiver/ArchiveManager.phpi���ci��g[¤������3���src/Composer/Package/Archiver/ArchiverInterface.phpS���cS��ÿì?î¤������3���src/Composer/Package/Archiver/BaseExcludeFilter.php���c��xÆ6Ȥ������7���src/Composer/Package/Archiver/ComposerExcludeFilter.php?���c?��?�`^¤������2���src/Composer/Package/Archiver/GitExcludeFilter.php$���c$��t�8N¤������.���src/Composer/Package/Archiver/PharArchiver.phpÆ���cÆ��-íÙª¤������-���src/Composer/Package/Archiver/ZipArchiver.php
���c
��ÜmÒ¤������$���src/Composer/Package/BasePackage.phpö���cö��ÿ¡Â̤������*���src/Composer/Package/Comparer/Comparer.php¦ ���c¦ ��7Fâ¤������-���src/Composer/Package/CompleteAliasPackage.phpq
- ���cq
- ��ú #·¤������(���src/Composer/Package/CompletePackage.php
- ���c
- ��† J±¤������1���src/Composer/Package/CompletePackageInterface.php����c���‰‘”¤������+���src/Composer/Package/Dumper/ArrayDumper.phpH
���cH
��(ª ¤���������src/Composer/Package/Link.phpö���cö�� "j¥¤������+���src/Composer/Package/Loader/ArrayLoader.phpŠ-���cŠ-��ãjg¤������7���src/Composer/Package/Loader/InvalidPackageException.php„���c„��èMü•¤������*���src/Composer/Package/Loader/JsonLoader.php“���c“��褢4¤������/���src/Composer/Package/Loader/LoaderInterface.phpž���cž��FB¤¤������1���src/Composer/Package/Loader/RootPackageLoader.phpÚ���cÚ��sSô¤������5���src/Composer/Package/Loader/ValidatingArrayLoader.phpùM���cùM��®Ä>¡¤���������src/Composer/Package/Locker.phpU%���cU%��ö•r¤������ ���src/Composer/Package/Package.php6$���c6$��©ÿ›T¤������)���src/Composer/Package/PackageInterface.phpÔ���cÔ��¦X
- ø¤������)���src/Composer/Package/RootAliasPackage.phpç���cç��A:–D¤������$���src/Composer/Package/RootPackage.php©���c©�� º¤������-���src/Composer/Package/RootPackageInterface.php9���c9��ˆ¨ì¤������0���src/Composer/Package/Version/StabilityFilter.php���c��µêrú¤������.���src/Composer/Package/Version/VersionBumper.phpì���cì��d�Då¤������/���src/Composer/Package/Version/VersionGuesser.phpñ'���cñ'��ƤÊΤ������.���src/Composer/Package/Version/VersionParser.phpÔ���cÔ��Øà’æ¤������0���src/Composer/Package/Version/VersionSelector.php‚���c‚��Š&µ¤������ ���src/Composer/PartialComposer.phpþ���cþ��¨ùš¤������&���src/Composer/Platform/HhvmDetector.php-���c-���‚À#¤������!���src/Composer/Platform/Runtime.phpï���cï��o^1%¤������!���src/Composer/Platform/Version.php—���c—��¿v˜µ¤������-���src/Composer/Plugin/Capability/Capability.phpp����cp���š#c;¤������2���src/Composer/Plugin/Capability/CommandProvider.php°����c°���FüÙ¤¤���������src/Composer/Plugin/Capable.php˜����c˜���û°hª¤������$���src/Composer/Plugin/CommandEvent.php?���c?��|U`¤������.���src/Composer/Plugin/PluginBlockedException.php§����c§���öùr¤������$���src/Composer/Plugin/PluginEvents.php¨���c¨��\K“Ö¤������'���src/Composer/Plugin/PluginInterface.php®���c®��^>}¤������%���src/Composer/Plugin/PluginManager.php¡L���c¡L��‰ÿ8Ϥ������-���src/Composer/Plugin/PostFileDownloadEvent.php¿���c¿��à@>‰¤������*���src/Composer/Plugin/PreCommandRunEvent.php/���c/��3 ±¤������,���src/Composer/Plugin/PreFileDownloadEvent.php����c����`[¤������*���src/Composer/Plugin/PrePoolCreateEvent.php±���c±��ó¼Û¤������4���src/Composer/Question/StrictConfirmationQuestion.php•���c•��x”»A¤������5���src/Composer/Repository/AdvisoryProviderInterface.php©���c©��•Ð°¤������+���src/Composer/Repository/ArrayRepository.php4���c4��º�ÒÕ¤������.���src/Composer/Repository/ArtifactRepository.phpB���cB��S‘Nj¤������2���src/Composer/Repository/CanonicalPackagesTrait.phpÄ���cÄ��¦{ë¤������.���src/Composer/Repository/ComposerRepository.php9¯���c9¯��{CôZ¤������/���src/Composer/Repository/CompositeRepository.phpy���cy��…ï¤������;���src/Composer/Repository/ConfigurableRepositoryInterface.php¡����c¡���ce*2¤������0���src/Composer/Repository/FilesystemRepository.phpê"���cê"��4 ਤ������,���src/Composer/Repository/FilterRepository.phpÞ
���cÞ
��Áú+#¤������4���src/Composer/Repository/InstalledArrayRepository.phpX���cX��¼,[¤������9���src/Composer/Repository/InstalledFilesystemRepository.phpJ���cJ��'kCè¤������/���src/Composer/Repository/InstalledRepository.phpK���cK��y™á’¤������8���src/Composer/Repository/InstalledRepositoryInterface.phpà����cà���¾²ÿg¤������6���src/Composer/Repository/InvalidRepositoryException.php‡����c‡���
W<_¤������/���src/Composer/Repository/LockArrayRepository.phpâ����câ����^†ú¤������-���src/Composer/Repository/PackageRepository.php���c��\/*þ¤������*���src/Composer/Repository/PathRepository.php����c���ç,j
¤������*���src/Composer/Repository/PearRepository.php���c��QuÏj¤������.���src/Composer/Repository/PlatformRepository.php´R���c´R���}¤������-���src/Composer/Repository/RepositoryFactory.phpW���cW��è(¤������/���src/Composer/Repository/RepositoryInterface.php¤���c¤��,
:¤������-���src/Composer/Repository/RepositoryManager.php¢���c¢��,}~¤������7���src/Composer/Repository/RepositorySecurityException.phpˆ����cˆ���qœ×t¤������)���src/Composer/Repository/RepositorySet.phpÄ ���cÄ ��.ô¾ü¤������+���src/Composer/Repository/RepositoryUtils.php���c��I³z¤������1���src/Composer/Repository/RootPackageRepository.php\���c\��¾`9ü¤������,���src/Composer/Repository/Vcs/FossilDriver.phpB���cB��~*�¦¤������2���src/Composer/Repository/Vcs/GitBitbucketDriver.phpe&���ce&��¿ iä������)���src/Composer/Repository/Vcs/GitDriver.php[���c[��-ðâĤ������,���src/Composer/Repository/Vcs/GitHubDriver.php.8���c.8��õVö+¤������,���src/Composer/Repository/Vcs/GitLabDriver.php²1���c²1��dHw¤������(���src/Composer/Repository/Vcs/HgDriver.phpÁ���cÁ��Â&/N¤������.���src/Composer/Repository/Vcs/PerforceDriver.php���c��Î%ÿÚ¤������)���src/Composer/Repository/Vcs/SvnDriver.phpi���ci��"öÖ¤������)���src/Composer/Repository/Vcs/VcsDriver.php
���c
��Î&þ:¤������2���src/Composer/Repository/Vcs/VcsDriverInterface.php±���c±��TŠ„ø¤������)���src/Composer/Repository/VcsRepository.php+4���c+4��–ÚÿŠ¤������1���src/Composer/Repository/VersionCacheInterface.php¹����c¹���‚h‡¤������3���src/Composer/Repository/WritableArrayRepository.phpÙ���cÙ��l&´#¤������7���src/Composer/Repository/WritableRepositoryInterface.phpw���cw��Õ~¼0¤���������src/Composer/Script/Event.phpå���cå��Š¼ y¤������$���src/Composer/Script/ScriptEvents.phpI���cI��¤£D4¤������ ���src/Composer/SelfUpdate/Keys.phpÙ���cÙ��ɨs¤������$���src/Composer/SelfUpdate/Versions.php^ ���c^ ��oÑËû¤������ ���src/Composer/Util/AuthHelper.phpä"���cä"��¿^¤���������src/Composer/Util/Bitbucket.phpÃ���cÃ��ñ(5¤������$���src/Composer/Util/ComposerMirror.phpÝ���cÝ��)Yz3¤������%���src/Composer/Util/ConfigValidator.phpe���ce��Ñ3¶°¤������"���src/Composer/Util/ErrorHandler.phpL���cL��Q%Ìã¤������ ���src/Composer/Util/Filesystem.php…=���c…=��dÊAϤ���������src/Composer/Util/Git.phpB:���cB:��ýôþ„¤���������src/Composer/Util/GitHub.phpF���cF��‰SÒÀ¤���������src/Composer/Util/GitLab.php×���c×��ÿ;w¤���������src/Composer/Util/Hg.phpO���cO��ËЄ>¤������)���src/Composer/Util/Http/CurlDownloader.php÷J���c÷J��'Ê/(¤������'���src/Composer/Util/Http/CurlResponse.php•���c•��’;©¹¤������&���src/Composer/Util/Http/ProxyHelper.php’
- ���c’
- ��‰töû¤������'���src/Composer/Util/Http/ProxyManager.phpx
- ���cx
- ��æà¤������'���src/Composer/Util/Http/RequestProxy.phpg���cg��̇òµ¤������#���src/Composer/Util/Http/Response.phpã���cã��ÖmR^¤������$���src/Composer/Util/HttpDownloader.php¸'���c¸'��AüÊJ¤���������src/Composer/Util/IniHelper.phpŽ���cŽ��™m®B¤���������src/Composer/Util/Loop.php
- ���c
- ��ö'’¤������&���src/Composer/Util/MetadataMinifier.phpC���cC��d˜¤������$���src/Composer/Util/NoProxyPattern.php,���c,��Ê÷!Q¤������!���src/Composer/Util/PackageInfo.php„���c„��Ïú’¤������#���src/Composer/Util/PackageSorter.php½���c½��XÑ·¤���������src/Composer/Util/Perforce.php"4���c"4��E�Q[¤���������src/Composer/Util/Platform.php§���c§��å8?¤������%���src/Composer/Util/ProcessExecutor.phpv ���cv ��î£øí¤������&���src/Composer/Util/RemoteFilesystem.phpÖ@���cÖ@��
- ŠRU¤���������src/Composer/Util/Silencer.phpü���cü��Ðå•À¤������*���src/Composer/Util/StreamContextFactory.php���c��¶eä6¤���������src/Composer/Util/Svn.phpô���cô��ÕL¥8¤������ ���src/Composer/Util/SyncHelper.php_���c_���3ÙP¤���������src/Composer/Util/Tar.php…���c…��÷Ìt?¤���������src/Composer/Util/TlsHelper.phpj���cj��Ч†Q¤���������src/Composer/Util/Url.phpk���ck��6è¤���������src/Composer/Util/Zip.php���c��£DÙ‘¤���������src/bootstrap.php
- ���c
- ��ÑÄ-Ȥ������%���src/Composer/Autoload/ClassLoader.phpÄ>���cÄ>��Æ5Ky¤������"���src/Composer/InstalledVersions.phpÝ:���cÝ:��ç•ŽK¤������#���res/composer-repository-schema.jsonñ���cñ��|0à„¤���������res/composer-schema.json›¾���c›¾��²ºúĤ���������vendor/autoload.phps���cs��#6Ý ¤���������vendor/composer/ClassLoader.php\���c\��ÜZuœ¤������%���vendor/composer/InstalledVersions.phpk���ck��ü‚Ðj¤������%���vendor/composer/autoload_classmap.php(���c(��A«…i¤������"���vendor/composer/autoload_files.php¶���c¶��h³¥-¤������'���vendor/composer/autoload_namespaces.phpZ����cZ���ë¦á–¤������!���vendor/composer/autoload_psr4.php_���c_��èWz¤������!���vendor/composer/autoload_real.phpÙ���cÙ��@"úª¤������#���vendor/composer/autoload_static.phpy���cy��joGy¤������!���vendor/composer/ca-bundle/LICENSE���c��G _¤������(���vendor/composer/ca-bundle/res/cacert.pem
e��c
e�B¿{Ö¤������*���vendor/composer/ca-bundle/src/CaBundle.php•$���c•$��ÛnÓ¤������+���vendor/composer/class-map-generator/LICENSE���c��=ù¾õ¤������4���vendor/composer/class-map-generator/src/ClassMap.phpÀ���cÀ��c¾Ã[¤������=���vendor/composer/class-map-generator/src/ClassMapGenerator.php����c���²ÍÐö¤������4���vendor/composer/class-map-generator/src/FileList.php$���c$��hôSq¤������:���vendor/composer/class-map-generator/src/PhpFileCleaner.php���c��š5]¤������9���vendor/composer/class-map-generator/src/PhpFileParser.php���c��æ°zù¤���������vendor/composer/installed.phpp���cp��`ö)D¤������)���vendor/composer/metadata-minifier/LICENSE���c��½£ëǤ������:���vendor/composer/metadata-minifier/src/MetadataMinifier.phpÐ���cÐ��Â0&À¤���������vendor/composer/pcre/LICENSE���c��½£ëǤ������+���vendor/composer/pcre/src/MatchAllResult.php���c��8aÇ”¤������6���vendor/composer/pcre/src/MatchAllWithOffsetsResult.php&���c&��‹ |¤������(���vendor/composer/pcre/src/MatchResult.phpë����cë���…‘¤������3���vendor/composer/pcre/src/MatchWithOffsetsResult.phpø����cø���<»Ó¤������*���vendor/composer/pcre/src/PcreException.phpI���cI��Ìà
- 7¤������!���vendor/composer/pcre/src/Preg.phpƒ���cƒ��%¤������"���vendor/composer/pcre/src/Regex.phpã ���cã ��@�gº¤������*���vendor/composer/pcre/src/ReplaceResult.php���c��Ön0¿¤���������vendor/composer/semver/LICENSE���c��ÇSRm¤������)���vendor/composer/semver/src/Comparator.php���c��^_E“¤������/���vendor/composer/semver/src/CompilingMatcher.phpc���cc��„€¦¤������/���vendor/composer/semver/src/Constraint/Bound.phpw���cw��W4]W¤������4���vendor/composer/semver/src/Constraint/Constraint.phpø���cø��’‹ˆ½¤������=���vendor/composer/semver/src/Constraint/ConstraintInterface.php¡���c¡��Ž5´y¤������<���vendor/composer/semver/src/Constraint/MatchAllConstraint.php¯���c¯��²Eú¤������=���vendor/composer/semver/src/Constraint/MatchNoneConstraint.phpÉ���cÉ��֯خ¤������9���vendor/composer/semver/src/Constraint/MultiConstraint.phpŠ���cŠ��ÍÕĤ������'���vendor/composer/semver/src/Interval.phpæ���cæ��=[i¤������(���vendor/composer/semver/src/Intervals.php¤+���c¤+��@1º«¤������%���vendor/composer/semver/src/Semver.phpù���cù��á-i¤������,���vendor/composer/semver/src/VersionParser.phpÐ,���cÐ,��ŽS«r¤������%���vendor/composer/spdx-licenses/LICENSE���c��ÇSRm¤������6���vendor/composer/spdx-licenses/res/spdx-exceptions.json¸���c¸��Â4DC¤������4���vendor/composer/spdx-licenses/res/spdx-licenses.json<Â���c<Â��=ë8¤������2���vendor/composer/spdx-licenses/src/SpdxLicenses.php{���c{��cE�¤������&���vendor/composer/xdebug-handler/LICENSE+���c+��Öã@T¤������0���vendor/composer/xdebug-handler/src/PhpConfig.php‰���c‰��gÔ�v¤������.���vendor/composer/xdebug-handler/src/Process.phpÖ���cÖ��o7¾¤������-���vendor/composer/xdebug-handler/src/Status.phpº���cº��xf17¤������4���vendor/composer/xdebug-handler/src/XdebugHandler.phpr)���cr)��8Õc6¤������(���vendor/justinrainbow/json-schema/LICENSE"���c"��|»™¤������N���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/BaseConstraint.php¡ ���c¡ ��†wÌl¤������T���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/CollectionConstraint.phpƒ
- ���cƒ
- ��ž¸=š¤������J���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/Constraint.phpÁ
���cÁ
��–PFF¤������S���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/ConstraintInterface.php¼���c¼��ÿ Qœ¤������N���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/EnumConstraint.php\���c\��_}ý¤������G���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/Factory.phpà���cà��ë’_”¤������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/FormatConstraint.phps���cs��dÞ¤������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/NumberConstraint.phpƒ ���cƒ ��e�¨¤������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/ObjectConstraint.php·���c·��%l¬ö¤������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/SchemaConstraint.php& ���c& ��78÷¬¤������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/StringConstraint.phpz���cz��ùfÅ~¤������X���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeCheck/LooseTypeCheck.phpa���ca�� qä������Y���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeCheck/StrictTypeCheck.php—���c—��4~¾ ¤������\���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeCheck/TypeCheckInterface.php‰���c‰��“µ+j¤������N���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeConstraint.php*���c*��1–4N¤������S���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/UndefinedConstraint.php,"���c,"��‰-¤������F���vendor/justinrainbow/json-schema/src/JsonSchema/Entity/JsonPointer.phpè���cè��{N–¤������P���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/ExceptionInterface.phpI����cI���%|°¤������V���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidArgumentException.php•����c•���‹àG¤������T���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidConfigException.phpl����cl���A!Lפ������T���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidSchemaException.phpl����cl���è2÷þ¤������]���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidSchemaMediaTypeException.phpu����cu���=hç¤������W���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidSourceUriException.phpw����cw���N-ò[¤������S���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/JsonDecodingException.phpÞ���cÞ��\¸
- ¤������W���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/ResourceNotFoundException.phpo����co���píÛù¤������N���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/RuntimeException.php…����c…���%…—¤������^���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/UnresolvableJsonPointerException.php€����c€���u-#1¤������R���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/UriResolverException.phpj����cj���å>�¤������Q���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/ValidationException.phpf����cf���¬¤„þ¤������K���vendor/justinrainbow/json-schema/src/JsonSchema/Iterator/ObjectIterator.phpþ���cþ��M�„õ¤������;���vendor/justinrainbow/json-schema/src/JsonSchema/Rfc3339.php ���c ��f4÷³¤������A���vendor/justinrainbow/json-schema/src/JsonSchema/SchemaStorage.php“
���c“
��&zß^¤������J���vendor/justinrainbow/json-schema/src/JsonSchema/SchemaStorageInterface.php���c��oŠ+}¤������T���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/AbstractRetriever.phpá����cá���[þA�¤������G���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/Curl.php£���c£��Ç’ô¦¤������R���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/FileGetContents.php ���c ��£Á¤������R���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/PredefinedArray.php,���c,��1•5þ¤������X���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/UriRetrieverInterface.php®����c®���ÿ‹Áå¤������C���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/UriResolver.php���c��æP¤������D���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/UriRetriever.php@���c@��5Î3¤������H���vendor/justinrainbow/json-schema/src/JsonSchema/UriResolverInterface.phpƒ����cƒ���J€¤������I���vendor/justinrainbow/json-schema/src/JsonSchema/UriRetrieverInterface.php…����c…���íæe¤������=���vendor/justinrainbow/json-schema/src/JsonSchema/Validator.phps���cs��ßÁ‘#¤���������vendor/psr/container/LICENSE{���c{��ÕÓ�e¤������8���vendor/psr/container/src/ContainerExceptionInterface.phpN����cN���üLƒ¤������/���vendor/psr/container/src/ContainerInterface.php·����c·���Šã¼¤������7���vendor/psr/container/src/NotFoundExceptionInterface.phpq����cq���Rúõ¤���������vendor/psr/log/LICENSE?���c?��„ù ¤������)���vendor/psr/log/Psr/Log/AbstractLogger.php;���c;��ñ>3[¤������3���vendor/psr/log/Psr/Log/InvalidArgumentException.php`����c`��� ˆX1¤������#���vendor/psr/log/Psr/Log/LogLevel.phpû����cû���jðñ8¤������/���vendor/psr/log/Psr/Log/LoggerAwareInterface.php|����c|���$£ˆ¤������+���vendor/psr/log/Psr/Log/LoggerAwareTrait.php§����c§���T½úB¤������*���vendor/psr/log/Psr/Log/LoggerInterface.phpÈ���cÈ��šx¤������&���vendor/psr/log/Psr/Log/LoggerTrait.phpk���ck��£}‰’¤������%���vendor/psr/log/Psr/Log/NullLogger.phpŸ����cŸ����Xóª¤������)���vendor/psr/log/Psr/Log/Test/DummyTest.phpp����cp���Τ������3���vendor/psr/log/Psr/Log/Test/LoggerInterfaceTest.php
���c
��$/Ò¤������*���vendor/psr/log/Psr/Log/Test/TestLogger.php<���c<��þ(åI¤���������vendor/react/promise/LICENSEi���ci��3}‹¤������8���vendor/react/promise/src/CancellablePromiseInterface.php‡����c‡���'¥î¤������.���vendor/react/promise/src/CancellationQueue.php9���c9��\Úo|¤������%���vendor/react/promise/src/Deferred.phpî���cî��E¤)¤������6���vendor/react/promise/src/Exception/LengthException.php^����c^���?q¤������5���vendor/react/promise/src/ExtendedPromiseInterface.phpÀ���cÀ��2U·û¤������-���vendor/react/promise/src/FulfilledPromise.php•���c•��2²–¤������(���vendor/react/promise/src/LazyPromise.php(���c(��>!‘k¤������$���vendor/react/promise/src/Promise.phpÁ���cÁ��
- ncï¤������-���vendor/react/promise/src/PromiseInterface.phpÏ����cÏ���AŒƒ¤������.���vendor/react/promise/src/PromisorInterface.phpa����ca���¬É™–¤������,���vendor/react/promise/src/RejectedPromise.php¢���c¢��·‹R¤������8���vendor/react/promise/src/UnhandledRejectionException.phpù���cù��sPç¤������&���vendor/react/promise/src/functions.php9���c9��™ÏŸ„¤������.���vendor/react/promise/src/functions_include.php]����c]���QÑ<¡¤���������vendor/seld/jsonlint/LICENSE$���c$��4:‡~¤������@���vendor/seld/jsonlint/src/Seld/JsonLint/DuplicateKeyException.php}���c}��Û…Dê¤������5���vendor/seld/jsonlint/src/Seld/JsonLint/JsonParser.phpÝ4���cÝ4��ñ€—¾¤������0���vendor/seld/jsonlint/src/Seld/JsonLint/Lexer.php¾���c¾��A`¬;¤������;���vendor/seld/jsonlint/src/Seld/JsonLint/ParsingException.php(���c(��>Ûv}¤������4���vendor/seld/jsonlint/src/Seld/JsonLint/Undefined.php>����c>���ÿqŸŸ¤���������vendor/seld/phar-utils/LICENSE$���c$��š,M§¤������%���vendor/seld/phar-utils/src/Linter.phpi���ci�� �Þ¤������)���vendor/seld/phar-utils/src/Timestamps.phpÈ���cÈ��ÿ4©¤������"���vendor/seld/signal-handler/LICENSE$���c$��š,M§¤������0���vendor/seld/signal-handler/src/SignalHandler.php°���c°����
- ¤������&���vendor/symfony/console/Application.phpcp���ccp��$ñuɤ������.���vendor/symfony/console/Attribute/AsCommand.phpÔ���cÔ��½3Üþ¤������2���vendor/symfony/console/CI/GithubActionReporter.phpé���cé��’5¤������ ���vendor/symfony/console/Color.phph���ch��Gbç—¤������*���vendor/symfony/console/Command/Command.phpF'���cF'��û¹þ¤������2���vendor/symfony/console/Command/CompleteCommand.php£���c£�� 쩤������8���vendor/symfony/console/Command/DumpCompletionCommand.php ���c ��Xw6¤������.���vendor/symfony/console/Command/HelpCommand.php ���c ��}—¥¤������.���vendor/symfony/console/Command/LazyCommand.php˜���c˜��ä~¤������.���vendor/symfony/console/Command/ListCommand.php1 ���c1 ��$D»|¤������0���vendor/symfony/console/Command/LockableTrait.php���c��.ºV¤������=���vendor/symfony/console/Command/SignalableCommandInterface.phpÓ����cÓ���»B`¾¤������?���vendor/symfony/console/CommandLoader/CommandLoaderInterface.phpQ���cQ��›žH¤������?���vendor/symfony/console/CommandLoader/ContainerCommandLoader.phpU���cU��Ë_ü¤������=���vendor/symfony/console/CommandLoader/FactoryCommandLoader.php¯���c¯��d¼"z¤������5���vendor/symfony/console/Completion/CompletionInput.php���c��”$„k¤������;���vendor/symfony/console/Completion/CompletionSuggestions.phpÂ���cÂ��A¡¤������A���vendor/symfony/console/Completion/Output/BashCompletionOutput.phpg���cg��‡ìùW¤������F���vendor/symfony/console/Completion/Output/CompletionOutputInterface.phpF���cF��Ô2nM¤������0���vendor/symfony/console/Completion/Suggestion.php3���c3��̆ ¤������(���vendor/symfony/console/ConsoleEvents.phpÕ���cÕ���gw]¤������!���vendor/symfony/console/Cursor.php� ���c� ��Æ«§Ž¤������D���vendor/symfony/console/DependencyInjection/AddConsoleCommandPass.phpf���cf��#Ô $¤������<���vendor/symfony/console/Descriptor/ApplicationDescription.phpÊ ���cÊ ��ïgöª¤������0���vendor/symfony/console/Descriptor/Descriptor.php}���c}��±ê3^¤������9���vendor/symfony/console/Descriptor/DescriptorInterface.php÷����c÷���µå@à¤������4���vendor/symfony/console/Descriptor/JsonDescriptor.phpë���cë��1%è�¤������8���vendor/symfony/console/Descriptor/MarkdownDescriptor.phpQ���cQ��t ˆv¤������4���vendor/symfony/console/Descriptor/TextDescriptor.phpç"���cç"��ȸÌˤ������3���vendor/symfony/console/Descriptor/XmlDescriptor.php���c��‡¶¤������4���vendor/symfony/console/Event/ConsoleCommandEvent.phpÆ���cÆ�� ¼O~¤������2���vendor/symfony/console/Event/ConsoleErrorEvent.phpü���cü��À©–²¤������-���vendor/symfony/console/Event/ConsoleEvent.phpÆ���cÆ��ÅoÛÙ¤������3���vendor/symfony/console/Event/ConsoleSignalEvent.phpG���cG��Žû¤������6���vendor/symfony/console/Event/ConsoleTerminateEvent.php~���c~��hr½Ö¤������6���vendor/symfony/console/EventListener/ErrorListener.php&���c&��Xö뮤������=���vendor/symfony/console/Exception/CommandNotFoundException.phpÚ���cÚ��ˆwêí¤������7���vendor/symfony/console/Exception/ExceptionInterface.phpy����cy���Ù9[&¤������=���vendor/symfony/console/Exception/InvalidArgumentException.php¦����c¦���Ö̽Z¤������;���vendor/symfony/console/Exception/InvalidOptionException.php¦����c¦���Ë×H¤������3���vendor/symfony/console/Exception/LogicException.php’����c’���ÍO\e¤������:���vendor/symfony/console/Exception/MissingInputException.phpœ����cœ���æS
- þ¤������?���vendor/symfony/console/Exception/NamespaceNotFoundException.php‹����c‹���‚ón©¤������5���vendor/symfony/console/Exception/RuntimeException.php–����c–���Ùí,6¤������8���vendor/symfony/console/Formatter/NullOutputFormatter.php����c���!&
u¤������=���vendor/symfony/console/Formatter/NullOutputFormatterStyle.php
- ���c
- ��ÔÇ%h¤������4���vendor/symfony/console/Formatter/OutputFormatter.php����c���¹ØB“¤������=���vendor/symfony/console/Formatter/OutputFormatterInterface.php£���c£��Y §ß¤������9���vendor/symfony/console/Formatter/OutputFormatterStyle.phpH���cH��‘õ2b¤������B���vendor/symfony/console/Formatter/OutputFormatterStyleInterface.php����c���ÌZä������>���vendor/symfony/console/Formatter/OutputFormatterStyleStack.phpƒ���cƒ��F—x±¤������F���vendor/symfony/console/Formatter/WrappableOutputFormatterInterface.phpÖ����cÖ���¡Z·¤������6���vendor/symfony/console/Helper/DebugFormatterHelper.php¸���c¸��¤ð6 ¤������2���vendor/symfony/console/Helper/DescriptorHelper.phpÀ���cÀ��¦gÌ„¤������(���vendor/symfony/console/Helper/Dumper.php���c��þÒܽ¤������1���vendor/symfony/console/Helper/FormatterHelper.phpi���ci��¤¶€w¤������(���vendor/symfony/console/Helper/Helper.php9���c9��;Sä¤������1���vendor/symfony/console/Helper/HelperInterface.phpå����cå���Š ¤������+���vendor/symfony/console/Helper/HelperSet.phpG���cG��›ÝË�¤������2���vendor/symfony/console/Helper/InputAwareHelper.phpc���cc��Ìøƒ¤������/���vendor/symfony/console/Helper/ProcessHelper.phpW���cW��eÂÑ
¤������-���vendor/symfony/console/Helper/ProgressBar.phpg/���cg/��w1´¤������3���vendor/symfony/console/Helper/ProgressIndicator.phpÀ���cÀ��‘=ÞÖ¤������0���vendor/symfony/console/Helper/QuestionHelper.phpÞ-���cÞ-���n†¤������7���vendor/symfony/console/Helper/SymfonyQuestionHelper.php ���c ��à�dÿ¤������'���vendor/symfony/console/Helper/Table.php7J���c7J��Lì¨Ë¤������+���vendor/symfony/console/Helper/TableCell.phpA���cA��èÓ ¤������0���vendor/symfony/console/Helper/TableCellStyle.phpî���cî��Ñ�¹_¤������+���vendor/symfony/console/Helper/TableRows.php)���c)��WŠ3z¤������0���vendor/symfony/console/Helper/TableSeparator.phpÅ����cÅ���¼õËü¤������,���vendor/symfony/console/Helper/TableStyle.phpˆ���cˆ��¥Ö¤������*���vendor/symfony/console/Input/ArgvInput.php)���c)��Àd£ï¤������+���vendor/symfony/console/Input/ArrayInput.php
���c
�� $©¤������&���vendor/symfony/console/Input/Input.php£
���c£
��ë1¤������.���vendor/symfony/console/Input/InputArgument.php���c��„Ý&¤������4���vendor/symfony/console/Input/InputAwareInterface.php˜����c˜���O°¤������0���vendor/symfony/console/Input/InputDefinition.php#���c#�� Œ!3¤������/���vendor/symfony/console/Input/InputInterface.phpü���cü��G¶ô¨¤������,���vendor/symfony/console/Input/InputOption.phpç
���cç
��¾ùB@¤������9���vendor/symfony/console/Input/StreamableInputInterface.phpÎ����cÎ���ÖÕB›¤������,���vendor/symfony/console/Input/StringInput.php?���c?��±’ˤ���������vendor/symfony/console/LICENSE+���c+��‡´Ì¤������/���vendor/symfony/console/Logger/ConsoleLogger.php���c��ÇQ¤������0���vendor/symfony/console/Output/BufferedOutput.phpl���cl��y:¸¤������/���vendor/symfony/console/Output/ConsoleOutput.php� ���c� ��Âܤ������8���vendor/symfony/console/Output/ConsoleOutputInterface.php���c��‰ê÷´¤������6���vendor/symfony/console/Output/ConsoleSectionOutput.php“ ���c“ ��OÖ0ɤ������,���vendor/symfony/console/Output/NullOutput.phpB���cB��%#RƤ������(���vendor/symfony/console/Output/Output.phpÇ ���cÇ �� C,°¤������1���vendor/symfony/console/Output/OutputInterface.phpí���cí��ðŽ¾¤������.���vendor/symfony/console/Output/StreamOutput.php§���c§��1Xòƒ¤������5���vendor/symfony/console/Output/TrimmedBufferOutput.phpÚ���cÚ��űí¤������2���vendor/symfony/console/Question/ChoiceQuestion.phpÝ
- ���cÝ
- �� c䦤������8���vendor/symfony/console/Question/ConfirmationQuestion.php���c��îyÅ„¤������,���vendor/symfony/console/Question/Question.php
���c
��µ�µT¤������4���vendor/symfony/console/Resources/bin/hiddeninput.exe�$���c�$��•�¥v¤������0���vendor/symfony/console/Resources/completion.bashX
- ���cX
- ��ýbm
- ¤������8���vendor/symfony/console/SignalRegistry/SignalRegistry.php!���c!��~.:¯¤������3���vendor/symfony/console/SingleCommandApplication.php5���c5��Â⢤������,���vendor/symfony/console/Style/OutputStyle.phpt���ct��O;Ƥ������/���vendor/symfony/console/Style/StyleInterface.php
���c
��Ý¡ˆ¤������-���vendor/symfony/console/Style/SymfonyStyle.php-'���c-'���½À¿¤������#���vendor/symfony/console/Terminal.phpÃ
- ���cÃ
- ��gÂ}ؤ������3���vendor/symfony/console/Tester/ApplicationTester.phpŒ���cŒ��Iû¤������9���vendor/symfony/console/Tester/CommandCompletionTester.phpÚ���cÚ��Ê›;°¤������/���vendor/symfony/console/Tester/CommandTester.phpÙ���cÙ��D¶¤������@���vendor/symfony/console/Tester/Constraint/CommandIsSuccessful.phpÖ���cÖ��ƃ‚¤������-���vendor/symfony/console/Tester/TesterTrait.php¬
���c¬
��2'L²¤������,���vendor/symfony/deprecation-contracts/LICENSE+���c+��†vù±¤������1���vendor/symfony/deprecation-contracts/function.php=���c=��žÁ´
¤������:���vendor/symfony/filesystem/Exception/ExceptionInterface.php|����c|����éD¤������=���vendor/symfony/filesystem/Exception/FileNotFoundException.phpÎ���cÎ��&�ò—¤������3���vendor/symfony/filesystem/Exception/IOException.php™���c™��¯à\Τ������<���vendor/symfony/filesystem/Exception/IOExceptionInterface.php¦����c¦���jÙwM¤������@���vendor/symfony/filesystem/Exception/InvalidArgumentException.php©����c©����!Ǥ������8���vendor/symfony/filesystem/Exception/RuntimeException.php™����c™���ÝUUH¤������(���vendor/symfony/filesystem/Filesystem.php½@���c½@��)ô6b¤������!���vendor/symfony/filesystem/LICENSE+���c+��‡´Ì¤������"���vendor/symfony/filesystem/Path.php '���c '��¨:6=¤������/���vendor/symfony/finder/Comparator/Comparator.php3���c3��¿Èh¤������3���vendor/symfony/finder/Comparator/DateComparator.php���c��Ï%úe¤������5���vendor/symfony/finder/Comparator/NumberComparator.phpz���cz��+¼�h¤������9���vendor/symfony/finder/Exception/AccessDeniedException.php„����c„���½¾sœ¤������>���vendor/symfony/finder/Exception/DirectoryNotFoundException.php‰����c‰���a)ÿ¤������ ���vendor/symfony/finder/Finder.phpÖ'���cÖ'��Ž?ä¤������#���vendor/symfony/finder/Gitignore.php³���c³��s 4¤���������vendor/symfony/finder/Glob.phpÇ���cÇ��Db‡³¤������7���vendor/symfony/finder/Iterator/CustomFilterIterator.phpc���cc��7ð™¤������:���vendor/symfony/finder/Iterator/DateRangeFilterIterator.php����c���Pšs¤������;���vendor/symfony/finder/Iterator/DepthRangeFilterIterator.php���c��§Ž¤������A���vendor/symfony/finder/Iterator/ExcludeDirectoryFilterIterator.php/���c/��ÙnÃ<¤������9���vendor/symfony/finder/Iterator/FileTypeFilterIterator.phpˆ���cˆ��^¶"û¤������<���vendor/symfony/finder/Iterator/FilecontentFilterIterator.phpW���cW��ÂÅÙ¤������9���vendor/symfony/finder/Iterator/FilenameFilterIterator.php”���c”��=™Üô¤������/���vendor/symfony/finder/Iterator/LazyIterator.phpQ���cQ��n]¿¼¤������=���vendor/symfony/finder/Iterator/MultiplePcreFilterIterator.php����c���¢€×¤������5���vendor/symfony/finder/Iterator/PathFilterIterator.phpò���cò��g"_¤������=���vendor/symfony/finder/Iterator/RecursiveDirectoryIterator.php¹ ���c¹ ��¨•v2¤������:���vendor/symfony/finder/Iterator/SizeRangeFilterIterator.php|���c|��3ÙŸ¤������3���vendor/symfony/finder/Iterator/SortableIterator.php(
- ���c(
- ��Ó⮤������;���vendor/symfony/finder/Iterator/VcsIgnoredFilterIterator.phpw
- ���cw
- ��ŵ3¤���������vendor/symfony/finder/LICENSE+���c+��‡´Ì¤������%���vendor/symfony/finder/SplFileInfo.php½���c½��y¤������'���vendor/symfony/polyfill-ctype/Ctype.php‡
- ���c‡
- ��~¶d¸¤������%���vendor/symfony/polyfill-ctype/LICENSE+���c+��…»E:¤������+���vendor/symfony/polyfill-ctype/bootstrap.php2���c2��Èa8¤������-���vendor/symfony/polyfill-ctype/bootstrap80.phph���ch��K¿y¸¤������2���vendor/symfony/polyfill-intl-grapheme/Grapheme.phpÙ���cÙ��Ì»9§¤������-���vendor/symfony/polyfill-intl-grapheme/LICENSE+���c+��øÛ{¤������3���vendor/symfony/polyfill-intl-grapheme/bootstrap.phpÏ���cÏ��ý9À|¤������5���vendor/symfony/polyfill-intl-grapheme/bootstrap80.phpY ���cY ��¨! ¤������/���vendor/symfony/polyfill-intl-normalizer/LICENSE+���c+��øÛ{¤������6���vendor/symfony/polyfill-intl-normalizer/Normalizer.phpõ���cõ��b©"q¤������F���vendor/symfony/polyfill-intl-normalizer/Resources/stubs/Normalizer.php.���c.��Qs$—¤������R���vendor/symfony/polyfill-intl-normalizer/Resources/unidata/canonicalComposition.php‰=���c‰=��*ïo?¤������T���vendor/symfony/polyfill-intl-normalizer/Resources/unidata/canonicalDecomposition.phpaˆ���caˆ��çR½}¤������L���vendor/symfony/polyfill-intl-normalizer/Resources/unidata/combiningClass.phpt.���ct.��q�ܤ������X���vendor/symfony/polyfill-intl-normalizer/Resources/unidata/compatibilityDecomposition.php™è���c™è��o”e)¤������5���vendor/symfony/polyfill-intl-normalizer/bootstrap.phpë���cë��Pú£D¤������7���vendor/symfony/polyfill-intl-normalizer/bootstrap80.phpé���cé��=år´¤������(���vendor/symfony/polyfill-mbstring/LICENSE+���c+��øÛ{¤������-���vendor/symfony/polyfill-mbstring/Mbstring.phptJ���ctJ���ÚŸV¤������@���vendor/symfony/polyfill-mbstring/Resources/unidata/lowerCase.phpùT���cùT��•±+¤������F���vendor/symfony/polyfill-mbstring/Resources/unidata/titleCaseRegexp.phpã���cã��öy_•¤������@���vendor/symfony/polyfill-mbstring/Resources/unidata/upperCase.php8[���c8[��+RØ*¤������.���vendor/symfony/polyfill-mbstring/bootstrap.php»���c»��NZ^¤������0���vendor/symfony/polyfill-mbstring/bootstrap80.phpÊ ���cÊ ��D›
פ������%���vendor/symfony/polyfill-php73/LICENSE+���c+��…»E:¤������'���vendor/symfony/polyfill-php73/Php73.phpn���cn��Cs¥l¤������?���vendor/symfony/polyfill-php73/Resources/stubs/JsonException.php[����c[���M²Ü¤������+���vendor/symfony/polyfill-php73/bootstrap.phpù���cù��AY8Ƥ������%���vendor/symfony/polyfill-php80/LICENSE&���c&��þz)¤������'���vendor/symfony/polyfill-php80/Php80.php¡ ���c¡ ��[Âk¤������*���vendor/symfony/polyfill-php80/PhpToken.php���c��M£�I¤������;���vendor/symfony/polyfill-php80/Resources/stubs/Attribute.php¾���c¾��¿ÜФ������:���vendor/symfony/polyfill-php80/Resources/stubs/PhpToken.php…����c…���}ÈGG¤������<���vendor/symfony/polyfill-php80/Resources/stubs/Stringable.phpb����cb���ÃÑ›<¤������E���vendor/symfony/polyfill-php80/Resources/stubs/UnhandledMatchError.phpT����cT���ŠÓOõ¤������<���vendor/symfony/polyfill-php80/Resources/stubs/ValueError.phpK����cK���Š²ì¤������+���vendor/symfony/polyfill-php80/bootstrap.phpú���cú��×îå¤������7���vendor/symfony/process/Exception/ExceptionInterface.phpy����cy���qVXJ¤������=���vendor/symfony/process/Exception/InvalidArgumentException.php¨����c¨���ÐÀ+_¤������3���vendor/symfony/process/Exception/LogicException.php”����c”��� ³ãñ¤������;���vendor/symfony/process/Exception/ProcessFailedException.phpx���cx��¨Ìzy¤������=���vendor/symfony/process/Exception/ProcessSignaledException.php���c��Yשâ¤������=���vendor/symfony/process/Exception/ProcessTimedOutException.php1���c1��‚'Z¤������5���vendor/symfony/process/Exception/RuntimeException.php˜����c˜���¢Ø:¤������+���vendor/symfony/process/ExecutableFinder.php¹���c¹��“„�=¤������&���vendor/symfony/process/InputStream.php/���c/��¦¹e‡¤���������vendor/symfony/process/LICENSE+���c+��‡´Ì¤������.���vendor/symfony/process/PhpExecutableFinder.phpž���cž��Ä9Ïe¤������%���vendor/symfony/process/PhpProcess.phpò���cò��’sÿ¤������.���vendor/symfony/process/Pipes/AbstractPipes.php���c��kSQ¤������/���vendor/symfony/process/Pipes/PipesInterface.php™���c™��fQÚ¤������*���vendor/symfony/process/Pipes/UnixPipes.php€���c€��¾”Vv¤������-���vendor/symfony/process/Pipes/WindowsPipes.php,
���c,
��xQjä������"���vendor/symfony/process/Process.phpõe���cõe��)�÷¤������'���vendor/symfony/process/ProcessUtils.php���c��ÓXì¤������7���vendor/symfony/service-contracts/Attribute/Required.php¨����c¨���xj네������@���vendor/symfony/service-contracts/Attribute/SubscribedService.php
- ���c
- ��1I®T¤������(���vendor/symfony/service-contracts/LICENSE+���c+��JˆE ¤������3���vendor/symfony/service-contracts/ResetInterface.phpy����cy���°·jå¤������8���vendor/symfony/service-contracts/ServiceLocatorTrait.phpã ���cã ��"�5é¤������=���vendor/symfony/service-contracts/ServiceProviderInterface.phpÞ����cÞ���úRèk¤������?���vendor/symfony/service-contracts/ServiceSubscriberInterface.php³����c³���—öd¤������;���vendor/symfony/service-contracts/ServiceSubscriberTrait.phpS
- ���cS
- ��ªë4£¤������<���vendor/symfony/service-contracts/Test/ServiceLocatorTest.php˜���c˜��W7|G¤������(���vendor/symfony/string/AbstractString.phpŒ3���cŒ3��5>‹Ž¤������/���vendor/symfony/string/AbstractUnicodeString.phpÜR���cÜR�� Uœ¤������$���vendor/symfony/string/ByteString.php‹+���c‹+��Áü›¤������)���vendor/symfony/string/CodePointString.phpñ���cñ��Ÿ;3ˤ������6���vendor/symfony/string/Exception/ExceptionInterface.phps����cs���qHV‘¤������<���vendor/symfony/string/Exception/InvalidArgumentException.php¢����c¢���¥A¤������4���vendor/symfony/string/Exception/RuntimeException.php’����c’���u‘g¤������4���vendor/symfony/string/Inflector/EnglishInflector.phpù���cù��…3§d¤������3���vendor/symfony/string/Inflector/FrenchInflector.phpˆ
- ���cˆ
- ��·ŠH¤������6���vendor/symfony/string/Inflector/InflectorInterface.php×����c×���hD£¤���������vendor/symfony/string/LICENSE+���c+��½ý®¤������$���vendor/symfony/string/LazyString.php���c��(ÛÜL¤������<���vendor/symfony/string/Resources/data/wcswidth_table_wide.php^���c^��%¯o)¤������<���vendor/symfony/string/Resources/data/wcswidth_table_zero.php?���c?��&^¿}¤������-���vendor/symfony/string/Resources/functions.php���c��cÚª"¤������.���vendor/symfony/string/Slugger/AsciiSlugger.phpê���cê��×Ú3¤������2���vendor/symfony/string/Slugger/SluggerInterface.php���c��÷¯Q¤������'���vendor/symfony/string/UnicodeString.phpè%���cè%��Ùóפ���������bin/composerd���cd��qÙ¤���������LICENSE.���c.�� Õ¤������<?php declare(strict_types=1);
- namespace Composer\Advisory;
- use Composer\IO\ConsoleIO;
- use Composer\IO\IOInterface;
- use Composer\Json\JsonFile;
- use Composer\Package\PackageInterface;
- use Composer\Repository\RepositorySet;
- use InvalidArgumentException;
- use Symfony\Component\Console\Formatter\OutputFormatter;
- class Auditor
- {
- public const FORMAT_TABLE = 'table';
- public const FORMAT_PLAIN = 'plain';
- public const FORMAT_JSON = 'json';
- public const FORMAT_SUMMARY = 'summary';
- public const FORMATS = [
- self::FORMAT_TABLE,
- self::FORMAT_PLAIN,
- self::FORMAT_JSON,
- self::FORMAT_SUMMARY,
- ];
- public function audit(IOInterface $io, RepositorySet $repoSet, array $packages, string $format, bool $warningOnly = true): int
- {
- $advisories = $repoSet->getMatchingSecurityAdvisories($packages, $format === self::FORMAT_SUMMARY);
- if (self::FORMAT_JSON === $format) {
- $io->write(JsonFile::encode(['advisories' => $advisories]));
- return count($advisories);
- }
- $errorOrWarn = $warningOnly ? 'warning' : 'error';
- if (count($advisories) > 0) {
- [$affectedPackages, $totalAdvisories] = $this->countAdvisories($advisories);
- $plurality = $totalAdvisories === 1 ? 'y' : 'ies';
- $pkgPlurality = $affectedPackages === 1 ? '' : 's';
- $punctuation = $format === 'summary' ? '.' : ':';
- $io->writeError("<$errorOrWarn>Found $totalAdvisories security vulnerability advisor{$plurality} affecting $affectedPackages package{$pkgPlurality}{$punctuation}</$errorOrWarn>");
- $this->outputAdvisories($io, $advisories, $format);
- return $affectedPackages;
- }
- $io->writeError('<info>No security vulnerability advisories found</info>');
- return 0;
- }
- private function countAdvisories(array $advisories): array
- {
- $count = 0;
- foreach ($advisories as $packageAdvisories) {
- $count += count($packageAdvisories);
- }
- return [count($advisories), $count];
- }
- private function outputAdvisories(IOInterface $io, array $advisories, string $format): void
- {
- switch ($format) {
- case self::FORMAT_TABLE:
- if (!($io instanceof ConsoleIO)) {
- throw new InvalidArgumentException('Cannot use table format with ' . get_class($io));
- }
- $this->outputAvisoriesTable($io, $advisories);
- return;
- case self::FORMAT_PLAIN:
- $this->outputAdvisoriesPlain($io, $advisories);
- return;
- case self::FORMAT_SUMMARY:
- $io->writeError('Run composer audit for a full list of advisories.');
- return;
- default:
- throw new InvalidArgumentException('Invalid format "'.$format.'".');
- }
- }
- private function outputAvisoriesTable(ConsoleIO $io, array $advisories): void
- {
- foreach ($advisories as $packageAdvisories) {
- foreach ($packageAdvisories as $advisory) {
- $io->getTable()
- ->setHorizontal()
- ->setHeaders([
- 'Package',
- 'CVE',
- 'Title',
- 'URL',
- 'Affected versions',
- 'Reported at',
- ])
- ->addRow([
- $advisory->packageName,
- $this->getCVE($advisory),
- $advisory->title,
- $this->getURL($advisory),
- $advisory->affectedVersions->getPrettyString(),
- $advisory->reportedAt->format(DATE_ATOM),
- ])
- ->setColumnWidth(1, 80)
- ->setColumnMaxWidth(1, 80)
- ->render();
- }
- }
- }
- private function outputAdvisoriesPlain(IOInterface $io, array $advisories): void
- {
- $error = [];
- $firstAdvisory = true;
- foreach ($advisories as $packageAdvisories) {
- foreach ($packageAdvisories as $advisory) {
- if (!$firstAdvisory) {
- $error[] = '--------';
- }
- $error[] = "Package: ".$advisory->packageName;
- $error[] = "CVE: ".$this->getCVE($advisory);
- $error[] = "Title: ".OutputFormatter::escape($advisory->title);
- $error[] = "URL: ".$this->getURL($advisory);
- $error[] = "Affected versions: ".OutputFormatter::escape($advisory->affectedVersions->getPrettyString());
- $error[] = "Reported at: ".$advisory->reportedAt->format(DATE_ATOM);
- $firstAdvisory = false;
- }
- }
- $io->writeError($error);
- }
- private function getCVE(SecurityAdvisory $advisory): string
- {
- if ($advisory->cve === null) {
- return 'NO CVE';
- }
- return '<href=https://cve.mitre.org/cgi-bin/cvename.cgi?name='.$advisory->cve.'>'.$advisory->cve.'</>';
- }
- private function getURL(SecurityAdvisory $advisory): string
- {
- if ($advisory->link === null) {
- return '';
- }
- return '<href='.OutputFormatter::escape($advisory->link).'>'.OutputFormatter::escape($advisory->link).'</>';
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Advisory;
- use Composer\Semver\Constraint\ConstraintInterface;
- use Composer\Semver\VersionParser;
- class PartialSecurityAdvisory
- {
- public $advisoryId;
- public $packageName;
- public $affectedVersions;
- public static function create(string $packageName, array $data, VersionParser $parser): self
- {
- $constraint = $parser->parseConstraints($data['affectedVersions']);
- if (isset($data['title'], $data['sources'], $data['reportedAt'])) {
- return new SecurityAdvisory($packageName, $data['advisoryId'], $constraint, $data['title'], $data['sources'], new \DateTimeImmutable($data['reportedAt'], new \DateTimeZone('UTC')), $data['cve'] ?? null, $data['link'] ?? null);
- }
- return new self($packageName, $data['advisoryId'], $constraint);
- }
- public function __construct(string $packageName, string $advisoryId, ConstraintInterface $affectedVersions)
- {
- $this->advisoryId = $advisoryId;
- $this->packageName = $packageName;
- $this->affectedVersions = $affectedVersions;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Advisory;
- use Composer\Semver\Constraint\ConstraintInterface;
- use DateTimeImmutable;
- class SecurityAdvisory extends PartialSecurityAdvisory
- {
- public $title;
- public $cve;
- public $link;
- public $reportedAt;
- public $sources;
- public function __construct(string $packageName, string $advisoryId, ConstraintInterface $affectedVersions, string $title, array $sources, DateTimeImmutable $reportedAt, ?string $cve = null, ?string $link = null)
- {
- parent::__construct($packageName, $advisoryId, $affectedVersions);
- $this->title = $title;
- $this->sources = $sources;
- $this->reportedAt = $reportedAt;
- $this->cve = $cve;
- $this->link = $link;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Autoload;
- use Composer\ClassMapGenerator\ClassMap;
- use Composer\ClassMapGenerator\ClassMapGenerator;
- use Composer\Config;
- use Composer\EventDispatcher\EventDispatcher;
- use Composer\Filter\PlatformRequirementFilter\IgnoreAllPlatformRequirementFilter;
- use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterFactory;
- use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterInterface;
- use Composer\Installer\InstallationManager;
- use Composer\IO\IOInterface;
- use Composer\IO\NullIO;
- use Composer\Package\AliasPackage;
- use Composer\Package\PackageInterface;
- use Composer\Package\RootPackageInterface;
- use Composer\Pcre\Preg;
- use Composer\Repository\InstalledRepositoryInterface;
- use Composer\Semver\Constraint\Bound;
- use Composer\Util\Filesystem;
- use Composer\Util\Platform;
- use Composer\Script\ScriptEvents;
- use Composer\Util\PackageSorter;
- use Composer\Json\JsonFile;
- class AutoloadGenerator
- {
- private $eventDispatcher;
- private $io;
- private $devMode = null;
- private $classMapAuthoritative = false;
- private $apcu = false;
- private $apcuPrefix;
- private $runScripts = false;
- private $platformRequirementFilter;
- public function __construct(EventDispatcher $eventDispatcher, ?IOInterface $io = null)
- {
- $this->eventDispatcher = $eventDispatcher;
- $this->io = $io ?? new NullIO();
- $this->platformRequirementFilter = PlatformRequirementFilterFactory::ignoreNothing();
- }
- public function setDevMode(bool $devMode = true)
- {
- $this->devMode = $devMode;
- }
- public function setClassMapAuthoritative(bool $classMapAuthoritative)
- {
- $this->classMapAuthoritative = $classMapAuthoritative;
- }
- public function setApcu(bool $apcu, ?string $apcuPrefix = null)
- {
- $this->apcu = $apcu;
- $this->apcuPrefix = $apcuPrefix !== null ? $apcuPrefix : $apcuPrefix;
- }
- public function setRunScripts(bool $runScripts = true)
- {
- $this->runScripts = $runScripts;
- }
- public function setIgnorePlatformRequirements($ignorePlatformReqs)
- {
- trigger_error('AutoloadGenerator::setIgnorePlatformRequirements is deprecated since Composer 2.2, use setPlatformRequirementFilter instead.', E_USER_DEPRECATED);
- $this->setPlatformRequirementFilter(PlatformRequirementFilterFactory::fromBoolOrList($ignorePlatformReqs));
- }
- public function setPlatformRequirementFilter(PlatformRequirementFilterInterface $platformRequirementFilter)
- {
- $this->platformRequirementFilter = $platformRequirementFilter;
- }
- public function dump(Config $config, InstalledRepositoryInterface $localRepo, RootPackageInterface $rootPackage, InstallationManager $installationManager, string $targetDir, bool $scanPsrPackages = false, ?string $suffix = null)
- {
- if ($this->classMapAuthoritative) {
- $scanPsrPackages = true;
- }
- if (null === $this->devMode) {
- $this->devMode = false;
- $installedJson = new JsonFile($config->get('vendor-dir').'/composer/installed.json');
- if ($installedJson->exists()) {
- $installedJson = $installedJson->read();
- if (isset($installedJson['dev'])) {
- $this->devMode = $installedJson['dev'];
- }
- }
- }
- if ($this->runScripts) {
- if (!isset($_SERVER['COMPOSER_DEV_MODE'])) {
- Platform::putEnv('COMPOSER_DEV_MODE', $this->devMode ? '1' : '0');
- }
- $this->eventDispatcher->dispatchScript(ScriptEvents::PRE_AUTOLOAD_DUMP, $this->devMode, [], [
- 'optimize' => $scanPsrPackages,
- ]);
- }
- $classMapGenerator = new ClassMapGenerator(['php', 'inc', 'hh']);
- $classMapGenerator->avoidDuplicateScans();
- $filesystem = new Filesystem();
- $filesystem->ensureDirectoryExists($config->get('vendor-dir'));
- $basePath = $filesystem->normalizePath(realpath(realpath(Platform::getCwd())));
- $vendorPath = $filesystem->normalizePath(realpath(realpath($config->get('vendor-dir'))));
- $useGlobalIncludePath = $config->get('use-include-path');
- $prependAutoloader = $config->get('prepend-autoloader') === false ? 'false' : 'true';
- $targetDir = $vendorPath.'/'.$targetDir;
- $filesystem->ensureDirectoryExists($targetDir);
- $vendorPathCode = $filesystem->findShortestPathCode(realpath($targetDir), $vendorPath, true);
- $vendorPathToTargetDirCode = $filesystem->findShortestPathCode($vendorPath, realpath($targetDir), true);
- $appBaseDirCode = $filesystem->findShortestPathCode($vendorPath, $basePath, true);
- $appBaseDirCode = str_replace('__DIR__', '$vendorDir', $appBaseDirCode);
- $namespacesFile = <<<EOF
- <?php
- // autoload_namespaces.php @generated by Composer
- \$vendorDir = $vendorPathCode;
- \$baseDir = $appBaseDirCode;
- return array(
- EOF;
- $psr4File = <<<EOF
- <?php
- // autoload_psr4.php @generated by Composer
- \$vendorDir = $vendorPathCode;
- \$baseDir = $appBaseDirCode;
- return array(
- EOF;
- $devPackageNames = $localRepo->getDevPackageNames();
- $packageMap = $this->buildPackageMap($installationManager, $rootPackage, $localRepo->getCanonicalPackages());
- if ($this->devMode) {
- $filteredDevPackages = false;
- } else {
- $filteredDevPackages = $devPackageNames ?: true;
- }
- $autoloads = $this->parseAutoloads($packageMap, $rootPackage, $filteredDevPackages);
- foreach ($autoloads['psr-0'] as $namespace => $paths) {
- $exportedPaths = [];
- foreach ($paths as $path) {
- $exportedPaths[] = $this->getPathCode($filesystem, $basePath, $vendorPath, $path);
- }
- $exportedPrefix = var_export($namespace, true);
- $namespacesFile .= " $exportedPrefix => ";
- $namespacesFile .= "array(".implode(', ', $exportedPaths)."),\n";
- }
- $namespacesFile .= ");\n";
- foreach ($autoloads['psr-4'] as $namespace => $paths) {
- $exportedPaths = [];
- foreach ($paths as $path) {
- $exportedPaths[] = $this->getPathCode($filesystem, $basePath, $vendorPath, $path);
- }
- $exportedPrefix = var_export($namespace, true);
- $psr4File .= " $exportedPrefix => ";
- $psr4File .= "array(".implode(', ', $exportedPaths)."),\n";
- }
- $psr4File .= ");\n";
- $targetDirLoader = null;
- $mainAutoload = $rootPackage->getAutoload();
- if ($rootPackage->getTargetDir() && !empty($mainAutoload['psr-0'])) {
- $levels = substr_count($filesystem->normalizePath($rootPackage->getTargetDir()), '/') + 1;
- $prefixes = implode(', ', array_map(static function ($prefix): string {
- return var_export($prefix, true);
- }, array_keys($mainAutoload['psr-0'])));
- $baseDirFromTargetDirCode = $filesystem->findShortestPathCode($targetDir, $basePath, true);
- $targetDirLoader = <<<EOF
- public static function autoload(\$class)
- {
- \$dir = $baseDirFromTargetDirCode . '/';
- \$prefixes = array($prefixes);
- foreach (\$prefixes as \$prefix) {
- if (0 !== strpos(\$class, \$prefix)) {
- continue;
- }
- \$path = \$dir . implode('/', array_slice(explode('\\\\', \$class), $levels)).'.php';
- if (!\$path = stream_resolve_include_path(\$path)) {
- return false;
- }
- require \$path;
- return true;
- }
- }
- EOF;
- }
- $excluded = null;
- if (!empty($autoloads['exclude-from-classmap'])) {
- $excluded = $autoloads['exclude-from-classmap'];
- }
- foreach ($autoloads['classmap'] as $dir) {
- $classMapGenerator->scanPaths($dir, $this->buildExclusionRegex($dir, $excluded));
- }
- if ($scanPsrPackages) {
- $namespacesToScan = [];
- foreach (['psr-4', 'psr-0'] as $psrType) {
- foreach ($autoloads[$psrType] as $namespace => $paths) {
- $namespacesToScan[$namespace][] = ['paths' => $paths, 'type' => $psrType];
- }
- }
- krsort($namespacesToScan);
- foreach ($namespacesToScan as $namespace => $groups) {
- foreach ($groups as $group) {
- foreach ($group['paths'] as $dir) {
- $dir = $filesystem->normalizePath($filesystem->isAbsolutePath($dir) ? $dir : $basePath.'/'.$dir);
- if (!is_dir($dir)) {
- continue;
- }
- $classMapGenerator->scanPaths($dir, $this->buildExclusionRegex($dir, $excluded), $group['type'], $namespace);
- }
- }
- }
- }
- $classMap = $classMapGenerator->getClassMap();
- foreach ($classMap->getAmbiguousClasses() as $className => $ambiguousPaths) {
- if (count($ambiguousPaths) > 1) {
- $this->io->writeError(
- '<warning>Warning: Ambiguous class resolution, "'.$className.'"'.
- ' was found '. (count($ambiguousPaths) + 1) .'x: in "'.$classMap->getClassPath($className).'" and "'. implode('", "', $ambiguousPaths) .'", the first will be used.</warning>'
- );
- } else {
- $this->io->writeError(
- '<warning>Warning: Ambiguous class resolution, "'.$className.'"'.
- ' was found in both "'.$classMap->getClassPath($className).'" and "'. implode('", "', $ambiguousPaths) .'", the first will be used.</warning>'
- );
- }
- }
- foreach ($classMap->getPsrViolations() as $msg) {
- $this->io->writeError("<warning>$msg</warning>");
- }
- $classMap->addClass('Composer\InstalledVersions', $vendorPath . '/composer/InstalledVersions.php');
- $classMap->sort();
- $classmapFile = <<<EOF
- <?php
- // autoload_classmap.php @generated by Composer
- \$vendorDir = $vendorPathCode;
- \$baseDir = $appBaseDirCode;
- return array(
- EOF;
- foreach ($classMap->getMap() as $className => $path) {
- $pathCode = $this->getPathCode($filesystem, $basePath, $vendorPath, $path).",\n";
- $classmapFile .= ' '.var_export($className, true).' => '.$pathCode;
- }
- $classmapFile .= ");\n";
- if ('' === $suffix) {
- $suffix = null;
- }
- if (null === $suffix) {
- $suffix = $config->get('autoloader-suffix');
- if (null === $suffix && Filesystem::isReadable($vendorPath.'/autoload.php')) {
- $content = file_get_contents($vendorPath.'/autoload.php');
- if (Preg::isMatch('{ComposerAutoloaderInit([^:\s]+)::}', $content, $match)) {
- $suffix = $match[1];
- }
- }
- if (null === $suffix) {
- $suffix = md5(uniqid('', true));
- }
- }
- $filesystem->filePutContentsIfModified($targetDir.'/autoload_namespaces.php', $namespacesFile);
- $filesystem->filePutContentsIfModified($targetDir.'/autoload_psr4.php', $psr4File);
- $filesystem->filePutContentsIfModified($targetDir.'/autoload_classmap.php', $classmapFile);
- $includePathFilePath = $targetDir.'/include_paths.php';
- if ($includePathFileContents = $this->getIncludePathsFile($packageMap, $filesystem, $basePath, $vendorPath, $vendorPathCode, $appBaseDirCode)) {
- $filesystem->filePutContentsIfModified($includePathFilePath, $includePathFileContents);
- } elseif (file_exists($includePathFilePath)) {
- unlink($includePathFilePath);
- }
- $includeFilesFilePath = $targetDir.'/autoload_files.php';
- if ($includeFilesFileContents = $this->getIncludeFilesFile($autoloads['files'], $filesystem, $basePath, $vendorPath, $vendorPathCode, $appBaseDirCode)) {
- $filesystem->filePutContentsIfModified($includeFilesFilePath, $includeFilesFileContents);
- } elseif (file_exists($includeFilesFilePath)) {
- unlink($includeFilesFilePath);
- }
- $filesystem->filePutContentsIfModified($targetDir.'/autoload_static.php', $this->getStaticFile($suffix, $targetDir, $vendorPath, $basePath));
- $checkPlatform = $config->get('platform-check') !== false && !($this->platformRequirementFilter instanceof IgnoreAllPlatformRequirementFilter);
- $platformCheckContent = null;
- if ($checkPlatform) {
- $platformCheckContent = $this->getPlatformCheck($packageMap, $config->get('platform-check'), $devPackageNames);
- if (null === $platformCheckContent) {
- $checkPlatform = false;
- }
- }
- if ($checkPlatform) {
- $filesystem->filePutContentsIfModified($targetDir.'/platform_check.php', $platformCheckContent);
- } elseif (file_exists($targetDir.'/platform_check.php')) {
- unlink($targetDir.'/platform_check.php');
- }
- $filesystem->filePutContentsIfModified($vendorPath.'/autoload.php', $this->getAutoloadFile($vendorPathToTargetDirCode, $suffix));
- $filesystem->filePutContentsIfModified($targetDir.'/autoload_real.php', $this->getAutoloadRealFile(true, (bool) $includePathFileContents, $targetDirLoader, (bool) $includeFilesFileContents, $vendorPathCode, $appBaseDirCode, $suffix, $useGlobalIncludePath, $prependAutoloader, $checkPlatform));
- $filesystem->safeCopy(__DIR__.'/ClassLoader.php', $targetDir.'/ClassLoader.php');
- $filesystem->safeCopy(__DIR__.'/../../../LICENSE', $targetDir.'/LICENSE');
- if ($this->runScripts) {
- $this->eventDispatcher->dispatchScript(ScriptEvents::POST_AUTOLOAD_DUMP, $this->devMode, [], [
- 'optimize' => $scanPsrPackages,
- ]);
- }
- return $classMap;
- }
- private function buildExclusionRegex(string $dir, ?array $excluded): ?string
- {
- if (null === $excluded) {
- return null;
- }
- if (file_exists($dir)) {
- $dirMatch = preg_quote(strtr(realpath($dir), '\\', '/'));
- foreach ($excluded as $index => $pattern) {
- $pattern = Preg::replace('{^(([^.+*?\[^\]$(){}=!<>|:\\\\#-]+|\\\\[.+*?\[^\]$(){}=!<>|:#-])*).*}', '$1', $pattern);
- if (0 !== strpos($pattern, $dirMatch) && 0 !== strpos($dirMatch, $pattern)) {
- unset($excluded[$index]);
- }
- }
- }
- return \count($excluded) > 0 ? '{(' . implode('|', $excluded) . ')}' : null;
- }
- public function buildPackageMap(InstallationManager $installationManager, PackageInterface $rootPackage, array $packages)
- {
- $packageMap = [[$rootPackage, '']];
- foreach ($packages as $package) {
- if ($package instanceof AliasPackage) {
- continue;
- }
- $this->validatePackage($package);
- $packageMap[] = [
- $package,
- $installationManager->getInstallPath($package),
- ];
- }
- return $packageMap;
- }
- protected function validatePackage(PackageInterface $package)
- {
- $autoload = $package->getAutoload();
- if (!empty($autoload['psr-4']) && null !== $package->getTargetDir()) {
- $name = $package->getName();
- $package->getTargetDir();
- throw new \InvalidArgumentException("PSR-4 autoloading is incompatible with the target-dir property, remove the target-dir in package '$name'.");
- }
- if (!empty($autoload['psr-4'])) {
- foreach ($autoload['psr-4'] as $namespace => $dirs) {
- if ($namespace !== '' && '\\' !== substr($namespace, -1)) {
- throw new \InvalidArgumentException("psr-4 namespaces must end with a namespace separator, '$namespace' does not, use '$namespace\\'.");
- }
- }
- }
- }
- public function parseAutoloads(array $packageMap, PackageInterface $rootPackage, $filteredDevPackages = false)
- {
- $rootPackageMap = array_shift($packageMap);
- if (is_array($filteredDevPackages)) {
- $packageMap = array_filter($packageMap, static function ($item) use ($filteredDevPackages): bool {
- return !in_array($item[0]->getName(), $filteredDevPackages, true);
- });
- } elseif ($filteredDevPackages) {
- $packageMap = $this->filterPackageMap($packageMap, $rootPackage);
- }
- $sortedPackageMap = $this->sortPackageMap($packageMap);
- $sortedPackageMap[] = $rootPackageMap;
- array_unshift($packageMap, $rootPackageMap);
- $psr0 = $this->parseAutoloadsType($packageMap, 'psr-0', $rootPackage);
- $psr4 = $this->parseAutoloadsType($packageMap, 'psr-4', $rootPackage);
- $classmap = $this->parseAutoloadsType(array_reverse($sortedPackageMap), 'classmap', $rootPackage);
- $files = $this->parseAutoloadsType($sortedPackageMap, 'files', $rootPackage);
- $exclude = $this->parseAutoloadsType($sortedPackageMap, 'exclude-from-classmap', $rootPackage);
- krsort($psr0);
- krsort($psr4);
- return [
- 'psr-0' => $psr0,
- 'psr-4' => $psr4,
- 'classmap' => $classmap,
- 'files' => $files,
- 'exclude-from-classmap' => $exclude,
- ];
- }
- public function createLoader(array $autoloads, ?string $vendorDir = null)
- {
- $loader = new ClassLoader($vendorDir);
- if (isset($autoloads['psr-0'])) {
- foreach ($autoloads['psr-0'] as $namespace => $path) {
- $loader->add($namespace, $path);
- }
- }
- if (isset($autoloads['psr-4'])) {
- foreach ($autoloads['psr-4'] as $namespace => $path) {
- $loader->addPsr4($namespace, $path);
- }
- }
- if (isset($autoloads['classmap'])) {
- $excluded = null;
- if (!empty($autoloads['exclude-from-classmap'])) {
- $excluded = $autoloads['exclude-from-classmap'];
- }
- $classMapGenerator = new ClassMapGenerator(['php', 'inc', 'hh']);
- $classMapGenerator->avoidDuplicateScans();
- foreach ($autoloads['classmap'] as $dir) {
- try {
- $classMapGenerator->scanPaths($dir, $this->buildExclusionRegex($dir, $excluded));
- } catch (\RuntimeException $e) {
- $this->io->writeError('<warning>'.$e->getMessage().'</warning>');
- }
- }
- $loader->addClassMap($classMapGenerator->getClassMap()->getMap());
- }
- return $loader;
- }
- protected function getIncludePathsFile(array $packageMap, Filesystem $filesystem, string $basePath, string $vendorPath, string $vendorPathCode, string $appBaseDirCode)
- {
- $includePaths = [];
- foreach ($packageMap as $item) {
- [$package, $installPath] = $item;
- if (null !== $package->getTargetDir() && strlen($package->getTargetDir()) > 0) {
- $installPath = substr($installPath, 0, -strlen('/'.$package->getTargetDir()));
- }
- foreach ($package->getIncludePaths() as $includePath) {
- $includePath = trim($includePath, '/');
- $includePaths[] = empty($installPath) ? $includePath : $installPath.'/'.$includePath;
- }
- }
- if (!$includePaths) {
- return null;
- }
- $includePathsCode = '';
- foreach ($includePaths as $path) {
- $includePathsCode .= " " . $this->getPathCode($filesystem, $basePath, $vendorPath, $path) . ",\n";
- }
- return <<<EOF
- <?php
- // include_paths.php @generated by Composer
- \$vendorDir = $vendorPathCode;
- \$baseDir = $appBaseDirCode;
- return array(
- $includePathsCode);
- EOF;
- }
- protected function getIncludeFilesFile(array $files, Filesystem $filesystem, string $basePath, string $vendorPath, string $vendorPathCode, string $appBaseDirCode)
- {
- $filesCode = '';
- foreach ($files as $fileIdentifier => $functionFile) {
- $filesCode .= ' ' . var_export($fileIdentifier, true) . ' => '
- . $this->getPathCode($filesystem, $basePath, $vendorPath, $functionFile) . ",\n";
- }
- if (!$filesCode) {
- return null;
- }
- return <<<EOF
- <?php
- // autoload_files.php @generated by Composer
- \$vendorDir = $vendorPathCode;
- \$baseDir = $appBaseDirCode;
- return array(
- $filesCode);
- EOF;
- }
- protected function getPathCode(Filesystem $filesystem, string $basePath, string $vendorPath, string $path)
- {
- if (!$filesystem->isAbsolutePath($path)) {
- $path = $basePath . '/' . $path;
- }
- $path = $filesystem->normalizePath($path);
- $baseDir = '';
- if (strpos($path.'/', $vendorPath.'/') === 0) {
- $path = (string) substr($path, strlen($vendorPath));
- $baseDir = '$vendorDir . ';
- } else {
- $path = $filesystem->normalizePath($filesystem->findShortestPath($basePath, $path, true));
- if (!$filesystem->isAbsolutePath($path)) {
- $baseDir = '$baseDir . ';
- $path = '/' . $path;
- }
- }
- if (strpos($path, '.phar') !== false) {
- $baseDir = "'phar://' . " . $baseDir;
- }
- return $baseDir . var_export($path, true);
- }
- protected function getPlatformCheck(array $packageMap, $checkPlatform, array $devPackageNames)
- {
- $lowestPhpVersion = Bound::zero();
- $requiredExtensions = [];
- $extensionProviders = [];
- foreach ($packageMap as $item) {
- $package = $item[0];
- foreach (array_merge($package->getReplaces(), $package->getProvides()) as $link) {
- if (Preg::isMatch('{^ext-(.+)$}iD', $link->getTarget(), $match)) {
- $extensionProviders[$match[1]][] = $link->getConstraint();
- }
- }
- }
- foreach ($packageMap as $item) {
- $package = $item[0];
- if (in_array($package->getName(), $devPackageNames, true)) {
- continue;
- }
- foreach ($package->getRequires() as $link) {
- if ($this->platformRequirementFilter->isIgnored($link->getTarget())) {
- continue;
- }
- if ('php' === $link->getTarget()) {
- $constraint = $link->getConstraint();
- if ($constraint->getLowerBound()->compareTo($lowestPhpVersion, '>')) {
- $lowestPhpVersion = $constraint->getLowerBound();
- }
- }
- if ($checkPlatform === true && Preg::isMatch('{^ext-(.+)$}iD', $link->getTarget(), $match)) {
- if (isset($extensionProviders[$match[1]])) {
- foreach ($extensionProviders[$match[1]] as $provided) {
- if ($provided->matches($link->getConstraint())) {
- continue 2;
- }
- }
- }
- if ($match[1] === 'zend-opcache') {
- $match[1] = 'zend opcache';
- }
- $extension = var_export($match[1], true);
- if ($match[1] === 'pcntl' || $match[1] === 'readline') {
- $requiredExtensions[$extension] = "PHP_SAPI !== 'cli' || extension_loaded($extension) || \$missingExtensions[] = $extension;\n";
- } else {
- $requiredExtensions[$extension] = "extension_loaded($extension) || \$missingExtensions[] = $extension;\n";
- }
- }
- }
- }
- ksort($requiredExtensions);
- $formatToPhpVersionId = static function (Bound $bound): int {
- if ($bound->isZero()) {
- return 0;
- }
- if ($bound->isPositiveInfinity()) {
- return 99999;
- }
- $version = str_replace('-', '.', $bound->getVersion());
- $chunks = array_map('intval', explode('.', $version));
- return $chunks[0] * 10000 + $chunks[1] * 100 + $chunks[2];
- };
- $formatToHumanReadable = static function (Bound $bound) {
- if ($bound->isZero()) {
- return 0;
- }
- if ($bound->isPositiveInfinity()) {
- return 99999;
- }
- $version = str_replace('-', '.', $bound->getVersion());
- $chunks = explode('.', $version);
- $chunks = array_slice($chunks, 0, 3);
- return implode('.', $chunks);
- };
- $requiredPhp = '';
- $requiredPhpError = '';
- if (!$lowestPhpVersion->isZero()) {
- $operator = $lowestPhpVersion->isInclusive() ? '>=' : '>';
- $requiredPhp = 'PHP_VERSION_ID '.$operator.' '.$formatToPhpVersionId($lowestPhpVersion);
- $requiredPhpError = '"'.$operator.' '.$formatToHumanReadable($lowestPhpVersion).'"';
- }
- if ($requiredPhp) {
- $requiredPhp = <<<PHP_CHECK
- if (!($requiredPhp)) {
- \$issues[] = 'Your Composer dependencies require a PHP version $requiredPhpError. You are running ' . PHP_VERSION . '.';
- }
- PHP_CHECK;
- }
- $requiredExtensions = implode('', $requiredExtensions);
- if ('' !== $requiredExtensions) {
- $requiredExtensions = <<<EXT_CHECKS
- \$missingExtensions = array();
- $requiredExtensions
- if (\$missingExtensions) {
- \$issues[] = 'Your Composer dependencies require the following PHP extensions to be installed: ' . implode(', ', \$missingExtensions) . '.';
- }
- EXT_CHECKS;
- }
- if (!$requiredPhp && !$requiredExtensions) {
- return null;
- }
- return <<<PLATFORM_CHECK
- <?php
- // platform_check.php @generated by Composer
- \$issues = array();
- {$requiredPhp}{$requiredExtensions}
- if (\$issues) {
- if (!headers_sent()) {
- header('HTTP/1.1 500 Internal Server Error');
- }
- if (!ini_get('display_errors')) {
- if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
- fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, \$issues) . PHP_EOL.PHP_EOL);
- } elseif (!headers_sent()) {
- 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;
- }
- }
- trigger_error(
- 'Composer detected issues in your platform: ' . implode(' ', \$issues),
- E_USER_ERROR
- );
- }
- PLATFORM_CHECK;
- }
- protected function getAutoloadFile(string $vendorPathToTargetDirCode, string $suffix)
- {
- $lastChar = $vendorPathToTargetDirCode[strlen($vendorPathToTargetDirCode) - 1];
- if ("'" === $lastChar || '"' === $lastChar) {
- $vendorPathToTargetDirCode = substr($vendorPathToTargetDirCode, 0, -1).'/autoload_real.php'.$lastChar;
- } else {
- $vendorPathToTargetDirCode .= " . '/autoload_real.php'";
- }
- return <<<AUTOLOAD
- <?php
- // autoload.php @generated by Composer
- if (PHP_VERSION_ID < 50600) {
- echo '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;
- exit(1);
- }
- require_once $vendorPathToTargetDirCode;
- return ComposerAutoloaderInit$suffix::getLoader();
- AUTOLOAD;
- }
- protected function getAutoloadRealFile(bool $useClassMap, bool $useIncludePath, ?string $targetDirLoader, bool $useIncludeFiles, string $vendorPathCode, string $appBaseDirCode, string $suffix, bool $useGlobalIncludePath, string $prependAutoloader, bool $checkPlatform)
- {
- $file = <<<HEADER
- <?php
- // autoload_real.php @generated by Composer
- class ComposerAutoloaderInit$suffix
- {
- private static \$loader;
- public static function loadClassLoader(\$class)
- {
- if ('Composer\\Autoload\\ClassLoader' === \$class) {
- require __DIR__ . '/ClassLoader.php';
- }
- }
- /**
- * @return \Composer\Autoload\ClassLoader
- */
- public static function getLoader()
- {
- if (null !== self::\$loader) {
- return self::\$loader;
- }
- HEADER;
- if ($checkPlatform) {
- $file .= <<<'PLATFORM_CHECK'
- require __DIR__ . '/platform_check.php';
- PLATFORM_CHECK;
- }
- $file .= <<<CLASSLOADER_INIT
- spl_autoload_register(array('ComposerAutoloaderInit$suffix', 'loadClassLoader'), true, $prependAutoloader);
- self::\$loader = \$loader = new \\Composer\\Autoload\\ClassLoader(\\dirname(__DIR__));
- spl_autoload_unregister(array('ComposerAutoloaderInit$suffix', 'loadClassLoader'));
- CLASSLOADER_INIT;
- if ($useIncludePath) {
- $file .= <<<'INCLUDE_PATH'
- $includePaths = require __DIR__ . '/include_paths.php';
- $includePaths[] = get_include_path();
- set_include_path(implode(PATH_SEPARATOR, $includePaths));
- INCLUDE_PATH;
- }
- $file .= <<<STATIC_INIT
- require __DIR__ . '/autoload_static.php';
- call_user_func(\Composer\Autoload\ComposerStaticInit$suffix::getInitializer(\$loader));
- STATIC_INIT;
- if ($this->classMapAuthoritative) {
- $file .= <<<'CLASSMAPAUTHORITATIVE'
- $loader->setClassMapAuthoritative(true);
- CLASSMAPAUTHORITATIVE;
- }
- if ($this->apcu) {
- $apcuPrefix = var_export(($this->apcuPrefix !== null ? $this->apcuPrefix : substr(base64_encode(md5(uniqid('', true), true)), 0, -3)), true);
- $file .= <<<APCU
- \$loader->setApcuPrefix($apcuPrefix);
- APCU;
- }
- if ($useGlobalIncludePath) {
- $file .= <<<'INCLUDEPATH'
- $loader->setUseIncludePath(true);
- INCLUDEPATH;
- }
- if ($targetDirLoader) {
- $file .= <<<REGISTER_TARGET_DIR_AUTOLOAD
- spl_autoload_register(array('ComposerAutoloaderInit$suffix', 'autoload'), true, true);
- REGISTER_TARGET_DIR_AUTOLOAD;
- }
- $file .= <<<REGISTER_LOADER
- \$loader->register($prependAutoloader);
- REGISTER_LOADER;
- if ($useIncludeFiles) {
- $file .= <<<INCLUDE_FILES
- \$includeFiles = \Composer\Autoload\ComposerStaticInit$suffix::\$files;
- foreach (\$includeFiles as \$fileIdentifier => \$file) {
- composerRequire$suffix(\$fileIdentifier, \$file);
- }
- INCLUDE_FILES;
- }
- $file .= <<<METHOD_FOOTER
- return \$loader;
- }
- METHOD_FOOTER;
- $file .= $targetDirLoader;
- if ($useIncludeFiles) {
- return $file . <<<FOOTER
- }
- /**
- * @param string \$fileIdentifier
- * @param string \$file
- * @return void
- */
- function composerRequire$suffix(\$fileIdentifier, \$file)
- {
- if (empty(\$GLOBALS['__composer_autoload_files'][\$fileIdentifier])) {
- \$GLOBALS['__composer_autoload_files'][\$fileIdentifier] = true;
- require \$file;
- }
- }
- FOOTER;
- }
- return $file . <<<FOOTER
- }
- FOOTER;
- }
- protected function getStaticFile(string $suffix, string $targetDir, string $vendorPath, string $basePath)
- {
- $file = <<<HEADER
- <?php
- // autoload_static.php @generated by Composer
- namespace Composer\Autoload;
- class ComposerStaticInit$suffix
- {
- HEADER;
- $loader = new ClassLoader();
- $map = require $targetDir . '/autoload_namespaces.php';
- foreach ($map as $namespace => $path) {
- $loader->set($namespace, $path);
- }
- $map = require $targetDir . '/autoload_psr4.php';
- foreach ($map as $namespace => $path) {
- $loader->setPsr4($namespace, $path);
- }
- $classMap = require $targetDir . '/autoload_classmap.php';
- if ($classMap) {
- $loader->addClassMap($classMap);
- }
- $filesystem = new Filesystem();
- $vendorPathCode = ' => ' . $filesystem->findShortestPathCode(realpath($targetDir), $vendorPath, true, true) . " . '/";
- $vendorPharPathCode = ' => \'phar://\' . ' . $filesystem->findShortestPathCode(realpath($targetDir), $vendorPath, true, true) . " . '/";
- $appBaseDirCode = ' => ' . $filesystem->findShortestPathCode(realpath($targetDir), $basePath, true, true) . " . '/";
- $appBaseDirPharCode = ' => \'phar://\' . ' . $filesystem->findShortestPathCode(realpath($targetDir), $basePath, true, true) . " . '/";
- $absoluteVendorPathCode = ' => ' . substr(var_export(rtrim($vendorDir, '\\/') . '/', true), 0, -1);
- $absoluteVendorPharPathCode = ' => ' . substr(var_export(rtrim('phar://' . $vendorDir, '\\/') . '/', true), 0, -1);
- $absoluteAppBaseDirCode = ' => ' . substr(var_export(rtrim($baseDir, '\\/') . '/', true), 0, -1);
- $absoluteAppBaseDirPharCode = ' => ' . substr(var_export(rtrim('phar://' . $baseDir, '\\/') . '/', true), 0, -1);
- $initializer = '';
- $prefix = "\0Composer\Autoload\ClassLoader\0";
- $prefixLen = strlen($prefix);
- if (file_exists($targetDir . '/autoload_files.php')) {
- $maps = ['files' => require $targetDir . '/autoload_files.php'];
- } else {
- $maps = [];
- }
- foreach ((array) $loader as $prop => $value) {
- if ($value && 0 === strpos($prop, $prefix)) {
- $maps[substr($prop, $prefixLen)] = $value;
- }
- }
- foreach ($maps as $prop => $value) {
- $value = strtr(
- var_export($value, true),
- [
- $absoluteVendorPathCode => $vendorPathCode,
- $absoluteVendorPharPathCode => $vendorPharPathCode,
- $absoluteAppBaseDirCode => $appBaseDirCode,
- $absoluteAppBaseDirPharCode => $appBaseDirPharCode,
- ]
- );
- $value = ltrim(Preg::replace('/^ */m', ' $0$0', $value));
- $file .= sprintf(" public static $%s = %s;\n\n", $prop, $value);
- if ('files' !== $prop) {
- $initializer .= " \$loader->$prop = ComposerStaticInit$suffix::\$$prop;\n";
- }
- }
- return $file . <<<INITIALIZER
- public static function getInitializer(ClassLoader \$loader)
- {
- return \Closure::bind(function () use (\$loader) {
- $initializer
- }, null, ClassLoader::class);
- }
- }
- INITIALIZER;
- }
- protected function parseAutoloadsType(array $packageMap, string $type, RootPackageInterface $rootPackage)
- {
- $autoloads = [];
- foreach ($packageMap as $item) {
- [$package, $installPath] = $item;
- $autoload = $package->getAutoload();
- if ($this->devMode && $package === $rootPackage) {
- $autoload = array_merge_recursive($autoload, $package->getDevAutoload());
- }
- if (!isset($autoload[$type]) || !is_array($autoload[$type])) {
- continue;
- }
- if (null !== $package->getTargetDir() && $package !== $rootPackage) {
- $installPath = substr($installPath, 0, -strlen('/'.$package->getTargetDir()));
- }
- foreach ($autoload[$type] as $namespace => $paths) {
- foreach ((array) $paths as $path) {
- if (($type === 'files' || $type === 'classmap' || $type === 'exclude-from-classmap') && $package->getTargetDir() && !Filesystem::isReadable($installPath.'/'.$path)) {
- if ($package === $rootPackage) {
- $targetDir = str_replace('\\<dirsep\\>', '[\\\\/]', preg_quote(str_replace(['/', '\\'], '<dirsep>', $package->getTargetDir())));
- $path = ltrim(Preg::replace('{^'.$targetDir.'}', '', ltrim($path, '\\/')), '\\/');
- } else {
- $path = $package->getTargetDir() . '/' . $path;
- }
- }
- if ($type === 'exclude-from-classmap') {
- $path = Preg::replace('{/+}', '/', preg_quote(trim(strtr($path, '\\', '/'), '/')));
- $path = strtr($path, ['\\*\\*' => '.+?', '\\*' => '[^/]+?']);
- $updir = null;
- $path = Preg::replaceCallback(
- '{^((?:(?:\\\\\\.){1,2}+/)+)}',
- static function ($matches) use (&$updir): string {
- if (isset($matches[1])) {
- $updir = str_replace('\\.', '.', $matches[1]);
- }
- return '';
- },
- $path
- );
- if (empty($installPath)) {
- $installPath = strtr(Platform::getCwd(), '\\', '/');
- }
- $resolvedPath = realpath($installPath . '/' . $updir);
- if (false === $resolvedPath) {
- continue;
- }
- $autoloads[] = preg_quote(strtr($resolvedPath, '\\', '/')) . '/' . $path . '($|/)';
- continue;
- }
- $relativePath = empty($installPath) ? (empty($path) ? '.' : $path) : $installPath.'/'.$path;
- if ($type === 'files') {
- $autoloads[$this->getFileIdentifier($package, $path)] = $relativePath;
- continue;
- }
- if ($type === 'classmap') {
- $autoloads[] = $relativePath;
- continue;
- }
- $autoloads[$namespace][] = $relativePath;
- }
- }
- }
- return $autoloads;
- }
- protected function getFileIdentifier(PackageInterface $package, string $path)
- {
- return md5($package->getName() . ':' . $path);
- }
- protected function filterPackageMap(array $packageMap, RootPackageInterface $rootPackage)
- {
- $packages = [];
- $include = [];
- $replacedBy = [];
- foreach ($packageMap as $item) {
- $package = $item[0];
- $name = $package->getName();
- $packages[$name] = $package;
- foreach ($package->getReplaces() as $replace) {
- $replacedBy[$replace->getTarget()] = $name;
- }
- }
- $add = static function (PackageInterface $package) use (&$add, $packages, &$include, $replacedBy): void {
- foreach ($package->getRequires() as $link) {
- $target = $link->getTarget();
- if (isset($replacedBy[$target])) {
- $target = $replacedBy[$target];
- }
- if (!isset($include[$target])) {
- $include[$target] = true;
- if (isset($packages[$target])) {
- $add($packages[$target]);
- }
- }
- }
- };
- $add($rootPackage);
- return array_filter(
- $packageMap,
- static function ($item) use ($include): bool {
- $package = $item[0];
- foreach ($package->getNames() as $name) {
- if (isset($include[$name])) {
- return true;
- }
- }
- return false;
- }
- );
- }
- protected function sortPackageMap(array $packageMap)
- {
- $packages = [];
- $paths = [];
- foreach ($packageMap as $item) {
- [$package, $path] = $item;
- $name = $package->getName();
- $packages[$name] = $package;
- $paths[$name] = $path;
- }
- $sortedPackages = PackageSorter::sortPackages($packages);
- $sortedPackageMap = [];
- foreach ($sortedPackages as $package) {
- $name = $package->getName();
- $sortedPackageMap[] = [$packages[$name], $paths[$name]];
- }
- return $sortedPackageMap;
- }
- }
- function composerRequire(string $fileIdentifier, string $file): void
- {
- if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
- $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
- require $file;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Autoload;
- use Composer\ClassMapGenerator\FileList;
- use Composer\IO\IOInterface;
- class ClassMapGenerator
- {
- public static function dump(iterable $dirs, string $file): void
- {
- $maps = [];
- foreach ($dirs as $dir) {
- $maps = array_merge($maps, static::createMap($dir));
- }
- file_put_contents($file, sprintf('<?php return %s;', var_export($maps, true)));
- }
- public static function createMap($path, ?string $excluded = null, ?IOInterface $io = null, ?string $namespace = null, ?string $autoloadType = null, array &$scannedFiles = []): array
- {
- $generator = new \Composer\ClassMapGenerator\ClassMapGenerator(['php', 'inc', 'hh']);
- $fileList = new FileList();
- $fileList->files = $scannedFiles;
- $generator->avoidDuplicateScans($fileList);
- $generator->scanPaths($path, $excluded, $autoloadType ?? 'classmap', $namespace);
- $classMap = $generator->getClassMap();
- $scannedFiles = $fileList->files;
- if ($io !== null) {
- foreach ($classMap->getPsrViolations() as $msg) {
- $io->writeError("<warning>$msg</warning>");
- }
- foreach ($classMap->getAmbiguousClasses() as $class => $paths) {
- if (count($paths) > 1) {
- $io->writeError(
- '<warning>Warning: Ambiguous class resolution, "'.$class.'"'.
- ' was found '. (count($paths) + 1) .'x: in "'.$classMap->getClassPath($class).'" and "'. implode('", "', $paths) .'", the first will be used.</warning>'
- );
- } else {
- $io->writeError(
- '<warning>Warning: Ambiguous class resolution, "'.$class.'"'.
- ' was found in both "'.$classMap->getClassPath($class).'" and "'. implode('", "', $paths) .'", the first will be used.</warning>'
- );
- }
- }
- }
- return $classMap->getMap();
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Autoload;
- use Composer\Pcre\Preg;
- class PhpFileCleaner
- {
- private static $typeConfig;
- private static $restPattern;
- private $contents;
- private $len;
- private $maxMatches;
- private $index = 0;
- public static function setTypeConfig(array $types): void
- {
- foreach ($types as $type) {
- self::$typeConfig[$type[0]] = [
- 'name' => $type,
- 'length' => \strlen($type),
- 'pattern' => '{.\b(?<![\$:>])'.$type.'\s++[a-zA-Z_\x7f-\xff:][a-zA-Z0-9_\x7f-\xff:\-]*+}Ais',
- ];
- }
- self::$restPattern = '{[^?"\'</'.implode('', array_keys(self::$typeConfig)).']+}A';
- }
- public function __construct(string $contents, int $maxMatches)
- {
- $this->contents = $contents;
- $this->len = \strlen($this->contents);
- $this->maxMatches = $maxMatches;
- }
- public function clean(): string
- {
- $clean = '';
- while ($this->index < $this->len) {
- $this->skipToPhp();
- $clean .= '<?';
- while ($this->index < $this->len) {
- $char = $this->contents[$this->index];
- if ($char === '?' && $this->peek('>')) {
- $clean .= '?>';
- $this->index += 2;
- continue 2;
- }
- if ($char === '"') {
- $this->skipString('"');
- $clean .= 'null';
- continue;
- }
- if ($char === "'") {
- $this->skipString("'");
- $clean .= 'null';
- continue;
- }
- 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)) {
- $this->index += \strlen($match[0]);
- $this->skipHeredoc($match[2]);
- $clean .= 'null';
- continue;
- }
- if ($char === '/') {
- if ($this->peek('/')) {
- $this->skipToNewline();
- continue;
- }
- if ($this->peek('*')) {
- $this->skipComment();
- continue;
- }
- }
- if ($this->maxMatches === 1 && isset(self::$typeConfig[$char])) {
- $type = self::$typeConfig[$char];
- if (
- \substr($this->contents, $this->index, $type['length']) === $type['name']
- && Preg::isMatch($type['pattern'], $this->contents, $match, 0, $this->index - 1)
- ) {
- $clean .= $match[0];
- return $clean;
- }
- }
- $this->index += 1;
- if ($this->match(self::$restPattern, $match)) {
- $clean .= $char . $match[0];
- $this->index += \strlen($match[0]);
- } else {
- $clean .= $char;
- }
- }
- }
- return $clean;
- }
- private function skipToPhp(): void
- {
- while ($this->index < $this->len) {
- if ($this->contents[$this->index] === '<' && $this->peek('?')) {
- $this->index += 2;
- break;
- }
- $this->index += 1;
- }
- }
- private function skipString(string $delimiter): void
- {
- $this->index += 1;
- while ($this->index < $this->len) {
- if ($this->contents[$this->index] === '\\' && ($this->peek('\\') || $this->peek($delimiter))) {
- $this->index += 2;
- continue;
- }
- if ($this->contents[$this->index] === $delimiter) {
- $this->index += 1;
- break;
- }
- $this->index += 1;
- }
- }
- private function skipComment(): void
- {
- $this->index += 2;
- while ($this->index < $this->len) {
- if ($this->contents[$this->index] === '*' && $this->peek('/')) {
- $this->index += 2;
- break;
- }
- $this->index += 1;
- }
- }
- private function skipToNewline(): void
- {
- while ($this->index < $this->len) {
- if ($this->contents[$this->index] === "\r" || $this->contents[$this->index] === "\n") {
- return;
- }
- $this->index += 1;
- }
- }
- private function skipHeredoc(string $delimiter): void
- {
- $firstDelimiterChar = $delimiter[0];
- $delimiterLength = \strlen($delimiter);
- $delimiterPattern = '{'.preg_quote($delimiter).'(?![a-zA-Z0-9_\x80-\xff])}A';
- while ($this->index < $this->len) {
- switch ($this->contents[$this->index]) {
- case "\t":
- case " ":
- $this->index += 1;
- continue 2;
- case $firstDelimiterChar:
- if (
- \substr($this->contents, $this->index, $delimiterLength) === $delimiter
- && $this->match($delimiterPattern)
- ) {
- $this->index += $delimiterLength;
- return;
- }
- break;
- }
- while ($this->index < $this->len) {
- $this->skipToNewline();
- while ($this->index < $this->len && ($this->contents[$this->index] === "\r" || $this->contents[$this->index] === "\n")) {
- $this->index += 1;
- }
- break;
- }
- }
- }
- private function peek(string $char): bool
- {
- return $this->index + 1 < $this->len && $this->contents[$this->index + 1] === $char;
- }
- private function match($regex, ?array &$match = null): bool
- {
- return Preg::isMatch($regex, $this->contents, $match, 0, $this->index);
- }
- }
- <?php declare(strict_types=1);
- namespace Composer;
- use Composer\IO\IOInterface;
- use Composer\Pcre\Preg;
- use Composer\Util\Filesystem;
- use Composer\Util\Platform;
- use Composer\Util\Silencer;
- use Symfony\Component\Finder\Finder;
- class Cache
- {
- private static $cacheCollected = null;
- private $io;
- private $root;
- private $enabled = null;
- private $allowlist;
- private $filesystem;
- private $readOnly;
- public function __construct(IOInterface $io, string $cacheDir, string $allowlist = 'a-z0-9.', ?Filesystem $filesystem = null, bool $readOnly = false)
- {
- $this->io = $io;
- $this->root = rtrim($cacheDir, '/\\') . '/';
- $this->allowlist = $allowlist;
- $this->filesystem = $filesystem ?: new Filesystem();
- $this->readOnly = (bool) $readOnly;
- if (!self::isUsable($cacheDir)) {
- $this->enabled = false;
- }
- }
- public function setReadOnly(bool $readOnly)
- {
- $this->readOnly = (bool) $readOnly;
- }
- public function isReadOnly()
- {
- return $this->readOnly;
- }
- public static function isUsable(string $path)
- {
- return !Preg::isMatch('{(^|[\\\\/])(\$null|nul|NUL|/dev/null)([\\\\/]|$)}', $path);
- }
- public function isEnabled()
- {
- if ($this->enabled === null) {
- $this->enabled = true;
- if (
- !$this->readOnly
- && (
- (!is_dir($this->root) && !Silencer::call('mkdir', $this->root, 0777, true))
- || !is_writable($this->root)
- )
- ) {
- $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>');
- $this->enabled = false;
- }
- }
- return $this->enabled;
- }
- public function getRoot()
- {
- return $this->root;
- }
- public function read(string $file)
- {
- if ($this->isEnabled()) {
- $file = Preg::replace('{[^'.$this->allowlist.']}i', '-', $file);
- if (file_exists($this->root . $file)) {
- $this->io->writeError('Reading '.$this->root . $file.' from cache', true, IOInterface::DEBUG);
- return file_get_contents($this->root . $file);
- }
- }
- return false;
- }
- public function write(string $file, string $contents)
- {
- if ($this->isEnabled() && !$this->readOnly) {
- $file = Preg::replace('{[^'.$this->allowlist.']}i', '-', $file);
- $this->io->writeError('Writing '.$this->root . $file.' into cache', true, IOInterface::DEBUG);
- $tempFileName = $this->root . $file . uniqid('.', true) . '.tmp';
- try {
- return file_put_contents($tempFileName, $contents) !== false && rename($tempFileName, $this->root . $file);
- } catch (\ErrorException $e) {
- $this->io->writeError('<warning>Failed to write into cache: '.$e->getMessage().'</warning>', true, IOInterface::DEBUG);
- if (Preg::isMatch('{^file_put_contents\(\): Only ([0-9]+) of ([0-9]+) bytes written}', $e->getMessage(), $m)) {
- unlink($tempFileName);
- $message = sprintf(
- '<warning>Writing %1$s into cache failed after %2$u of %3$u bytes written, only %4$s bytes of free space available</warning>',
- $tempFileName,
- $m[1],
- $m[2],
- function_exists('disk_free_space') ? @disk_free_space(dirname($tempFileName)) : 'unknown'
- );
- $this->io->writeError($message);
- return false;
- }
- throw $e;
- }
- }
- return false;
- }
- public function copyFrom(string $file, string $source)
- {
- if ($this->isEnabled() && !$this->readOnly) {
- $file = Preg::replace('{[^'.$this->allowlist.']}i', '-', $file);
- $this->filesystem->ensureDirectoryExists(dirname($this->root . $file));
- if (!file_exists($source)) {
- $this->io->writeError('<error>'.$source.' does not exist, can not write into cache</error>');
- } elseif ($this->io->isDebug()) {
- $this->io->writeError('Writing '.$this->root . $file.' into cache from '.$source);
- }
- return copy($source, $this->root . $file);
- }
- return false;
- }
- public function copyTo(string $file, string $target)
- {
- if ($this->isEnabled()) {
- $file = Preg::replace('{[^'.$this->allowlist.']}i', '-', $file);
- if (file_exists($this->root . $file)) {
- try {
- touch($this->root . $file, (int) filemtime($this->root . $file), time());
- } catch (\ErrorException $e) {
- Silencer::call('touch', $this->root . $file);
- }
- $this->io->writeError('Reading '.$this->root . $file.' from cache', true, IOInterface::DEBUG);
- return copy($this->root . $file, $target);
- }
- }
- return false;
- }
- public function gcIsNecessary()
- {
- if (self::$cacheCollected) {
- return false;
- }
- self::$cacheCollected = true;
- if (Platform::getEnv('COMPOSER_TEST_SUITE')) {
- return false;
- }
- if (Platform::isInputCompletionProcess()) {
- return false;
- }
- return !random_int(0, 50);
- }
- public function remove(string $file)
- {
- if ($this->isEnabled() && !$this->readOnly) {
- $file = Preg::replace('{[^'.$this->allowlist.']}i', '-', $file);
- if (file_exists($this->root . $file)) {
- return $this->filesystem->unlink($this->root . $file);
- }
- }
- return false;
- }
- public function clear()
- {
- if ($this->isEnabled() && !$this->readOnly) {
- $this->filesystem->emptyDirectory($this->root);
- return true;
- }
- return false;
- }
- public function getAge(string $file)
- {
- if ($this->isEnabled()) {
- $file = Preg::replace('{[^'.$this->allowlist.']}i', '-', $file);
- if (file_exists($this->root . $file) && ($mtime = filemtime($this->root . $file)) !== false) {
- return abs(time() - $mtime);
- }
- }
- return false;
- }
- public function gc(int $ttl, int $maxSize)
- {
- if ($this->isEnabled() && !$this->readOnly) {
- $expire = new \DateTime();
- $expire->modify('-'.$ttl.' seconds');
- $finder = $this->getFinder()->date('until '.$expire->format('Y-m-d H:i:s'));
- foreach ($finder as $file) {
- $this->filesystem->unlink($file->getPathname());
- }
- $totalSize = $this->filesystem->size($this->root);
- if ($totalSize > $maxSize) {
- $iterator = $this->getFinder()->sortByAccessedTime()->getIterator();
- while ($totalSize > $maxSize && $iterator->valid()) {
- $filepath = $iterator->current()->getPathname();
- $totalSize -= $this->filesystem->size($filepath);
- $this->filesystem->unlink($filepath);
- $iterator->next();
- }
- }
- self::$cacheCollected = true;
- return true;
- }
- return false;
- }
- public function gcVcsCache(int $ttl): bool
- {
- if ($this->isEnabled()) {
- $expire = new \DateTime();
- $expire->modify('-'.$ttl.' seconds');
- $finder = Finder::create()->in($this->root)->directories()->depth(0)->date('until '.$expire->format('Y-m-d H:i:s'));
- foreach ($finder as $file) {
- $this->filesystem->removeDirectory($file->getPathname());
- }
- self::$cacheCollected = true;
- return true;
- }
- return false;
- }
- public function sha1(string $file)
- {
- if ($this->isEnabled()) {
- $file = Preg::replace('{[^'.$this->allowlist.']}i', '-', $file);
- if (file_exists($this->root . $file)) {
- return sha1_file($this->root . $file);
- }
- }
- return false;
- }
- public function sha256(string $file)
- {
- if ($this->isEnabled()) {
- $file = Preg::replace('{[^'.$this->allowlist.']}i', '-', $file);
- if (file_exists($this->root . $file)) {
- return hash_file('sha256', $this->root . $file);
- }
- }
- return false;
- }
- protected function getFinder()
- {
- return Finder::create()->in($this->root)->files();
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Command;
- use Composer\Composer;
- use Symfony\Component\Console\Input\InputInterface;
- use Symfony\Component\Console\Output\OutputInterface;
- class AboutCommand extends BaseCommand
- {
- protected function configure(): void
- {
- $this
- ->setName('about')
- ->setDescription('Shows a short information about Composer')
- ->setHelp(
- <<<EOT
- <info>php composer.phar about</info>
- EOT
- )
- ;
- }
- protected function execute(InputInterface $input, OutputInterface $output): int
- {
- $composerVersion = Composer::getVersion();
- $this->getIO()->write(
- <<<EOT
- <info>Composer - Dependency Manager for PHP - version $composerVersion</info>
- <comment>Composer is a dependency manager tracking local dependencies of your projects and libraries.
- See https://getcomposer.org/ for more information.</comment>
- EOT
- );
- return 0;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Command;
- use Composer\Factory;
- use Composer\IO\IOInterface;
- use Composer\Config;
- use Composer\Composer;
- use Composer\Package\BasePackage;
- use Composer\Package\CompletePackageInterface;
- use Composer\Repository\CompositeRepository;
- use Composer\Repository\RepositoryFactory;
- use Composer\Script\ScriptEvents;
- use Composer\Plugin\CommandEvent;
- use Composer\Plugin\PluginEvents;
- use Composer\Util\Filesystem;
- use Composer\Util\Loop;
- use Composer\Util\Platform;
- use Composer\Util\ProcessExecutor;
- use Composer\Console\Input\InputArgument;
- use Symfony\Component\Console\Input\InputInterface;
- use Composer\Console\Input\InputOption;
- use Symfony\Component\Console\Output\OutputInterface;
- class ArchiveCommand extends BaseCommand
- {
- use CompletionTrait;
- private const FORMATS = ['tar', 'tar.gz', 'tar.bz2', 'zip'];
- protected function configure(): void
- {
- $this
- ->setName('archive')
- ->setDescription('Creates an archive of this composer package')
- ->setDefinition([
- new InputArgument('package', InputArgument::OPTIONAL, 'The package to archive instead of the current project', null, $this->suggestAvailablePackage()),
- new InputArgument('version', InputArgument::OPTIONAL, 'A version constraint to find the package to archive'),
- new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the resulting archive: tar, tar.gz, tar.bz2 or zip (default tar)', null, self::FORMATS),
- new InputOption('dir', null, InputOption::VALUE_REQUIRED, 'Write the archive to this directory'),
- new InputOption('file', null, InputOption::VALUE_REQUIRED, 'Write the archive with the given file name.'
- .' Note that the format will be appended.'),
- new InputOption('ignore-filters', null, InputOption::VALUE_NONE, 'Ignore filters when saving package'),
- ])
- ->setHelp(
- <<<EOT
- The <info>archive</info> command creates an archive of the specified format
- containing the files and directories of the Composer project or the specified
- package in the specified version and writes it to the specified directory.
- <info>php composer.phar archive [--format=zip] [--dir=/foo] [--file=filename] [package [version]]</info>
- Read more at https://getcomposer.org/doc/03-cli.md#archive
- EOT
- )
- ;
- }
- protected function execute(InputInterface $input, OutputInterface $output): int
- {
- $composer = $this->tryComposer();
- $config = null;
- if ($composer) {
- $config = $composer->getConfig();
- $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'archive', $input, $output);
- $eventDispatcher = $composer->getEventDispatcher();
- $eventDispatcher->dispatch($commandEvent->getName(), $commandEvent);
- $eventDispatcher->dispatchScript(ScriptEvents::PRE_ARCHIVE_CMD);
- }
- if (!$config) {
- $config = Factory::createConfig();
- }
- $format = $input->getOption('format') ?? $config->get('archive-format');
- $dir = $input->getOption('dir') ?? $config->get('archive-dir');
- $returnCode = $this->archive(
- $this->getIO(),
- $config,
- $input->getArgument('package'),
- $input->getArgument('version'),
- $format,
- $dir,
- $input->getOption('file'),
- $input->getOption('ignore-filters'),
- $composer
- );
- if (0 === $returnCode && $composer) {
- $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_ARCHIVE_CMD);
- }
- return $returnCode;
- }
- protected function archive(IOInterface $io, Config $config, ?string $packageName, ?string $version, string $format, string $dest, ?string $fileName, bool $ignoreFilters, ?Composer $composer): int
- {
- if ($composer) {
- $archiveManager = $composer->getArchiveManager();
- } else {
- $factory = new Factory;
- $process = new ProcessExecutor();
- $httpDownloader = Factory::createHttpDownloader($io, $config);
- $downloadManager = $factory->createDownloadManager($io, $config, $httpDownloader, $process);
- $archiveManager = $factory->createArchiveManager($config, $downloadManager, new Loop($httpDownloader, $process));
- }
- if ($packageName) {
- $package = $this->selectPackage($io, $packageName, $version);
- if (!$package) {
- return 1;
- }
- } else {
- $package = $this->requireComposer()->getPackage();
- }
- $io->writeError('<info>Creating the archive into "'.$dest.'".</info>');
- $packagePath = $archiveManager->archive($package, $format, $dest, $fileName, $ignoreFilters);
- $fs = new Filesystem;
- $shortPath = $fs->findShortestPath(Platform::getCwd(), $packagePath, true);
- $io->writeError('Created: ', false);
- $io->write(strlen($shortPath) < strlen($packagePath) ? $shortPath : $packagePath);
- return 0;
- }
- protected function selectPackage(IOInterface $io, string $packageName, ?string $version = null)
- {
- $io->writeError('<info>Searching for the specified package.</info>');
- if ($composer = $this->tryComposer()) {
- $localRepo = $composer->getRepositoryManager()->getLocalRepository();
- $repo = new CompositeRepository(array_merge([$localRepo], $composer->getRepositoryManager()->getRepositories()));
- } else {
- $defaultRepos = RepositoryFactory::defaultReposWithDefaultManager($io);
- $io->writeError('No composer.json found in the current directory, searching packages from ' . implode(', ', array_keys($defaultRepos)));
- $repo = new CompositeRepository($defaultRepos);
- }
- $packages = $repo->findPackages($packageName, $version);
- if (count($packages) > 1) {
- $package = reset($packages);
- $io->writeError('<info>Found multiple matches, selected '.$package->getPrettyString().'.</info>');
- $io->writeError('Alternatives were '.implode(', ', array_map(static function ($p): string {
- return $p->getPrettyString();
- }, $packages)).'.');
- $io->writeError('<comment>Please use a more specific constraint to pick a different package.</comment>');
- } elseif ($packages) {
- $package = reset($packages);
- $io->writeError('<info>Found an exact match '.$package->getPrettyString().'.</info>');
- } else {
- $io->writeError('<error>Could not find a package matching '.$packageName.'.</error>');
- return false;
- }
- if (!$package instanceof CompletePackageInterface) {
- throw new \LogicException('Expected a CompletePackageInterface instance but found '.get_class($package));
- }
- return $package;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Command;
- use Composer\Composer;
- use Composer\Repository\RepositorySet;
- use Composer\Repository\RepositoryUtils;
- use Symfony\Component\Console\Input\InputInterface;
- use Symfony\Component\Console\Output\OutputInterface;
- use Composer\Package\PackageInterface;
- use Composer\Repository\InstalledRepository;
- use Composer\Advisory\Auditor;
- use Composer\Console\Input\InputOption;
- class AuditCommand extends BaseCommand
- {
- protected function configure(): void
- {
- $this
- ->setName('audit')
- ->setDescription('Checks for security vulnerability advisories for installed packages')
- ->setDefinition([
- new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables auditing of require-dev packages.'),
- new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Output format. Must be "table", "plain", "json", or "summary".', Auditor::FORMAT_TABLE, Auditor::FORMATS),
- new InputOption('locked', null, InputOption::VALUE_NONE, 'Audit based on the lock file instead of the installed packages.'),
- ])
- ->setHelp(
- <<<EOT
- The <info>audit</info> command checks for security vulnerability advisories for installed packages.
- If you do not want to include dev dependencies in the audit you can omit them with --no-dev
- Read more at https://getcomposer.org/doc/03-cli.md#audit
- EOT
- )
- ;
- }
- protected function execute(InputInterface $input, OutputInterface $output)
- {
- $composer = $this->requireComposer();
- $packages = $this->getPackages($composer, $input);
- if (count($packages) === 0) {
- $this->getIO()->writeError('No packages - skipping audit.');
- return 0;
- }
- $auditor = new Auditor();
- $repoSet = new RepositorySet();
- foreach ($composer->getRepositoryManager()->getRepositories() as $repo) {
- $repoSet->addRepository($repo);
- }
- return min(255, $auditor->audit($this->getIO(), $repoSet, $packages, $this->getAuditFormat($input, 'format'), false));
- }
- private function getPackages(Composer $composer, InputInterface $input): array
- {
- if ($input->getOption('locked')) {
- if (!$composer->getLocker()->isLocked()) {
- throw new \UnexpectedValueException('Valid composer.json and composer.lock files are required to run this command with --locked');
- }
- $locker = $composer->getLocker();
- return $locker->getLockedRepository(!$input->getOption('no-dev'))->getPackages();
- }
- $rootPkg = $composer->getPackage();
- $installedRepo = new InstalledRepository([$composer->getRepositoryManager()->getLocalRepository()]);
- if ($input->getOption('no-dev')) {
- return RepositoryUtils::filterRequiredPackages($installedRepo->getPackages(), $rootPkg);
- }
- return $installedRepo->getPackages();
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Command;
- use Composer\Composer;
- use Composer\Config;
- use Composer\Console\Application;
- use Composer\Console\Input\InputArgument;
- use Composer\Console\Input\InputOption;
- use Composer\Factory;
- use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterFactory;
- use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterInterface;
- use Composer\IO\IOInterface;
- use Composer\IO\NullIO;
- use Composer\Plugin\PreCommandRunEvent;
- use Composer\Package\Version\VersionParser;
- use Composer\Plugin\PluginEvents;
- use Composer\Advisory\Auditor;
- use Composer\Util\Platform;
- use Symfony\Component\Console\Completion\CompletionInput;
- use Symfony\Component\Console\Completion\CompletionSuggestions;
- use Symfony\Component\Console\Helper\Table;
- use Symfony\Component\Console\Helper\TableSeparator;
- use Symfony\Component\Console\Input\InputInterface;
- use Symfony\Component\Console\Output\OutputInterface;
- use Symfony\Component\Console\Command\Command;
- use Symfony\Component\Console\Terminal;
- abstract class BaseCommand extends Command
- {
- private $composer;
- private $io;
- public function getApplication(): Application
- {
- $application = parent::getApplication();
- if (!$application instanceof Application) {
- throw new \RuntimeException('Composer commands can only work with an '.Application::class.' instance set');
- }
- return $application;
- }
- public function getComposer(bool $required = true, ?bool $disablePlugins = null, ?bool $disableScripts = null)
- {
- if ($required) {
- return $this->requireComposer($disablePlugins, $disableScripts);
- }
- return $this->tryComposer($disablePlugins, $disableScripts);
- }
- public function requireComposer(?bool $disablePlugins = null, ?bool $disableScripts = null): Composer
- {
- if (null === $this->composer) {
- $application = parent::getApplication();
- if ($application instanceof Application) {
- $this->composer = $application->getComposer(true, $disablePlugins, $disableScripts);
- assert($this->composer instanceof Composer);
- } else {
- throw new \RuntimeException(
- 'Could not create a Composer\Composer instance, you must inject '.
- 'one if this command is not used with a Composer\Console\Application instance'
- );
- }
- }
- return $this->composer;
- }
- public function tryComposer(?bool $disablePlugins = null, ?bool $disableScripts = null): ?Composer
- {
- if (null === $this->composer) {
- $application = parent::getApplication();
- if ($application instanceof Application) {
- $this->composer = $application->getComposer(false, $disablePlugins, $disableScripts);
- }
- }
- return $this->composer;
- }
- public function setComposer(Composer $composer)
- {
- $this->composer = $composer;
- }
- public function resetComposer()
- {
- $this->composer = null;
- $this->getApplication()->resetComposer();
- }
- public function isProxyCommand()
- {
- return false;
- }
- public function getIO()
- {
- if (null === $this->io) {
- $application = parent::getApplication();
- if ($application instanceof Application) {
- $this->io = $application->getIO();
- } else {
- $this->io = new NullIO();
- }
- }
- return $this->io;
- }
- public function setIO(IOInterface $io)
- {
- $this->io = $io;
- }
- public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void
- {
- $definition = $this->getDefinition();
- $name = (string) $input->getCompletionName();
- if (CompletionInput::TYPE_OPTION_VALUE === $input->getCompletionType()
- && $definition->hasOption($name)
- && ($option = $definition->getOption($name)) instanceof InputOption
- ) {
- $option->complete($input, $suggestions);
- } elseif (CompletionInput::TYPE_ARGUMENT_VALUE === $input->getCompletionType()
- && $definition->hasArgument($name)
- && ($argument = $definition->getArgument($name)) instanceof InputArgument
- ) {
- $argument->complete($input, $suggestions);
- } else {
- parent::complete($input, $suggestions);
- }
- }
- protected function initialize(InputInterface $input, OutputInterface $output)
- {
- $disablePlugins = $input->hasParameterOption('--no-plugins');
- $disableScripts = $input->hasParameterOption('--no-scripts');
- if ($this instanceof SelfUpdateCommand) {
- $disablePlugins = true;
- $disableScripts = true;
- }
- $composer = $this->tryComposer($disablePlugins, $disableScripts);
- $io = $this->getIO();
- if (null === $composer) {
- $composer = Factory::createGlobal($this->getIO(), $disablePlugins, $disableScripts);
- }
- if ($composer) {
- $preCommandRunEvent = new PreCommandRunEvent(PluginEvents::PRE_COMMAND_RUN, $input, $this->getName());
- $composer->getEventDispatcher()->dispatch($preCommandRunEvent->getName(), $preCommandRunEvent);
- }
- if (true === $input->hasParameterOption(['--no-ansi']) && $input->hasOption('no-progress')) {
- $input->setOption('no-progress', true);
- }
- $envOptions = [
- 'COMPOSER_NO_AUDIT' => ['no-audit'],
- 'COMPOSER_NO_DEV' => ['no-dev', 'update-no-dev'],
- 'COMPOSER_PREFER_STABLE' => ['prefer-stable'],
- 'COMPOSER_PREFER_LOWEST' => ['prefer-lowest'],
- ];
- foreach ($envOptions as $envName => $optionNames) {
- foreach ($optionNames as $optionName) {
- if (true === $input->hasOption($optionName)) {
- if (false === $input->getOption($optionName) && (bool) Platform::getEnv($envName)) {
- $input->setOption($optionName, true);
- }
- }
- }
- }
- if (true === $input->hasOption('ignore-platform-reqs')) {
- if (!$input->getOption('ignore-platform-reqs') && (bool) Platform::getEnv('COMPOSER_IGNORE_PLATFORM_REQS')) {
- $input->setOption('ignore-platform-reqs', true);
- $io->writeError('<warning>COMPOSER_IGNORE_PLATFORM_REQS is set. You may experience unexpected errors.</warning>');
- }
- }
- if (true === $input->hasOption('ignore-platform-req') && (!$input->hasOption('ignore-platform-reqs') || !$input->getOption('ignore-platform-reqs'))) {
- $ignorePlatformReqEnv = Platform::getEnv('COMPOSER_IGNORE_PLATFORM_REQ');
- if (0 === count($input->getOption('ignore-platform-req')) && is_string($ignorePlatformReqEnv) && '' !== $ignorePlatformReqEnv) {
- $input->setOption('ignore-platform-req', explode(',', $ignorePlatformReqEnv));
- $io->writeError('<warning>COMPOSER_IGNORE_PLATFORM_REQ is set to ignore '.$ignorePlatformReqEnv.'. You may experience unexpected errors.</warning>');
- }
- }
- parent::initialize($input, $output);
- }
- protected function getPreferredInstallOptions(Config $config, InputInterface $input, bool $keepVcsRequiresPreferSource = false)
- {
- $preferSource = false;
- $preferDist = false;
- switch ($config->get('preferred-install')) {
- case 'source':
- $preferSource = true;
- break;
- case 'dist':
- $preferDist = true;
- break;
- case 'auto':
- default:
- break;
- }
- if (!$input->hasOption('prefer-dist') || !$input->hasOption('prefer-source')) {
- return [$preferSource, $preferDist];
- }
- if ($input->hasOption('prefer-install') && is_string($input->getOption('prefer-install'))) {
- if ($input->getOption('prefer-source')) {
- throw new \InvalidArgumentException('--prefer-source can not be used together with --prefer-install');
- }
- if ($input->getOption('prefer-dist')) {
- throw new \InvalidArgumentException('--prefer-dist can not be used together with --prefer-install');
- }
- switch ($input->getOption('prefer-install')) {
- case 'dist':
- $input->setOption('prefer-dist', true);
- break;
- case 'source':
- $input->setOption('prefer-source', true);
- break;
- case 'auto':
- $preferDist = false;
- $preferSource = false;
- break;
- default:
- throw new \UnexpectedValueException('--prefer-install accepts one of "dist", "source" or "auto", got '.$input->getOption('prefer-install'));
- }
- }
- if ($input->getOption('prefer-source') || $input->getOption('prefer-dist') || ($keepVcsRequiresPreferSource && $input->hasOption('keep-vcs') && $input->getOption('keep-vcs'))) {
- $preferSource = $input->getOption('prefer-source') || ($keepVcsRequiresPreferSource && $input->hasOption('keep-vcs') && $input->getOption('keep-vcs'));
- $preferDist = $input->getOption('prefer-dist');
- }
- return [$preferSource, $preferDist];
- }
- protected function getPlatformRequirementFilter(InputInterface $input): PlatformRequirementFilterInterface
- {
- if (!$input->hasOption('ignore-platform-reqs') || !$input->hasOption('ignore-platform-req')) {
- throw new \LogicException('Calling getPlatformRequirementFilter from a command which does not define the --ignore-platform-req[s] flags is not permitted.');
- }
- if (true === $input->getOption('ignore-platform-reqs')) {
- return PlatformRequirementFilterFactory::ignoreAll();
- }
- $ignores = $input->getOption('ignore-platform-req');
- if (count($ignores) > 0) {
- return PlatformRequirementFilterFactory::fromBoolOrList($ignores);
- }
- return PlatformRequirementFilterFactory::ignoreNothing();
- }
- protected function formatRequirements(array $requirements)
- {
- $requires = [];
- $requirements = $this->normalizeRequirements($requirements);
- foreach ($requirements as $requirement) {
- if (!isset($requirement['version'])) {
- throw new \UnexpectedValueException('Option '.$requirement['name'] .' is missing a version constraint, use e.g. '.$requirement['name'].':^1.0');
- }
- $requires[$requirement['name']] = $requirement['version'];
- }
- return $requires;
- }
- protected function normalizeRequirements(array $requirements)
- {
- $parser = new VersionParser();
- return $parser->parseNameVersionPairs($requirements);
- }
- protected function renderTable(array $table, OutputInterface $output)
- {
- $renderer = new Table($output);
- $renderer->setStyle('compact');
- $renderer->setRows($table)->render();
- }
- protected function getTerminalWidth()
- {
- $terminal = new Terminal();
- $width = $terminal->getWidth();
- if (Platform::isWindows()) {
- $width--;
- } else {
- $width = max(80, $width);
- }
- return $width;
- }
- protected function getAuditFormat(InputInterface $input, string $optName = 'audit-format'): string
- {
- if (!$input->hasOption($optName)) {
- throw new \LogicException('This should not be called on a Command which has no '.$optName.' option defined.');
- }
- $val = $input->getOption($optName);
- if (!in_array($val, Auditor::FORMATS, true)) {
- throw new \InvalidArgumentException('--'.$optName.' must be one of '.implode(', ', Auditor::FORMATS).'.');
- }
- return $val;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Command;
- use Composer\Package\Link;
- use Composer\Package\PackageInterface;
- use Composer\Package\CompletePackageInterface;
- use Composer\Package\RootPackage;
- use Composer\Repository\InstalledArrayRepository;
- use Composer\Repository\CompositeRepository;
- use Composer\Repository\RootPackageRepository;
- use Composer\Repository\InstalledRepository;
- use Composer\Repository\PlatformRepository;
- use Composer\Repository\RepositoryFactory;
- use Composer\Plugin\CommandEvent;
- use Composer\Plugin\PluginEvents;
- use Symfony\Component\Console\Formatter\OutputFormatterStyle;
- use Composer\Package\Version\VersionParser;
- use Symfony\Component\Console\Input\InputInterface;
- use Symfony\Component\Console\Output\OutputInterface;
- abstract class BaseDependencyCommand extends BaseCommand
- {
- protected const ARGUMENT_PACKAGE = 'package';
- protected const ARGUMENT_CONSTRAINT = 'version';
- protected const OPTION_RECURSIVE = 'recursive';
- protected const OPTION_TREE = 'tree';
- protected $colors;
- protected function doExecute(InputInterface $input, OutputInterface $output, bool $inverted = false): int
- {
- $composer = $this->requireComposer();
- $commandEvent = new CommandEvent(PluginEvents::COMMAND, $this->getName(), $input, $output);
- $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
- $repos = [];
- $repos[] = new RootPackageRepository(clone $composer->getPackage());
- if ($input->getOption('locked')) {
- $locker = $composer->getLocker();
- if (!$locker->isLocked()) {
- throw new \UnexpectedValueException('A valid composer.lock file is required to run this command with --locked');
- }
- $repos[] = $locker->getLockedRepository(true);
- $repos[] = new PlatformRepository([], $locker->getPlatformOverrides());
- } else {
- $localRepo = $composer->getRepositoryManager()->getLocalRepository();
- $rootPkg = $composer->getPackage();
- if (count($localRepo->getPackages()) === 0 && (count($rootPkg->getRequires()) > 0 || count($rootPkg->getDevRequires()) > 0)) {
- $output->writeln('<warning>No dependencies installed. Try running composer install or update, or use --locked.</warning>');
- return 1;
- }
- $repos[] = $localRepo;
- $platformOverrides = $composer->getConfig()->get('platform') ?: [];
- $repos[] = new PlatformRepository([], $platformOverrides);
- }
- $installedRepo = new InstalledRepository($repos);
- [$needle, $textConstraint] = array_pad(
- explode(':', $input->getArgument(self::ARGUMENT_PACKAGE)),
- 2,
- $input->hasArgument(self::ARGUMENT_CONSTRAINT) ? $input->getArgument(self::ARGUMENT_CONSTRAINT) : '*'
- );
- $packages = $installedRepo->findPackagesWithReplacersAndProviders($needle);
- if (empty($packages)) {
- throw new \InvalidArgumentException(sprintf('Could not find package "%s" in your project', $needle));
- }
- if (!$installedRepo->findPackage($needle, $textConstraint)) {
- $defaultRepos = new CompositeRepository(RepositoryFactory::defaultRepos($this->getIO(), $composer->getConfig(), $composer->getRepositoryManager()));
- if ($match = $defaultRepos->findPackage($needle, $textConstraint)) {
- $installedRepo->addRepository(new InstalledArrayRepository([clone $match]));
- }
- }
- $needles = [$needle];
- if ($inverted) {
- foreach ($packages as $package) {
- $needles = array_merge($needles, array_map(static function (Link $link): string {
- return $link->getTarget();
- }, $package->getReplaces()));
- }
- }
- if ('*' !== $textConstraint) {
- $versionParser = new VersionParser();
- $constraint = $versionParser->parseConstraints($textConstraint);
- } else {
- $constraint = null;
- }
- $renderTree = $input->getOption(self::OPTION_TREE);
- $recursive = $renderTree || $input->getOption(self::OPTION_RECURSIVE);
- $results = $installedRepo->getDependents($needles, $constraint, $inverted, $recursive);
- if (empty($results)) {
- $extra = (null !== $constraint) ? sprintf(' in versions %smatching %s', $inverted ? 'not ' : '', $textConstraint) : '';
- $this->getIO()->writeError(sprintf(
- '<info>There is no installed package depending on "%s"%s</info>',
- $needle,
- $extra
- ));
- } elseif ($renderTree) {
- $this->initStyles($output);
- $root = $packages[0];
- $this->getIO()->write(sprintf('<info>%s</info> %s %s', $root->getPrettyName(), $root->getPrettyVersion(), $root instanceof CompletePackageInterface ? $root->getDescription() : ''));
- $this->printTree($results);
- } else {
- $this->printTable($output, $results);
- }
- if ($inverted && $input->hasArgument(self::ARGUMENT_CONSTRAINT)) {
- $this->getIO()->writeError('Not finding what you were looking for? Try calling `composer update "'.$input->getArgument(self::ARGUMENT_PACKAGE).':'.$input->getArgument(self::ARGUMENT_CONSTRAINT).'" --dry-run` to get another view on the problem.');
- }
- return 0;
- }
- protected function printTable(OutputInterface $output, $results): void
- {
- $table = [];
- $doubles = [];
- do {
- $queue = [];
- $rows = [];
- foreach ($results as $result) {
- [$package, $link, $children] = $result;
- $unique = (string) $link;
- if (isset($doubles[$unique])) {
- continue;
- }
- $doubles[$unique] = true;
- $version = $package->getPrettyVersion() === RootPackage::DEFAULT_PRETTY_VERSION ? '-' : $package->getPrettyVersion();
- $rows[] = [$package->getPrettyName(), $version, $link->getDescription(), sprintf('%s (%s)', $link->getTarget(), $link->getPrettyConstraint())];
- if ($children) {
- $queue = array_merge($queue, $children);
- }
- }
- $results = $queue;
- $table = array_merge($rows, $table);
- } while (!empty($results));
- $this->renderTable($table, $output);
- }
- protected function initStyles(OutputInterface $output): void
- {
- $this->colors = [
- 'green',
- 'yellow',
- 'cyan',
- 'magenta',
- 'blue',
- ];
- foreach ($this->colors as $color) {
- $style = new OutputFormatterStyle($color);
- $output->getFormatter()->setStyle($color, $style);
- }
- }
- protected function printTree(array $results, string $prefix = '', int $level = 1): void
- {
- $count = count($results);
- $idx = 0;
- foreach ($results as $result) {
- [$package, $link, $children] = $result;
- $color = $this->colors[$level % count($this->colors)];
- $prevColor = $this->colors[($level - 1) % count($this->colors)];
- $isLast = (++$idx === $count);
- $versionText = $package->getPrettyVersion() === RootPackage::DEFAULT_PRETTY_VERSION ? '' : $package->getPrettyVersion();
- $packageText = rtrim(sprintf('<%s>%s</%1$s> %s', $color, $package->getPrettyName(), $versionText));
- $linkText = sprintf('%s <%s>%s</%2$s> %s', $link->getDescription(), $prevColor, $link->getTarget(), $link->getPrettyConstraint());
- $circularWarn = $children === false ? '(circular dependency aborted here)' : '';
- $this->writeTreeLine(rtrim(sprintf("%s%s%s (%s) %s", $prefix, $isLast ? '└──' : '├──', $packageText, $linkText, $circularWarn)));
- if ($children) {
- $this->printTree($children, $prefix . ($isLast ? ' ' : '│ '), $level + 1);
- }
- }
- }
- private function writeTreeLine(string $line): void
- {
- $io = $this->getIO();
- if (!$io->isDecorated()) {
- $line = str_replace(['└', '├', '──', '│'], ['`-', '|-', '-', '|'], $line);
- }
- $io->write($line);
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Command;
- use Composer\Package\AliasPackage;
- use Composer\Package\Locker;
- use Composer\Package\Version\VersionBumper;
- use Composer\Util\Filesystem;
- use Symfony\Component\Console\Input\InputInterface;
- use Composer\Console\Input\InputArgument;
- use Composer\Console\Input\InputOption;
- use Symfony\Component\Console\Output\OutputInterface;
- use Composer\Factory;
- use Composer\Json\JsonFile;
- use Composer\Json\JsonManipulator;
- use Composer\Repository\PlatformRepository;
- use Composer\Util\Silencer;
- final class BumpCommand extends BaseCommand
- {
- private const ERROR_GENERIC = 1;
- private const ERROR_LOCK_OUTDATED = 2;
- use CompletionTrait;
- protected function configure(): void
- {
- $this
- ->setName('bump')
- ->setDescription('Increases the lower limit of your composer.json requirements to the currently installed versions')
- ->setDefinition([
- new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Optional package name(s) to restrict which packages are bumped.', null, $this->suggestRootRequirement()),
- new InputOption('dev-only', 'D', InputOption::VALUE_NONE, 'Only bump requirements in "require-dev".'),
- new InputOption('no-dev-only', 'R', InputOption::VALUE_NONE, 'Only bump requirements in "require".'),
- ])
- ->setHelp(
- <<<EOT
- The <info>bump</info> command increases the lower limit of your composer.json requirements
- to the currently installed versions. This helps to ensure your dependencies do not
- accidentally get downgraded due to some other conflict, and can slightly improve
- dependency resolution performance as it limits the amount of package versions
- Composer has to look at.
- Running this blindly on libraries is **NOT** recommended as it will narrow down
- your allowed dependencies, which may cause dependency hell for your users.
- Running it with <info>--dev-only</info> on libraries may be fine however as dev requirements
- are local to the library and do not affect consumers of the package.
- EOT
- )
- ;
- }
- protected function execute(InputInterface $input, OutputInterface $output)
- {
- $composerJsonPath = Factory::getComposerFile();
- $io = $this->getIO();
- if (!Filesystem::isReadable($composerJsonPath)) {
- $io->writeError('<error>'.$composerJsonPath.' is not readable.</error>');
- return self::ERROR_GENERIC;
- }
- $composerJson = new JsonFile($composerJsonPath);
- $contents = file_get_contents($composerJson->getPath());
- if (false === $contents) {
- $io->writeError('<error>'.$composerJsonPath.' is not readable.</error>');
- return self::ERROR_GENERIC;
- }
- if (!is_writable($composerJsonPath) && false === Silencer::call('file_put_contents', $composerJsonPath, $contents)) {
- $io->writeError('<error>'.$composerJsonPath.' is not writable.</error>');
- return self::ERROR_GENERIC;
- }
- unset($contents);
- $composer = $this->requireComposer();
- if ($composer->getLocker()->isLocked()) {
- if (!$composer->getLocker()->isFresh()) {
- $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>');
- return self::ERROR_LOCK_OUTDATED;
- }
- $repo = $composer->getLocker()->getLockedRepository(true);
- } else {
- $repo = $composer->getRepositoryManager()->getLocalRepository();
- }
- if ($composer->getPackage()->getType() !== 'project' && !$input->getOption('dev-only')) {
- $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>');
- $contents = $composerJson->read();
- if (!isset($contents['type'])) {
- $io->writeError('<warning>If your package is not a library, you can explicitly specify the "type" by using "composer config type project".</warning>');
- $io->writeError('<warning>Alternatively you can use --dev-only to only bump dependencies within "require-dev".</warning>');
- }
- unset($contents);
- }
- $bumper = new VersionBumper();
- $tasks = [];
- if (!$input->getOption('no-dev-only')) {
- $tasks['require-dev'] = $composer->getPackage()->getDevRequires();
- }
- if (!$input->getOption('dev-only')) {
- $tasks['require'] = $composer->getPackage()->getRequires();
- }
- $updates = [];
- foreach ($tasks as $key => $reqs) {
- foreach ($reqs as $pkgName => $link) {
- if (PlatformRepository::isPlatformPackage($pkgName)) {
- continue;
- }
- $currentConstraint = $link->getPrettyConstraint();
- $package = $repo->findPackage($pkgName, '*');
- if (null === $package) {
- continue;
- }
- while ($package instanceof AliasPackage) {
- $package = $package->getAliasOf();
- }
- $bumped = $bumper->bumpRequirement($link->getConstraint(), $package);
- if ($bumped === $currentConstraint) {
- continue;
- }
- $updates[$key][$pkgName] = $bumped;
- }
- }
- if (!$this->updateFileCleanly($composerJson, $updates)) {
- $composerDefinition = $composerJson->read();
- foreach ($updates as $key => $packages) {
- foreach ($packages as $package => $version) {
- $composerDefinition[$key][$package] = $version;
- }
- }
- $composerJson->write($composerDefinition);
- }
- $changeCount = array_sum(array_map('count', $updates));
- if ($changeCount > 0) {
- $io->write('<info>'.$composerJsonPath.' has been updated ('.$changeCount.' changes).</info>');
- } else {
- $io->write('<info>No requirements to update in '.$composerJsonPath.'.</info>');
- }
- if ($composer->getLocker()->isLocked() && $changeCount > 0) {
- $contents = file_get_contents($composerJson->getPath());
- if (false === $contents) {
- throw new \RuntimeException('Unable to read '.$composerJson->getPath().' contents to update the lock file hash.');
- }
- $lock = new JsonFile(Factory::getLockFile($composerJsonPath));
- $lockData = $lock->read();
- $lockData['content-hash'] = Locker::getContentHash($contents);
- $lock->write($lockData);
- }
- return 0;
- }
- private function updateFileCleanly(JsonFile $json, array $updates): bool
- {
- $contents = file_get_contents($json->getPath());
- if (false === $contents) {
- throw new \RuntimeException('Unable to read '.$json->getPath().' contents.');
- }
- $manipulator = new JsonManipulator($contents);
- foreach ($updates as $key => $packages) {
- foreach ($packages as $package => $version) {
- if (!$manipulator->addLink($key, $package, $version)) {
- return false;
- }
- }
- }
- if (false === file_put_contents($json->getPath(), $manipulator->getContents())) {
- throw new \RuntimeException('Unable to write new '.$json->getPath().' contents.');
- }
- return true;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Command;
- use Composer\Package\Link;
- use Composer\Semver\Constraint\Constraint;
- use Symfony\Component\Console\Input\InputInterface;
- use Composer\Console\Input\InputOption;
- use Symfony\Component\Console\Output\OutputInterface;
- use Composer\Repository\PlatformRepository;
- use Composer\Repository\RootPackageRepository;
- use Composer\Repository\InstalledRepository;
- use Composer\Json\JsonFile;
- class CheckPlatformReqsCommand extends BaseCommand
- {
- protected function configure(): void
- {
- $this->setName('check-platform-reqs')
- ->setDescription('Check that platform requirements are satisfied')
- ->setDefinition([
- new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables checking of require-dev packages requirements.'),
- new InputOption('lock', null, InputOption::VALUE_NONE, 'Checks requirements only from the lock file, not from installed packages.'),
- new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the output: text or json', 'text', ['json', 'text']),
- ])
- ->setHelp(
- <<<EOT
- Checks that your PHP and extensions versions match the platform requirements of the installed packages.
- 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.
- <info>php composer.phar check-platform-reqs</info>
- EOT
- );
- }
- protected function execute(InputInterface $input, OutputInterface $output): int
- {
- $composer = $this->requireComposer();
- $requires = [];
- $removePackages = [];
- if ($input->getOption('lock')) {
- $this->getIO()->writeError('<info>Checking '.($input->getOption('no-dev') ? 'non-dev ' : '').'platform requirements using the lock file</info>');
- $installedRepo = $composer->getLocker()->getLockedRepository(!$input->getOption('no-dev'));
- } else {
- $installedRepo = $composer->getRepositoryManager()->getLocalRepository();
- if (!$installedRepo->getPackages()) {
- $this->getIO()->writeError('<warning>No vendor dir present, checking '.($input->getOption('no-dev') ? 'non-dev ' : '').'platform requirements from the lock file</warning>');
- $installedRepo = $composer->getLocker()->getLockedRepository(!$input->getOption('no-dev'));
- } else {
- if ($input->getOption('no-dev')) {
- $removePackages = $installedRepo->getDevPackageNames();
- }
- $this->getIO()->writeError('<info>Checking '.($input->getOption('no-dev') ? 'non-dev ' : '').'platform requirements for packages in the vendor dir</info>');
- }
- }
- if (!$input->getOption('no-dev')) {
- $requires += $composer->getPackage()->getDevRequires();
- }
- foreach ($requires as $require => $link) {
- $requires[$require] = [$link];
- }
- $installedRepo = new InstalledRepository([$installedRepo, new RootPackageRepository(clone $composer->getPackage())]);
- foreach ($installedRepo->getPackages() as $package) {
- if (in_array($package->getName(), $removePackages, true)) {
- continue;
- }
- foreach ($package->getRequires() as $require => $link) {
- $requires[$require][] = $link;
- }
- }
- ksort($requires);
- $installedRepo->addRepository(new PlatformRepository([], []));
- $results = [];
- $exitCode = 0;
- foreach ($requires as $require => $links) {
- if (PlatformRepository::isPlatformPackage($require)) {
- $candidates = $installedRepo->findPackagesWithReplacersAndProviders($require);
- if ($candidates) {
- $reqResults = [];
- foreach ($candidates as $candidate) {
- $candidateConstraint = null;
- if ($candidate->getName() === $require) {
- $candidateConstraint = new Constraint('=', $candidate->getVersion());
- $candidateConstraint->setPrettyString($candidate->getPrettyVersion());
- } else {
- foreach (array_merge($candidate->getProvides(), $candidate->getReplaces()) as $link) {
- if ($link->getTarget() === $require) {
- $candidateConstraint = $link->getConstraint();
- break;
- }
- }
- }
- if (!$candidateConstraint) {
- continue;
- }
- foreach ($links as $link) {
- if (!$link->getConstraint()->matches($candidateConstraint)) {
- $reqResults[] = [
- $candidate->getName() === $require ? $candidate->getPrettyName() : $require,
- $candidateConstraint->getPrettyString(),
- $link,
- '<error>failed</error>',
- $candidate->getName() === $require ? '' : '<comment>provided by '.$candidate->getPrettyName().'</comment>',
- ];
- continue 2;
- }
- }
- $results[] = [
- $candidate->getName() === $require ? $candidate->getPrettyName() : $require,
- $candidateConstraint->getPrettyString(),
- null,
- '<info>success</info>',
- $candidate->getName() === $require ? '' : '<comment>provided by '.$candidate->getPrettyName().'</comment>',
- ];
- continue 2;
- }
- $results = array_merge($results, $reqResults);
- $exitCode = max($exitCode, 1);
- continue;
- }
- $results[] = [
- $require,
- 'n/a',
- $links[0],
- '<error>missing</error>',
- '',
- ];
- $exitCode = max($exitCode, 2);
- }
- }
- $this->printTable($output, $results, $input->getOption('format'));
- return $exitCode;
- }
- protected function printTable(OutputInterface $output, array $results, string $format): void
- {
- $rows = [];
- foreach ($results as $result) {
- [$platformPackage, $version, $link, $status, $provider] = $result;
- if ('json' === $format) {
- $rows[] = [
- "name" => $platformPackage,
- "version" => $version,
- "status" => strip_tags($status),
- "failed_requirement" => $link instanceof Link ? [
- 'source' => $link->getSource(),
- 'type' => $link->getDescription(),
- 'target' => $link->getTarget(),
- 'constraint' => $link->getPrettyConstraint(),
- ] : null,
- "provider" => $provider === '' ? null : strip_tags($provider),
- ];
- } else {
- $rows[] = [
- $platformPackage,
- $version,
- $link,
- $link ? sprintf('%s %s %s (%s)', $link->getSource(), $link->getDescription(), $link->getTarget(), $link->getPrettyConstraint()) : '',
- rtrim($status.' '.$provider),
- ];
- }
- }
- if ('json' === $format) {
- $this->getIO()->write(JsonFile::encode($rows));
- } else {
- $this->renderTable($rows, $output);
- }
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Command;
- use Composer\Cache;
- use Composer\Factory;
- use Symfony\Component\Console\Input\InputInterface;
- use Symfony\Component\Console\Input\InputOption;
- use Symfony\Component\Console\Output\OutputInterface;
- class ClearCacheCommand extends BaseCommand
- {
- protected function configure(): void
- {
- $this
- ->setName('clear-cache')
- ->setAliases(['clearcache', 'cc'])
- ->setDescription('Clears composer\'s internal package cache')
- ->setDefinition([
- new InputOption('gc', null, InputOption::VALUE_NONE, 'Only run garbage collection, not a full cache clear'),
- ])
- ->setHelp(
- <<<EOT
- The <info>clear-cache</info> deletes all cached packages from composer's
- cache directory.
- Read more at https://getcomposer.org/doc/03-cli.md#clear-cache-clearcache-cc
- EOT
- )
- ;
- }
- protected function execute(InputInterface $input, OutputInterface $output): int
- {
- $config = Factory::createConfig();
- $io = $this->getIO();
- $cachePaths = [
- 'cache-vcs-dir' => $config->get('cache-vcs-dir'),
- 'cache-repo-dir' => $config->get('cache-repo-dir'),
- 'cache-files-dir' => $config->get('cache-files-dir'),
- 'cache-dir' => $config->get('cache-dir'),
- ];
- foreach ($cachePaths as $key => $cachePath) {
- if ($key === 'cache-dir' && $input->getOption('gc')) {
- continue;
- }
- $cachePath = realpath($cachePath);
- if (!$cachePath) {
- $io->writeError("<info>Cache directory does not exist ($key): $cachePath</info>");
- continue;
- }
- $cache = new Cache($io, $cachePath);
- $cache->setReadOnly($config->get('cache-read-only'));
- if (!$cache->isEnabled()) {
- $io->writeError("<info>Cache is not enabled ($key): $cachePath</info>");
- continue;
- }
- if ($input->getOption('gc')) {
- $io->writeError("<info>Garbage-collecting cache ($key): $cachePath</info>");
- if ($key === 'cache-files-dir') {
- $cache->gc($config->get('cache-files-ttl'), $config->get('cache-files-maxsize'));
- } elseif ($key === 'cache-repo-dir') {
- $cache->gc($config->get('cache-ttl'), 1024 * 1024 * 1024 );
- } elseif ($key === 'cache-vcs-dir') {
- $cache->gcVcsCache($config->get('cache-ttl'));
- }
- } else {
- $io->writeError("<info>Clearing cache ($key): $cachePath</info>");
- $cache->clear();
- }
- }
- if ($input->getOption('gc')) {
- $io->writeError('<info>All caches garbage-collected.</info>');
- } else {
- $io->writeError('<info>All caches cleared.</info>');
- }
- return 0;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Command;
- use Composer\Composer;
- use Composer\Package\BasePackage;
- use Composer\Package\PackageInterface;
- use Composer\Pcre\Preg;
- use Composer\Repository\CompositeRepository;
- use Composer\Repository\InstalledRepository;
- use Composer\Repository\PlatformRepository;
- use Composer\Repository\RepositoryInterface;
- use Composer\Repository\RootPackageRepository;
- use Symfony\Component\Console\Completion\CompletionInput;
- trait CompletionTrait
- {
- abstract public function requireComposer(?bool $disablePlugins = null, ?bool $disableScripts = null): Composer;
- private function suggestPreferInstall(): array
- {
- return ['dist', 'source', 'auto'];
- }
- private function suggestRootRequirement(): \Closure
- {
- return function (CompletionInput $input): array {
- $composer = $this->requireComposer();
- return array_merge(array_keys($composer->getPackage()->getRequires()), array_keys($composer->getPackage()->getDevRequires()));
- };
- }
- private function suggestInstalledPackage(bool $includeRootPackage = true, bool $includePlatformPackages = false): \Closure
- {
- return function (CompletionInput $input) use ($includeRootPackage, $includePlatformPackages): array {
- $composer = $this->requireComposer();
- $installedRepos = [];
- if ($includeRootPackage) {
- $installedRepos[] = new RootPackageRepository(clone $composer->getPackage());
- }
- $locker = $composer->getLocker();
- if ($locker->isLocked()) {
- $installedRepos[] = $locker->getLockedRepository(true);
- } else {
- $installedRepos[] = $composer->getRepositoryManager()->getLocalRepository();
- }
- $platformHint = [];
- if ($includePlatformPackages) {
- if ($locker->isLocked()) {
- $platformRepo = new PlatformRepository([], $locker->getPlatformOverrides());
- } else {
- $platformRepo = new PlatformRepository([], $composer->getConfig()->get('platform'));
- }
- if ($input->getCompletionValue() === '') {
- $hintsToFind = ['ext-' => 0, 'lib-' => 0, 'php' => 99, 'composer' => 99];
- foreach ($platformRepo->getPackages() as $pkg) {
- foreach ($hintsToFind as $hintPrefix => $hintCount) {
- if (str_starts_with($pkg->getName(), $hintPrefix)) {
- if ($hintCount === 0 || $hintCount >= 99) {
- $platformHint[] = $pkg->getName();
- $hintsToFind[$hintPrefix]++;
- } elseif ($hintCount === 1) {
- unset($hintsToFind[$hintPrefix]);
- $platformHint[] = substr($pkg->getName(), 0, max(strlen($pkg->getName()) - 3, strlen($hintPrefix) + 1)).'...';
- }
- continue 2;
- }
- }
- }
- } else {
- $installedRepos[] = $platformRepo;
- }
- }
- $installedRepo = new InstalledRepository($installedRepos);
- return array_merge(
- array_map(static function (PackageInterface $package) {
- return $package->getName();
- }, $installedRepo->getPackages()),
- $platformHint
- );
- };
- }
- private function suggestAvailablePackage(int $max = 99): \Closure
- {
- return function (CompletionInput $input) use ($max): array {
- if ($max < 1) {
- return [];
- }
- $composer = $this->requireComposer();
- $repos = new CompositeRepository($composer->getRepositoryManager()->getRepositories());
- $results = [];
- $showVendors = false;
- if (!str_contains($input->getCompletionValue(), '/')) {
- $results = $repos->search('^' . preg_quote($input->getCompletionValue()), RepositoryInterface::SEARCH_VENDOR);
- $showVendors = true;
- }
- if (\count($results) <= 1) {
- $results = $repos->search('^'.preg_quote($input->getCompletionValue()), RepositoryInterface::SEARCH_NAME);
- $showVendors = false;
- }
- $results = array_column($results, 'name');
- if ($showVendors) {
- $results = array_map(static function (string $name): string {
- return $name.'/';
- }, $results);
- usort($results, static function (string $a, string $b) {
- $lenA = \strlen($a);
- $lenB = \strlen($b);
- if ($lenA === $lenB) {
- return $a <=> $b;
- }
- return $lenA - $lenB;
- });
- $pinned = [];
- $completionInput = $input->getCompletionValue().'/';
- if (false !== ($exactIndex = array_search($completionInput, $results, true))) {
- $pinned[] = $completionInput;
- array_splice($results, $exactIndex, 1);
- }
- return array_merge($pinned, array_slice($results, 0, $max - \count($pinned)));
- }
- return array_slice($results, 0, $max);
- };
- }
- private function suggestAvailablePackageInclPlatform(): \Closure
- {
- return function (CompletionInput $input): array {
- if (Preg::isMatch('{^(ext|lib|php)(-|$)|^com}', $input->getCompletionValue())) {
- $matches = $this->suggestPlatformPackage()($input);
- } else {
- $matches = [];
- }
- return array_merge($matches, $this->suggestAvailablePackage(99 - \count($matches))($input));
- };
- }
- private function suggestPlatformPackage(): \Closure
- {
- return function (CompletionInput $input): array {
- $repos = new PlatformRepository([], $this->requireComposer()->getConfig()->get('platform'));
- $pattern = BasePackage::packageNameToRegexp($input->getCompletionValue().'*');
- return array_filter(array_map(static function (PackageInterface $package) {
- return $package->getName();
- }, $repos->getPackages()), static function (string $name) use ($pattern): bool {
- return Preg::isMatch($pattern, $name);
- });
- };
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Command;
- use Composer\Pcre\Preg;
- use Composer\Util\Filesystem;
- use Composer\Util\Platform;
- use Composer\Util\Silencer;
- use Symfony\Component\Console\Input\InputInterface;
- use Symfony\Component\Console\Input\InputArgument;
- use Symfony\Component\Console\Input\InputOption;
- use Symfony\Component\Console\Output\OutputInterface;
- use Composer\Config;
- use Composer\Config\JsonConfigSource;
- use Composer\Factory;
- use Composer\IO\IOInterface;
- use Composer\Json\JsonFile;
- use Composer\Semver\VersionParser;
- use Composer\Package\BasePackage;
- class ConfigCommand extends BaseCommand
- {
- protected $config;
- protected $configFile;
- protected $configSource;
- protected $authConfigFile;
- protected $authConfigSource;
- protected function configure(): void
- {
- $this
- ->setName('config')
- ->setDescription('Sets config options')
- ->setDefinition([
- new InputOption('global', 'g', InputOption::VALUE_NONE, 'Apply command to the global config file'),
- new InputOption('editor', 'e', InputOption::VALUE_NONE, 'Open editor'),
- new InputOption('auth', 'a', InputOption::VALUE_NONE, 'Affect auth config file (only used for --editor)'),
- new InputOption('unset', null, InputOption::VALUE_NONE, 'Unset the given setting-key'),
- new InputOption('list', 'l', InputOption::VALUE_NONE, 'List configuration settings'),
- new InputOption('file', 'f', InputOption::VALUE_REQUIRED, 'If you want to choose a different composer.json or config.json'),
- new InputOption('absolute', null, InputOption::VALUE_NONE, 'Returns absolute paths when fetching *-dir config values instead of relative'),
- new InputOption('json', 'j', InputOption::VALUE_NONE, 'JSON decode the setting value, to be used with extra.* keys'),
- 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'),
- 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)'),
- new InputOption('source', null, InputOption::VALUE_NONE, 'Display where the config value is loaded from'),
- new InputArgument('setting-key', null, 'Setting key'),
- new InputArgument('setting-value', InputArgument::IS_ARRAY, 'Setting value'),
- ])
- ->setHelp(
- <<<EOT
- This command allows you to edit composer config settings and repositories
- in either the local composer.json file or the global config.json file.
- Additionally it lets you edit most properties in the local composer.json.
- To set a config setting:
- <comment>%command.full_name% bin-dir bin/</comment>
- To read a config setting:
- <comment>%command.full_name% bin-dir</comment>
- Outputs: <info>bin</info>
- To edit the global config.json file:
- <comment>%command.full_name% --global</comment>
- To add a repository:
- <comment>%command.full_name% repositories.foo vcs https://bar.com</comment>
- To remove a repository (repo is a short alias for repositories):
- <comment>%command.full_name% --unset repo.foo</comment>
- To disable packagist:
- <comment>%command.full_name% repo.packagist false</comment>
- You can alter repositories in the global config.json file by passing in the
- <info>--global</info> option.
- To add or edit suggested packages you can use:
- <comment>%command.full_name% suggest.package reason for the suggestion</comment>
- To add or edit extra properties you can use:
- <comment>%command.full_name% extra.property value</comment>
- Or to add a complex value you can use json with:
- <comment>%command.full_name% extra.property --json '{"foo":true, "bar": []}'</comment>
- To edit the file in an external editor:
- <comment>%command.full_name% --editor</comment>
- To choose your editor you can set the "EDITOR" env variable.
- To get a list of configuration values in the file:
- <comment>%command.full_name% --list</comment>
- You can always pass more than one option. As an example, if you want to edit the
- global config.json file.
- <comment>%command.full_name% --editor --global</comment>
- Read more at https://getcomposer.org/doc/03-cli.md#config
- EOT
- )
- ;
- }
- protected function initialize(InputInterface $input, OutputInterface $output): void
- {
- parent::initialize($input, $output);
- if ($input->getOption('global') && null !== $input->getOption('file')) {
- throw new \RuntimeException('--file and --global can not be combined');
- }
- $io = $this->getIO();
- $this->config = Factory::createConfig($io);
- $configFile = $input->getOption('global')
- ? ($this->config->get('home') . '/config.json')
- : ($input->getOption('file') ?: Factory::getComposerFile());
- if (
- ($configFile === 'composer.json' || $configFile === './composer.json')
- && !file_exists($configFile)
- && realpath(Platform::getCwd()) === realpath($this->config->get('home'))
- ) {
- file_put_contents($configFile, "{\n}\n");
- }
- $this->configFile = new JsonFile($configFile, null, $io);
- $this->configSource = new JsonConfigSource($this->configFile);
- $authConfigFile = $input->getOption('global')
- ? ($this->config->get('home') . '/auth.json')
- : dirname($configFile) . '/auth.json';
- $this->authConfigFile = new JsonFile($authConfigFile, null, $io);
- $this->authConfigSource = new JsonConfigSource($this->authConfigFile, true);
- if ($input->getOption('global') && !$this->configFile->exists()) {
- touch($this->configFile->getPath());
- $this->configFile->write(['config' => new \ArrayObject]);
- Silencer::call('chmod', $this->configFile->getPath(), 0600);
- }
- if ($input->getOption('global') && !$this->authConfigFile->exists()) {
- touch($this->authConfigFile->getPath());
- $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]);
- Silencer::call('chmod', $this->authConfigFile->getPath(), 0600);
- }
- if (!$this->configFile->exists()) {
- throw new \RuntimeException(sprintf('File "%s" cannot be found in the current directory', $configFile));
- }
- }
- protected function execute(InputInterface $input, OutputInterface $output): int
- {
- if (true === $input->getOption('editor')) {
- $editor = Platform::getEnv('EDITOR');
- if (false === $editor || '' === $editor) {
- if (Platform::isWindows()) {
- $editor = 'notepad';
- } else {
- foreach (['editor', 'vim', 'vi', 'nano', 'pico', 'ed'] as $candidate) {
- if (exec('which '.$candidate)) {
- $editor = $candidate;
- break;
- }
- }
- }
- } else {
- $editor = escapeshellcmd($editor);
- }
- $file = $input->getOption('auth') ? $this->authConfigFile->getPath() : $this->configFile->getPath();
- system($editor . ' ' . $file . (Platform::isWindows() ? '' : ' > `tty`'));
- return 0;
- }
- if (false === $input->getOption('global')) {
- $this->config->merge($this->configFile->read(), $this->configFile->getPath());
- $this->config->merge(['config' => $this->authConfigFile->exists() ? $this->authConfigFile->read() : []], $this->authConfigFile->getPath());
- }
- if (true === $input->getOption('list')) {
- $this->listConfiguration($this->config->all(), $this->config->raw(), $output, null, $input->getOption('source'));
- return 0;
- }
- $settingKey = $input->getArgument('setting-key');
- if (!is_string($settingKey)) {
- return 0;
- }
- if ([] !== $input->getArgument('setting-value') && $input->getOption('unset')) {
- throw new \RuntimeException('You can not combine a setting value with --unset');
- }
- if ([] === $input->getArgument('setting-value') && !$input->getOption('unset')) {
- $properties = ['name', 'type', 'description', 'homepage', 'version', 'minimum-stability', 'prefer-stable', 'keywords', 'license', 'extra'];
- $rawData = $this->configFile->read();
- $data = $this->config->all();
- if (Preg::isMatch('/^repos?(?:itories)?(?:\.(.+))?/', $settingKey, $matches)) {
- if (!isset($matches[1]) || $matches[1] === '') {
- $value = $data['repositories'] ?? [];
- } else {
- if (!isset($data['repositories'][$matches[1]])) {
- throw new \InvalidArgumentException('There is no '.$matches[1].' repository defined');
- }
- $value = $data['repositories'][$matches[1]];
- }
- } elseif (strpos($settingKey, '.')) {
- $bits = explode('.', $settingKey);
- if ($bits[0] === 'extra') {
- $data = $rawData;
- } else {
- $data = $data['config'];
- }
- $match = false;
- foreach ($bits as $bit) {
- $key = isset($key) ? $key.'.'.$bit : $bit;
- $match = false;
- if (isset($data[$key])) {
- $match = true;
- $data = $data[$key];
- unset($key);
- }
- }
- if (!$match) {
- throw new \RuntimeException($settingKey.' is not defined.');
- }
- $value = $data;
- } elseif (isset($data['config'][$settingKey])) {
- $value = $this->config->get($settingKey, $input->getOption('absolute') ? 0 : Config::RELATIVE_PATHS);
- } elseif (isset($rawData[$settingKey]) && in_array($settingKey, $properties, true)) {
- $value = $rawData[$settingKey];
- } else {
- throw new \RuntimeException($settingKey.' is not defined');
- }
- if (is_array($value)) {
- $value = JsonFile::encode($value, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
- }
- $sourceOfConfigValue = '';
- if ($input->getOption('source')) {
- $sourceOfConfigValue = ' (' . $this->config->getSourceOfValue($settingKey) . ')';
- }
- $this->getIO()->write($value . $sourceOfConfigValue, true, IOInterface::QUIET);
- return 0;
- }
- $values = $input->getArgument('setting-value');
- $booleanValidator = static function ($val): bool {
- return in_array($val, ['true', 'false', '1', '0'], true);
- };
- $booleanNormalizer = static function ($val): bool {
- return $val !== 'false' && (bool) $val;
- };
- $uniqueConfigValues = [
- 'process-timeout' => ['is_numeric', 'intval'],
- 'use-include-path' => [$booleanValidator, $booleanNormalizer],
- 'use-github-api' => [$booleanValidator, $booleanNormalizer],
- 'preferred-install' => [
- static function ($val): bool {
- return in_array($val, ['auto', 'source', 'dist'], true);
- },
- static function ($val) {
- return $val;
- },
- ],
- 'gitlab-protocol' => [
- static function ($val): bool {
- return in_array($val, ['git', 'http', 'https'], true);
- },
- static function ($val) {
- return $val;
- },
- ],
- 'store-auths' => [
- static function ($val): bool {
- return in_array($val, ['true', 'false', 'prompt'], true);
- },
- static function ($val) {
- if ('prompt' === $val) {
- return 'prompt';
- }
- return $val !== 'false' && (bool) $val;
- },
- ],
- 'notify-on-install' => [$booleanValidator, $booleanNormalizer],
- 'vendor-dir' => ['is_string', static function ($val) {
- return $val;
- }],
- 'bin-dir' => ['is_string', static function ($val) {
- return $val;
- }],
- 'archive-dir' => ['is_string', static function ($val) {
- return $val;
- }],
- 'archive-format' => ['is_string', static function ($val) {
- return $val;
- }],
- 'data-dir' => ['is_string', static function ($val) {
- return $val;
- }],
- 'cache-dir' => ['is_string', static function ($val) {
- return $val;
- }],
- 'cache-files-dir' => ['is_string', static function ($val) {
- return $val;
- }],
- 'cache-repo-dir' => ['is_string', static function ($val) {
- return $val;
- }],
- 'cache-vcs-dir' => ['is_string', static function ($val) {
- return $val;
- }],
- 'cache-ttl' => ['is_numeric', 'intval'],
- 'cache-files-ttl' => ['is_numeric', 'intval'],
- 'cache-files-maxsize' => [
- static function ($val): bool {
- return Preg::isMatch('/^\s*([0-9.]+)\s*(?:([kmg])(?:i?b)?)?\s*$/i', $val);
- },
- static function ($val) {
- return $val;
- },
- ],
- 'bin-compat' => [
- static function ($val): bool {
- return in_array($val, ['auto', 'full', 'symlink']);
- },
- static function ($val) {
- return $val;
- },
- ],
- 'discard-changes' => [
- static function ($val): bool {
- return in_array($val, ['stash', 'true', 'false', '1', '0'], true);
- },
- static function ($val) {
- if ('stash' === $val) {
- return 'stash';
- }
- return $val !== 'false' && (bool) $val;
- },
- ],
- 'autoloader-suffix' => ['is_string', static function ($val) {
- return $val === 'null' ? null : $val;
- }],
- 'sort-packages' => [$booleanValidator, $booleanNormalizer],
- 'optimize-autoloader' => [$booleanValidator, $booleanNormalizer],
- 'classmap-authoritative' => [$booleanValidator, $booleanNormalizer],
- 'apcu-autoloader' => [$booleanValidator, $booleanNormalizer],
- 'prepend-autoloader' => [$booleanValidator, $booleanNormalizer],
- 'disable-tls' => [$booleanValidator, $booleanNormalizer],
- 'secure-http' => [$booleanValidator, $booleanNormalizer],
- 'cafile' => [
- static function ($val): bool {
- return file_exists($val) && Filesystem::isReadable($val);
- },
- static function ($val) {
- return $val === 'null' ? null : $val;
- },
- ],
- 'capath' => [
- static function ($val): bool {
- return is_dir($val) && Filesystem::isReadable($val);
- },
- static function ($val) {
- return $val === 'null' ? null : $val;
- },
- ],
- 'github-expose-hostname' => [$booleanValidator, $booleanNormalizer],
- 'htaccess-protect' => [$booleanValidator, $booleanNormalizer],
- 'lock' => [$booleanValidator, $booleanNormalizer],
- 'allow-plugins' => [$booleanValidator, $booleanNormalizer],
- 'platform-check' => [
- static function ($val): bool {
- return in_array($val, ['php-only', 'true', 'false', '1', '0'], true);
- },
- static function ($val) {
- if ('php-only' === $val) {
- return 'php-only';
- }
- return $val !== 'false' && (bool) $val;
- },
- ],
- 'use-parent-dir' => [
- static function ($val): bool {
- return in_array($val, ['true', 'false', 'prompt'], true);
- },
- static function ($val) {
- if ('prompt' === $val) {
- return 'prompt';
- }
- return $val !== 'false' && (bool) $val;
- },
- ],
- ];
- $multiConfigValues = [
- 'github-protocols' => [
- static function ($vals) {
- if (!is_array($vals)) {
- return 'array expected';
- }
- foreach ($vals as $val) {
- if (!in_array($val, ['git', 'https', 'ssh'])) {
- return 'valid protocols include: git, https, ssh';
- }
- }
- return true;
- },
- static function ($vals) {
- return $vals;
- },
- ],
- 'github-domains' => [
- static function ($vals) {
- if (!is_array($vals)) {
- return 'array expected';
- }
- return true;
- },
- static function ($vals) {
- return $vals;
- },
- ],
- 'gitlab-domains' => [
- static function ($vals) {
- if (!is_array($vals)) {
- return 'array expected';
- }
- return true;
- },
- static function ($vals) {
- return $vals;
- },
- ],
- ];
- if ($input->getOption('unset') && (isset($uniqueConfigValues[$settingKey]) || isset($multiConfigValues[$settingKey]))) {
- if ($settingKey === 'disable-tls' && $this->config->get('disable-tls')) {
- $this->getIO()->writeError('<info>You are now running Composer with SSL/TLS protection enabled.</info>');
- }
- $this->configSource->removeConfigSetting($settingKey);
- return 0;
- }
- if (isset($uniqueConfigValues[$settingKey])) {
- $this->handleSingleValue($settingKey, $uniqueConfigValues[$settingKey], $values, 'addConfigSetting');
- return 0;
- }
- if (isset($multiConfigValues[$settingKey])) {
- $this->handleMultiValue($settingKey, $multiConfigValues[$settingKey], $values, 'addConfigSetting');
- return 0;
- }
- if (Preg::isMatch('/^preferred-install\.(.+)/', $settingKey, $matches)) {
- if ($input->getOption('unset')) {
- $this->configSource->removeConfigSetting($settingKey);
- return 0;
- }
- [$validator] = $uniqueConfigValues['preferred-install'];
- if (!$validator($values[0])) {
- throw new \RuntimeException('Invalid value for '.$settingKey.'. Should be one of: auto, source, or dist');
- }
- $this->configSource->addConfigSetting($settingKey, $values[0]);
- return 0;
- }
- if (Preg::isMatch('{^allow-plugins\.([a-zA-Z0-9/*-]+)}', $settingKey, $matches)) {
- if ($input->getOption('unset')) {
- $this->configSource->removeConfigSetting($settingKey);
- return 0;
- }
- if (true !== $booleanValidator($values[0])) {
- throw new \RuntimeException(sprintf(
- '"%s" is an invalid value',
- $values[0]
- ));
- }
- $normalizedValue = $booleanNormalizer($values[0]);
- $this->configSource->addConfigSetting($settingKey, $normalizedValue);
- return 0;
- }
- $uniqueProps = [
- 'name' => ['is_string', static function ($val) {
- return $val;
- }],
- 'type' => ['is_string', static function ($val) {
- return $val;
- }],
- 'description' => ['is_string', static function ($val) {
- return $val;
- }],
- 'homepage' => ['is_string', static function ($val) {
- return $val;
- }],
- 'version' => ['is_string', static function ($val) {
- return $val;
- }],
- 'minimum-stability' => [
- static function ($val): bool {
- return isset(BasePackage::$stabilities[VersionParser::normalizeStability($val)]);
- },
- static function ($val): string {
- return VersionParser::normalizeStability($val);
- },
- ],
- 'prefer-stable' => [$booleanValidator, $booleanNormalizer],
- ];
- $multiProps = [
- 'keywords' => [
- static function ($vals) {
- if (!is_array($vals)) {
- return 'array expected';
- }
- return true;
- },
- static function ($vals) {
- return $vals;
- },
- ],
- 'license' => [
- static function ($vals) {
- if (!is_array($vals)) {
- return 'array expected';
- }
- return true;
- },
- static function ($vals) {
- return $vals;
- },
- ],
- ];
- if ($input->getOption('global') && (isset($uniqueProps[$settingKey]) || isset($multiProps[$settingKey]) || strpos($settingKey, 'extra.') === 0)) {
- 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');
- }
- if ($input->getOption('unset') && (isset($uniqueProps[$settingKey]) || isset($multiProps[$settingKey]))) {
- $this->configSource->removeProperty($settingKey);
- return 0;
- }
- if (isset($uniqueProps[$settingKey])) {
- $this->handleSingleValue($settingKey, $uniqueProps[$settingKey], $values, 'addProperty');
- return 0;
- }
- if (isset($multiProps[$settingKey])) {
- $this->handleMultiValue($settingKey, $multiProps[$settingKey], $values, 'addProperty');
- return 0;
- }
- if (Preg::isMatch('/^repos?(?:itories)?\.(.+)/', $settingKey, $matches)) {
- if ($input->getOption('unset')) {
- $this->configSource->removeRepository($matches[1]);
- return 0;
- }
- if (2 === count($values)) {
- $this->configSource->addRepository($matches[1], [
- 'type' => $values[0],
- 'url' => $values[1],
- ], $input->getOption('append'));
- return 0;
- }
- if (1 === count($values)) {
- $value = strtolower($values[0]);
- if (true === $booleanValidator($value)) {
- if (false === $booleanNormalizer($value)) {
- $this->configSource->addRepository($matches[1], false, $input->getOption('append'));
- return 0;
- }
- } else {
- $value = JsonFile::parseJson($values[0]);
- $this->configSource->addRepository($matches[1], $value, $input->getOption('append'));
- return 0;
- }
- }
- throw new \RuntimeException('You must pass the type and a url. Example: php composer.phar config repositories.foo vcs https://bar.com');
- }
- if (Preg::isMatch('/^extra\.(.+)/', $settingKey, $matches)) {
- if ($input->getOption('unset')) {
- $this->configSource->removeProperty($settingKey);
- return 0;
- }
- $value = $values[0];
- if ($input->getOption('json')) {
- $value = JsonFile::parseJson($value);
- if ($input->getOption('merge')) {
- $currentValue = $this->configFile->read();
- $bits = explode('.', $settingKey);
- foreach ($bits as $bit) {
- $currentValue = $currentValue[$bit] ?? null;
- }
- if (is_array($currentValue)) {
- $value = array_merge($currentValue, $value);
- }
- }
- }
- $this->configSource->addProperty($settingKey, $value);
- return 0;
- }
- if (Preg::isMatch('/^suggest\.(.+)/', $settingKey, $matches)) {
- if ($input->getOption('unset')) {
- $this->configSource->removeProperty($settingKey);
- return 0;
- }
- $this->configSource->addProperty($settingKey, implode(' ', $values));
- return 0;
- }
- if (in_array($settingKey, ['suggest', 'extra'], true) && $input->getOption('unset')) {
- $this->configSource->removeProperty($settingKey);
- return 0;
- }
- if (Preg::isMatch('/^platform\.(.+)/', $settingKey, $matches)) {
- if ($input->getOption('unset')) {
- $this->configSource->removeConfigSetting($settingKey);
- return 0;
- }
- $this->configSource->addConfigSetting($settingKey, $values[0] === 'false' ? false : $values[0]);
- return 0;
- }
- if ($settingKey === 'platform' && $input->getOption('unset')) {
- $this->configSource->removeConfigSetting($settingKey);
- return 0;
- }
- if (Preg::isMatch('/^(bitbucket-oauth|github-oauth|gitlab-oauth|gitlab-token|http-basic|bearer)\.(.+)/', $settingKey, $matches)) {
- if ($input->getOption('unset')) {
- $this->authConfigSource->removeConfigSetting($matches[1].'.'.$matches[2]);
- $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
- return 0;
- }
- if ($matches[1] === 'bitbucket-oauth') {
- if (2 !== count($values)) {
- throw new \RuntimeException('Expected two arguments (consumer-key, consumer-secret), got '.count($values));
- }
- $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
- $this->authConfigSource->addConfigSetting($matches[1].'.'.$matches[2], ['consumer-key' => $values[0], 'consumer-secret' => $values[1]]);
- } elseif ($matches[1] === 'gitlab-token' && 2 === count($values)) {
- $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
- $this->authConfigSource->addConfigSetting($matches[1].'.'.$matches[2], ['username' => $values[0], 'token' => $values[1]]);
- } elseif (in_array($matches[1], ['github-oauth', 'gitlab-oauth', 'gitlab-token', 'bearer'], true)) {
- if (1 !== count($values)) {
- throw new \RuntimeException('Too many arguments, expected only one token');
- }
- $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
- $this->authConfigSource->addConfigSetting($matches[1].'.'.$matches[2], $values[0]);
- } elseif ($matches[1] === 'http-basic') {
- if (2 !== count($values)) {
- throw new \RuntimeException('Expected two arguments (username, password), got '.count($values));
- }
- $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
- $this->authConfigSource->addConfigSetting($matches[1].'.'.$matches[2], ['username' => $values[0], 'password' => $values[1]]);
- }
- return 0;
- }
- if (Preg::isMatch('/^scripts\.(.+)/', $settingKey, $matches)) {
- if ($input->getOption('unset')) {
- $this->configSource->removeProperty($settingKey);
- return 0;
- }
- $this->configSource->addProperty($settingKey, count($values) > 1 ? $values : $values[0]);
- return 0;
- }
- if ($input->getOption('unset')) {
- $this->configSource->removeProperty($settingKey);
- return 0;
- }
- throw new \InvalidArgumentException('Setting '.$settingKey.' does not exist or is not supported by this command');
- }
- protected function handleSingleValue(string $key, array $callbacks, array $values, string $method): void
- {
- [$validator, $normalizer] = $callbacks;
- if (1 !== count($values)) {
- throw new \RuntimeException('You can only pass one value. Example: php composer.phar config process-timeout 300');
- }
- if (true !== $validation = $validator($values[0])) {
- throw new \RuntimeException(sprintf(
- '"%s" is an invalid value'.($validation ? ' ('.$validation.')' : ''),
- $values[0]
- ));
- }
- $normalizedValue = $normalizer($values[0]);
- if ($key === 'disable-tls') {
- if (!$normalizedValue && $this->config->get('disable-tls')) {
- $this->getIO()->writeError('<info>You are now running Composer with SSL/TLS protection enabled.</info>');
- } elseif ($normalizedValue && !$this->config->get('disable-tls')) {
- $this->getIO()->writeError('<warning>You are now running Composer with SSL/TLS protection disabled.</warning>');
- }
- }
- call_user_func([$this->configSource, $method], $key, $normalizedValue);
- }
- protected function handleMultiValue(string $key, array $callbacks, array $values, string $method): void
- {
- [$validator, $normalizer] = $callbacks;
- if (true !== $validation = $validator($values)) {
- throw new \RuntimeException(sprintf(
- '%s is an invalid value'.($validation ? ' ('.$validation.')' : ''),
- json_encode($values)
- ));
- }
- call_user_func([$this->configSource, $method], $key, $normalizer($values));
- }
- protected function listConfiguration(array $contents, array $rawContents, OutputInterface $output, ?string $k = null, bool $showSource = false): void
- {
- $origK = $k;
- $io = $this->getIO();
- foreach ($contents as $key => $value) {
- if ($k === null && !in_array($key, ['config', 'repositories'])) {
- continue;
- }
- $rawVal = $rawContents[$key] ?? null;
- if (is_array($value) && (!is_numeric(key($value)) || ($key === 'repositories' && null === $k))) {
- $k .= Preg::replace('{^config\.}', '', $key . '.');
- $this->listConfiguration($value, $rawVal, $output, $k, $showSource);
- $k = $origK;
- continue;
- }
- if (is_array($value)) {
- $value = array_map(static function ($val) {
- return is_array($val) ? json_encode($val) : $val;
- }, $value);
- $value = '['.implode(', ', $value).']';
- }
- if (is_bool($value)) {
- $value = var_export($value, true);
- }
- $source = '';
- if ($showSource) {
- $source = ' (' . $this->config->getSourceOfValue($k . $key) . ')';
- }
- if (null !== $k && 0 === strpos($k, 'repositories')) {
- $link = 'https://getcomposer.org/doc/05-repositories.md';
- } else {
- $id = Preg::replace('{\..*$}', '', $k === '' || $k === null ? (string) $key : $k);
- $id = Preg::replace('{[^a-z0-9]}i', '-', strtolower(trim($id)));
- $id = Preg::replace('{-+}', '-', $id);
- $link = 'https://getcomposer.org/doc/06-config.md#' . $id;
- }
- if (is_string($rawVal) && $rawVal !== $value) {
- $io->write('[<fg=yellow;href=' . $link .'>' . $k . $key . '</>] <info>' . $rawVal . ' (' . $value . ')</info>' . $source, true, IOInterface::QUIET);
- } else {
- $io->write('[<fg=yellow;href=' . $link .'>' . $k . $key . '</>] <info>' . $value . '</info>' . $source, true, IOInterface::QUIET);
- }
- }
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Command;
- use Composer\Config;
- use Composer\Factory;
- use Composer\Filter\PlatformRequirementFilter\IgnoreAllPlatformRequirementFilter;
- use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterFactory;
- use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterInterface;
- use Composer\Installer;
- use Composer\Installer\ProjectInstaller;
- use Composer\Installer\SuggestedPackagesReporter;
- use Composer\IO\IOInterface;
- use Composer\Package\BasePackage;
- use Composer\DependencyResolver\Operation\InstallOperation;
- use Composer\Package\Version\VersionSelector;
- use Composer\Package\AliasPackage;
- use Composer\Pcre\Preg;
- use Composer\Plugin\PluginBlockedException;
- use Composer\Repository\RepositoryFactory;
- use Composer\Repository\CompositeRepository;
- use Composer\Repository\PlatformRepository;
- use Composer\Repository\InstalledArrayRepository;
- use Composer\Repository\RepositorySet;
- use Composer\Script\ScriptEvents;
- use Composer\Util\Silencer;
- use Composer\Console\Input\InputArgument;
- use Seld\Signal\SignalHandler;
- use Symfony\Component\Console\Input\InputInterface;
- use Composer\Console\Input\InputOption;
- use Symfony\Component\Console\Output\OutputInterface;
- use Symfony\Component\Finder\Finder;
- use Composer\Json\JsonFile;
- use Composer\Config\JsonConfigSource;
- use Composer\Util\Filesystem;
- use Composer\Util\Platform;
- use Composer\Util\ProcessExecutor;
- use Composer\Package\Version\VersionParser;
- use Composer\Advisory\Auditor;
- class CreateProjectCommand extends BaseCommand
- {
- use CompletionTrait;
- protected $suggestedPackagesReporter;
- protected function configure(): void
- {
- $this
- ->setName('create-project')
- ->setDescription('Creates new project from a package into given directory')
- ->setDefinition([
- new InputArgument('package', InputArgument::OPTIONAL, 'Package name to be installed', null, $this->suggestAvailablePackage()),
- new InputArgument('directory', InputArgument::OPTIONAL, 'Directory where the files should be created'),
- new InputArgument('version', InputArgument::OPTIONAL, 'Version, will default to latest'),
- new InputOption('stability', 's', InputOption::VALUE_REQUIRED, 'Minimum-stability allowed (unless a version is specified).'),
- new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
- new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist (default behavior).'),
- 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()),
- 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'),
- new InputOption('repository-url', null, InputOption::VALUE_REQUIRED, 'DEPRECATED: Use --repository instead.'),
- 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.'),
- new InputOption('dev', null, InputOption::VALUE_NONE, 'Enables installation of require-dev packages (enabled by default, only present for BC).'),
- new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables installation of require-dev packages.'),
- new InputOption('no-custom-installers', null, InputOption::VALUE_NONE, 'DEPRECATED: Use no-plugins instead.'),
- new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Whether to prevent execution of all defined scripts in the root package.'),
- new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
- 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.'),
- new InputOption('keep-vcs', null, InputOption::VALUE_NONE, 'Whether to prevent deleting the vcs folder.'),
- new InputOption('remove-vcs', null, InputOption::VALUE_NONE, 'Whether to force deletion of the vcs folder without prompting.'),
- new InputOption('no-install', null, InputOption::VALUE_NONE, 'Whether to skip installation of the package dependencies.'),
- 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).'),
- new InputOption('audit-format', null, InputOption::VALUE_REQUIRED, 'Audit output format. Must be "table", "plain", "json" or "summary".', Auditor::FORMAT_SUMMARY, Auditor::FORMATS),
- new InputOption('ignore-platform-req', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Ignore a specific platform requirement (php & ext- packages).'),
- new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore all platform requirements (php & ext- packages).'),
- new InputOption('ask', null, InputOption::VALUE_NONE, 'Whether to ask for project directory.'),
- ])
- ->setHelp(
- <<<EOT
- The <info>create-project</info> command creates a new project from a given
- package into a new directory. If executed without params and in a directory
- with a composer.json file it installs the packages for the current project.
- You can use this command to bootstrap new projects or setup a clean
- version-controlled installation for developers of your project.
- <info>php composer.phar create-project vendor/project target-directory [version]</info>
- You can also specify the version with the package name using = or : as separator.
- <info>php composer.phar create-project vendor/project:version target-directory</info>
- To install unstable packages, either specify the version you want, or use the
- --stability=dev (where dev can be one of RC, beta, alpha or dev).
- To setup a developer workable version you should create the project using the source
- controlled code by appending the <info>'--prefer-source'</info> flag.
- To install a package from another repository than the default one you
- can pass the <info>'--repository=https://myrepository.org'</info> flag.
- Read more at https://getcomposer.org/doc/03-cli.md#create-project
- EOT
- )
- ;
- }
- protected function execute(InputInterface $input, OutputInterface $output): int
- {
- $config = Factory::createConfig();
- $io = $this->getIO();
- [$preferSource, $preferDist] = $this->getPreferredInstallOptions($config, $input, true);
- if ($input->getOption('dev')) {
- $io->writeError('<warning>You are using the deprecated option "dev". Dev packages are installed by default now.</warning>');
- }
- if ($input->getOption('no-custom-installers')) {
- $io->writeError('<warning>You are using the deprecated option "no-custom-installers". Use "no-plugins" instead.</warning>');
- $input->setOption('no-plugins', true);
- }
- if ($input->isInteractive() && $input->getOption('ask')) {
- $package = $input->getArgument('package');
- if (null === $package) {
- throw new \RuntimeException('Not enough arguments (missing: "package").');
- }
- $parts = explode("/", strtolower($package), 2);
- $input->setArgument('directory', $io->ask('New project directory [<comment>'.array_pop($parts).'</comment>]: '));
- }
- return $this->installProject(
- $io,
- $config,
- $input,
- $input->getArgument('package'),
- $input->getArgument('directory'),
- $input->getArgument('version'),
- $input->getOption('stability'),
- $preferSource,
- $preferDist,
- !$input->getOption('no-dev'),
- \count($input->getOption('repository')) > 0 ? $input->getOption('repository') : $input->getOption('repository-url'),
- $input->getOption('no-plugins'),
- $input->getOption('no-scripts'),
- $input->getOption('no-progress'),
- $input->getOption('no-install'),
- $this->getPlatformRequirementFilter($input),
- !$input->getOption('no-secure-http'),
- $input->getOption('add-repository')
- );
- }
- 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
- {
- $oldCwd = Platform::getCwd();
- if ($repositories !== null && !is_array($repositories)) {
- $repositories = (array) $repositories;
- }
- $platformRequirementFilter = $platformRequirementFilter ?? PlatformRequirementFilterFactory::ignoreNothing();
- $io->loadConfiguration($config);
- $this->suggestedPackagesReporter = new SuggestedPackagesReporter($io);
- if ($packageName !== null) {
- $installedFromVcs = $this->installRootPackage($io, $config, $packageName, $platformRequirementFilter, $directory, $packageVersion, $stability, $preferSource, $preferDist, $installDevPackages, $repositories, $disablePlugins, $disableScripts, $noProgress, $secureHttp);
- } else {
- $installedFromVcs = false;
- }
- if ($repositories !== null && $addRepository && is_file('composer.lock')) {
- unlink('composer.lock');
- }
- $composer = Factory::create($io, null, $disablePlugins, $disableScripts);
- if ($repositories !== null && $addRepository) {
- foreach ($repositories as $index => $repo) {
- $repoConfig = RepositoryFactory::configFromString($io, $composer->getConfig(), $repo, true);
- $composerJsonRepositoriesConfig = $composer->getConfig()->getRepositories();
- $name = RepositoryFactory::generateRepositoryName($index, $repoConfig, $composerJsonRepositoriesConfig);
- $configSource = new JsonConfigSource(new JsonFile('composer.json'));
- if (
- (isset($repoConfig['packagist']) && $repoConfig === ['packagist' => false])
- || (isset($repoConfig['packagist.org']) && $repoConfig === ['packagist.org' => false])
- ) {
- $configSource->addRepository('packagist.org', false);
- } else {
- $configSource->addRepository($name, $repoConfig, false);
- }
- $composer = Factory::create($io, null, $disablePlugins);
- }
- }
- $process = $composer->getLoop()->getProcessExecutor();
- $fs = new Filesystem($process);
- $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_ROOT_PACKAGE_INSTALL, $installDevPackages);
- $config = $composer->getConfig();
- [$preferSource, $preferDist] = $this->getPreferredInstallOptions($config, $input);
- if ($noInstall === false) {
- $composer->getInstallationManager()->setOutputProgress(!$noProgress);
- $installer = Installer::create($io, $composer);
- $installer->setPreferSource($preferSource)
- ->setPreferDist($preferDist)
- ->setDevMode($installDevPackages)
- ->setPlatformRequirementFilter($platformRequirementFilter)
- ->setSuggestedPackagesReporter($this->suggestedPackagesReporter)
- ->setOptimizeAutoloader($config->get('optimize-autoloader'))
- ->setClassMapAuthoritative($config->get('classmap-authoritative'))
- ->setApcuAutoloader($config->get('apcu-autoloader'))
- ->setAudit(!$input->getOption('no-audit'))
- ->setAuditFormat($this->getAuditFormat($input));
- if (!$composer->getLocker()->isLocked()) {
- $installer->setUpdate(true);
- }
- if ($disablePlugins) {
- $installer->disablePlugins();
- }
- try {
- $status = $installer->run();
- if (0 !== $status) {
- return $status;
- }
- } catch (PluginBlockedException $e) {
- $io->writeError('<error>Hint: To allow running the config command recommended below before dependencies are installed, run create-project with --no-install.</error>');
- $io->writeError('<error>You can then cd into '.getcwd().', configure allow-plugins, and finally run a composer install to complete the process.</error>');
- throw $e;
- }
- }
- $hasVcs = $installedFromVcs;
- if (
- !$input->getOption('keep-vcs')
- && $installedFromVcs
- && (
- $input->getOption('remove-vcs')
- || !$io->isInteractive()
- || $io->askConfirmation('<info>Do you want to remove the existing VCS (.git, .svn..) history?</info> [<comment>Y,n</comment>]? ')
- )
- ) {
- $finder = new Finder();
- $finder->depth(0)->directories()->in(Platform::getCwd())->ignoreVCS(false)->ignoreDotFiles(false);
- foreach (['.svn', '_svn', 'CVS', '_darcs', '.arch-params', '.monotone', '.bzr', '.git', '.hg', '.fslckout', '_FOSSIL_'] as $vcsName) {
- $finder->name($vcsName);
- }
- try {
- $dirs = iterator_to_array($finder);
- unset($finder);
- foreach ($dirs as $dir) {
- if (!$fs->removeDirectory((string) $dir)) {
- throw new \RuntimeException('Could not remove '.$dir);
- }
- }
- } catch (\Exception $e) {
- $io->writeError('<error>An error occurred while removing the VCS metadata: '.$e->getMessage().'</error>');
- }
- $hasVcs = false;
- }
- if (!$hasVcs) {
- $package = $composer->getPackage();
- $configSource = new JsonConfigSource(new JsonFile('composer.json'));
- foreach (BasePackage::$supportedLinkTypes as $type => $meta) {
- foreach ($package->{'get'.$meta['method']}() as $link) {
- if ($link->getPrettyConstraint() === 'self.version') {
- $configSource->addLink($type, $link->getTarget(), $package->getPrettyVersion());
- }
- }
- }
- }
- $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_CREATE_PROJECT_CMD, $installDevPackages);
- chdir($oldCwd);
- $vendorComposerDir = $config->get('vendor-dir').'/composer';
- if (is_dir($vendorComposerDir) && $fs->isDirEmpty($vendorComposerDir)) {
- Silencer::call('rmdir', $vendorComposerDir);
- $vendorDir = $config->get('vendor-dir');
- if (is_dir($vendorDir) && $fs->isDirEmpty($vendorDir)) {
- Silencer::call('rmdir', $vendorDir);
- }
- }
- return 0;
- }
- protected function installRootPackage(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
- {
- if (!$secureHttp) {
- $config->merge(['config' => ['secure-http' => false]], Config::SOURCE_COMMAND);
- }
- $parser = new VersionParser();
- $requirements = $parser->parseNameVersionPairs([$packageName]);
- $name = strtolower($requirements[0]['name']);
- if (!$packageVersion && isset($requirements[0]['version'])) {
- $packageVersion = $requirements[0]['version'];
- }
- if (null === $directory) {
- $parts = explode("/", $name, 2);
- $directory = Platform::getCwd() . DIRECTORY_SEPARATOR . array_pop($parts);
- }
- $process = new ProcessExecutor($io);
- $fs = new Filesystem($process);
- if (!$fs->isAbsolutePath($directory)) {
- $directory = Platform::getCwd() . DIRECTORY_SEPARATOR . $directory;
- }
- $io->writeError('<info>Creating a "' . $packageName . '" project at "' . $fs->findShortestPath(Platform::getCwd(), $directory, true) . '"</info>');
- if (file_exists($directory)) {
- if (!is_dir($directory)) {
- throw new \InvalidArgumentException('Cannot create project directory at "'.$directory.'", it exists as a file.');
- }
- if (!$fs->isDirEmpty($directory)) {
- throw new \InvalidArgumentException('Project directory "'.$directory.'" is not empty.');
- }
- }
- if (null === $stability) {
- if (null === $packageVersion) {
- $stability = 'stable';
- } elseif (Preg::isMatch('{^[^,\s]*?@('.implode('|', array_keys(BasePackage::$stabilities)).')$}i', $packageVersion, $match)) {
- $stability = $match[1];
- } else {
- $stability = VersionParser::parseStability($packageVersion);
- }
- }
- $stability = VersionParser::normalizeStability($stability);
- if (!isset(BasePackage::$stabilities[$stability])) {
- throw new \InvalidArgumentException('Invalid stability provided ('.$stability.'), must be one of: '.implode(', ', array_keys(BasePackage::$stabilities)));
- }
- $composer = Factory::create($io, $config->all(), $disablePlugins, $disableScripts);
- $config = $composer->getConfig();
- $rm = $composer->getRepositoryManager();
- $repositorySet = new RepositorySet($stability);
- if (null === $repositories) {
- $repositorySet->addRepository(new CompositeRepository(RepositoryFactory::defaultRepos($io, $config, $rm)));
- } else {
- foreach ($repositories as $repo) {
- $repoConfig = RepositoryFactory::configFromString($io, $config, $repo, true);
- if (
- (isset($repoConfig['packagist']) && $repoConfig === ['packagist' => false])
- || (isset($repoConfig['packagist.org']) && $repoConfig === ['packagist.org' => false])
- ) {
- continue;
- }
- $repositorySet->addRepository(RepositoryFactory::createRepo($io, $config, $repoConfig, $rm));
- }
- }
- $platformOverrides = $config->get('platform');
- $platformRepo = new PlatformRepository([], $platformOverrides);
- $versionSelector = new VersionSelector($repositorySet, $platformRepo);
- $package = $versionSelector->findBestCandidate($name, $packageVersion, $stability, $platformRequirementFilter, 0, $io);
- if (!$package) {
- $errorMessage = "Could not find package $name with " . ($packageVersion ? "version $packageVersion" : "stability $stability");
- if (!($platformRequirementFilter instanceof IgnoreAllPlatformRequirementFilter) && $versionSelector->findBestCandidate($name, $packageVersion, $stability, PlatformRequirementFilterFactory::ignoreAll())) {
- throw new \InvalidArgumentException($errorMessage .' in a version installable using your PHP version, PHP extensions and Composer version.');
- }
- throw new \InvalidArgumentException($errorMessage .'.');
- }
- @mkdir($directory, 0777, true);
- if (false !== ($realDir = realpath($directory))) {
- $signalHandler = SignalHandler::create([SignalHandler::SIGINT, SignalHandler::SIGTERM, SignalHandler::SIGHUP], function (string $signal, SignalHandler $handler) use ($realDir) {
- $this->getIO()->writeError('Received '.$signal.', aborting', true, IOInterface::DEBUG);
- $fs = new Filesystem();
- $fs->removeDirectory($realDir);
- $handler->exitWithLastSignal();
- });
- }
- if ($package instanceof AliasPackage && $package->getPrettyVersion() === VersionParser::DEFAULT_BRANCH_ALIAS) {
- $package = $package->getAliasOf();
- }
- $io->writeError('<info>Installing ' . $package->getName() . ' (' . $package->getFullPrettyVersion(false) . ')</info>');
- if ($disablePlugins) {
- $io->writeError('<info>Plugins have been disabled.</info>');
- }
- if ($package instanceof AliasPackage) {
- $package = $package->getAliasOf();
- }
- $dm = $composer->getDownloadManager();
- $dm->setPreferSource($preferSource)
- ->setPreferDist($preferDist);
- $projectInstaller = new ProjectInstaller($directory, $dm, $fs);
- $im = $composer->getInstallationManager();
- $im->setOutputProgress(!$noProgress);
- $im->addInstaller($projectInstaller);
- $im->execute(new InstalledArrayRepository(), [new InstallOperation($package)]);
- $im->notifyInstalls($io);
- $this->suggestedPackagesReporter->addSuggestionsFromPackage($package);
- $installedFromVcs = 'source' === $package->getInstallationSource();
- $io->writeError('<info>Created project in ' . $directory . '</info>');
- chdir($directory);
- Platform::putEnv('COMPOSER_ROOT_VERSION', $package->getPrettyVersion());
- if (isset($signalHandler)) {
- $signalHandler->unregister();
- }
- return $installedFromVcs;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Command;
- use Symfony\Component\Console\Input\InputInterface;
- use Symfony\Component\Console\Output\OutputInterface;
- use Composer\Console\Input\InputArgument;
- use Composer\Console\Input\InputOption;
- class DependsCommand extends BaseDependencyCommand
- {
- use CompletionTrait;
- protected function configure(): void
- {
- $this
- ->setName('depends')
- ->setAliases(['why'])
- ->setDescription('Shows which packages cause the given package to be installed')
- ->setDefinition([
- new InputArgument(self::ARGUMENT_PACKAGE, InputArgument::REQUIRED, 'Package to inspect', null, $this->suggestInstalledPackage(true, true)),
- new InputOption(self::OPTION_RECURSIVE, 'r', InputOption::VALUE_NONE, 'Recursively resolves up to the root package'),
- new InputOption(self::OPTION_TREE, 't', InputOption::VALUE_NONE, 'Prints the results as a nested tree'),
- new InputOption('locked', null, InputOption::VALUE_NONE, 'Read dependency information from composer.lock'),
- ])
- ->setHelp(
- <<<EOT
- Displays detailed information about where a package is referenced.
- <info>php composer.phar depends composer/composer</info>
- Read more at https://getcomposer.org/doc/03-cli.md#depends-why-
- EOT
- )
- ;
- }
- protected function execute(InputInterface $input, OutputInterface $output): int
- {
- return parent::doExecute($input, $output);
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Command;
- use Composer\Composer;
- use Composer\Factory;
- use Composer\Config;
- use Composer\Downloader\TransportException;
- use Composer\Pcre\Preg;
- use Composer\Repository\PlatformRepository;
- use Composer\Plugin\CommandEvent;
- use Composer\Plugin\PluginEvents;
- use Composer\Util\ConfigValidator;
- use Composer\Util\Git;
- use Composer\Util\IniHelper;
- use Composer\Util\ProcessExecutor;
- use Composer\Util\HttpDownloader;
- use Composer\Util\StreamContextFactory;
- use Composer\Util\Platform;
- use Composer\SelfUpdate\Keys;
- use Composer\SelfUpdate\Versions;
- use Composer\IO\NullIO;
- use Composer\Package\CompletePackageInterface;
- use Composer\XdebugHandler\XdebugHandler;
- use Symfony\Component\Console\Input\InputInterface;
- use Symfony\Component\Console\Output\OutputInterface;
- use Symfony\Component\Process\ExecutableFinder;
- class DiagnoseCommand extends BaseCommand
- {
- protected $httpDownloader;
- protected $process;
- protected $exitCode = 0;
- protected function configure(): void
- {
- $this
- ->setName('diagnose')
- ->setDescription('Diagnoses the system to identify common errors')
- ->setHelp(
- <<<EOT
- The <info>diagnose</info> command checks common errors to help debugging problems.
- The process exit code will be 1 in case of warnings and 2 for errors.
- Read more at https://getcomposer.org/doc/03-cli.md#diagnose
- EOT
- )
- ;
- }
- protected function execute(InputInterface $input, OutputInterface $output)
- {
- $composer = $this->tryComposer();
- $io = $this->getIO();
- if ($composer) {
- $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'diagnose', $input, $output);
- $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
- $io->write('Checking composer.json: ', false);
- $this->outputResult($this->checkComposerSchema());
- $this->process = $composer->getLoop()->getProcessExecutor() ?? new ProcessExecutor($io);
- } else {
- $this->process = new ProcessExecutor($io);
- }
- if ($composer) {
- $config = $composer->getConfig();
- } else {
- $config = Factory::createConfig();
- }
- $config->merge(['config' => ['secure-http' => false]], Config::SOURCE_COMMAND);
- $config->prohibitUrlByConfig('http://repo.packagist.org', new NullIO);
- $this->httpDownloader = Factory::createHttpDownloader($io, $config);
- $io->write('Checking platform settings: ', false);
- $this->outputResult($this->checkPlatform());
- $io->write('Checking git settings: ', false);
- $this->outputResult($this->checkGit());
- $io->write('Checking http connectivity to packagist: ', false);
- $this->outputResult($this->checkHttp('http', $config));
- $io->write('Checking https connectivity to packagist: ', false);
- $this->outputResult($this->checkHttp('https', $config));
- $opts = stream_context_get_options(StreamContextFactory::getContext('http://example.org'));
- if (!empty($opts['http']['proxy'])) {
- $io->write('Checking HTTP proxy: ', false);
- $this->outputResult($this->checkHttpProxy());
- }
- if (count($oauth = $config->get('github-oauth')) > 0) {
- foreach ($oauth as $domain => $token) {
- $io->write('Checking '.$domain.' oauth access: ', false);
- $this->outputResult($this->checkGithubOauth($domain, $token));
- }
- } else {
- $io->write('Checking github.com rate limit: ', false);
- try {
- $rate = $this->getGithubRateLimit('github.com');
- if (!is_array($rate)) {
- $this->outputResult($rate);
- } elseif (10 > $rate['remaining']) {
- $io->write('<warning>WARNING</warning>');
- $io->write(sprintf(
- '<comment>Github has a rate limit on their API. '
- . 'You currently have <options=bold>%u</options=bold> '
- . 'out of <options=bold>%u</options=bold> requests left.' . PHP_EOL
- . 'See https://developer.github.com/v3/#rate-limiting and also' . PHP_EOL
- . ' https://getcomposer.org/doc/articles/troubleshooting.md#api-rate-limit-and-oauth-tokens</comment>',
- $rate['remaining'],
- $rate['limit']
- ));
- } else {
- $this->outputResult(true);
- }
- } catch (\Exception $e) {
- if ($e instanceof TransportException && $e->getCode() === 401) {
- $this->outputResult('<comment>The oauth token for github.com seems invalid, run "composer config --global --unset github-oauth.github.com" to remove it</comment>');
- } else {
- $this->outputResult($e);
- }
- }
- }
- $io->write('Checking disk free space: ', false);
- $this->outputResult($this->checkDiskSpace($config));
- if (strpos(__FILE__, 'phar:') === 0) {
- $io->write('Checking pubkeys: ', false);
- $this->outputResult($this->checkPubKeys($config));
- $io->write('Checking composer version: ', false);
- $this->outputResult($this->checkVersion($config));
- }
- $io->write(sprintf('Composer version: <comment>%s</comment>', Composer::getVersion()));
- $platformOverrides = $config->get('platform') ?: [];
- $platformRepo = new PlatformRepository([], $platformOverrides);
- $phpPkg = $platformRepo->findPackage('php', '*');
- $phpVersion = $phpPkg->getPrettyVersion();
- if ($phpPkg instanceof CompletePackageInterface && false !== strpos($phpPkg->getDescription(), 'overridden')) {
- $phpVersion .= ' - ' . $phpPkg->getDescription();
- }
- $io->write(sprintf('PHP version: <comment>%s</comment>', $phpVersion));
- if (defined('PHP_BINARY')) {
- $io->write(sprintf('PHP binary path: <comment>%s</comment>', PHP_BINARY));
- }
- $io->write('OpenSSL version: ' . (defined('OPENSSL_VERSION_TEXT') ? '<comment>'.OPENSSL_VERSION_TEXT.'</comment>' : '<error>missing</error>'));
- $io->write('cURL version: ' . $this->getCurlVersion());
- $finder = new ExecutableFinder;
- $hasSystemUnzip = (bool) $finder->find('unzip');
- $bin7zip = '';
- if ($hasSystem7zip = (bool) $finder->find('7z', null, ['C:\Program Files\7-Zip'])) {
- $bin7zip = '7z';
- }
- if (!Platform::isWindows() && !$hasSystem7zip && $hasSystem7zip = (bool) $finder->find('7zz')) {
- $bin7zip = '7zz';
- }
- $io->write(
- 'zip: ' . (extension_loaded('zip') ? '<comment>extension present</comment>' : '<comment>extension not loaded</comment>')
- . ', ' . ($hasSystemUnzip ? '<comment>unzip present</comment>' : '<comment>unzip not available</comment>')
- . ', ' . ($hasSystem7zip ? '<comment>7-Zip present ('.$bin7zip.')</comment>' : '<comment>7-Zip not available</comment>')
- . (($hasSystem7zip || $hasSystemUnzip) && !function_exists('proc_open') ? ', <warning>proc_open is disabled or not present, unzip/7-z will not be usable</warning>' : '')
- );
- return $this->exitCode;
- }
- private function checkComposerSchema()
- {
- $validator = new ConfigValidator($this->getIO());
- [$errors, , $warnings] = $validator->validate(Factory::getComposerFile());
- if ($errors || $warnings) {
- $messages = [
- 'error' => $errors,
- 'warning' => $warnings,
- ];
- $output = '';
- foreach ($messages as $style => $msgs) {
- foreach ($msgs as $msg) {
- $output .= '<' . $style . '>' . $msg . '</' . $style . '>' . PHP_EOL;
- }
- }
- return rtrim($output);
- }
- return true;
- }
- private function checkGit(): string
- {
- if (!function_exists('proc_open')) {
- return '<comment>proc_open is not available, git cannot be used</comment>';
- }
- $this->process->execute('git config color.ui', $output);
- if (strtolower(trim($output)) === 'always') {
- 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>';
- }
- $gitVersion = Git::getVersion($this->process);
- if (null === $gitVersion) {
- return '<comment>No git process found</>';
- }
- if (version_compare('2.24.0', $gitVersion, '>')) {
- return '<warning>Your git version ('.$gitVersion.') is too old and possibly will cause issues. Please upgrade to git 2.24 or above</>';
- }
- return '<info>OK</> <comment>git version '.$gitVersion.'</>';
- }
- private function checkHttp(string $proto, Config $config)
- {
- $result = $this->checkConnectivity();
- if ($result !== true) {
- return $result;
- }
- $result = [];
- if ($proto === 'https' && $config->get('disable-tls') === true) {
- $tlsWarning = '<warning>Composer is configured to disable SSL/TLS protection. This will leave remote HTTPS requests vulnerable to Man-In-The-Middle attacks.</warning>';
- }
- try {
- $this->httpDownloader->get($proto . '://repo.packagist.org/packages.json');
- } catch (TransportException $e) {
- $hints = HttpDownloader::getExceptionHints($e);
- if (null !== $hints && count($hints) > 0) {
- foreach ($hints as $hint) {
- $result[] = $hint;
- }
- }
- $result[] = '<error>[' . get_class($e) . '] ' . $e->getMessage() . '</error>';
- }
- if (isset($tlsWarning)) {
- $result[] = $tlsWarning;
- }
- if (count($result) > 0) {
- return $result;
- }
- return true;
- }
- private function checkHttpProxy()
- {
- $result = $this->checkConnectivity();
- if ($result !== true) {
- return $result;
- }
- $protocol = extension_loaded('openssl') ? 'https' : 'http';
- try {
- $json = $this->httpDownloader->get($protocol . '://repo.packagist.org/packages.json')->decodeJson();
- $hash = reset($json['provider-includes']);
- $hash = $hash['sha256'];
- $path = str_replace('%hash%', $hash, key($json['provider-includes']));
- $provider = $this->httpDownloader->get($protocol . '://repo.packagist.org/'.$path)->getBody();
- if (hash('sha256', $provider) !== $hash) {
- return 'It seems that your proxy is modifying http traffic on the fly';
- }
- } catch (\Exception $e) {
- return $e;
- }
- return true;
- }
- private function checkGithubOauth(string $domain, string $token)
- {
- $result = $this->checkConnectivity();
- if ($result !== true) {
- return $result;
- }
- $this->getIO()->setAuthentication($domain, $token, 'x-oauth-basic');
- try {
- $url = $domain === 'github.com' ? 'https://api.'.$domain.'/' : 'https://'.$domain.'/api/v3/';
- $this->httpDownloader->get($url, [
- 'retry-auth-failure' => false,
- ]);
- return true;
- } catch (\Exception $e) {
- if ($e instanceof TransportException && $e->getCode() === 401) {
- return '<comment>The oauth token for '.$domain.' seems invalid, run "composer config --global --unset github-oauth.'.$domain.'" to remove it</comment>';
- }
- return $e;
- }
- }
- private function getGithubRateLimit(string $domain, ?string $token = null)
- {
- $result = $this->checkConnectivity();
- if ($result !== true) {
- return $result;
- }
- if ($token) {
- $this->getIO()->setAuthentication($domain, $token, 'x-oauth-basic');
- }
- $url = $domain === 'github.com' ? 'https://api.'.$domain.'/rate_limit' : 'https://'.$domain.'/api/rate_limit';
- $data = $this->httpDownloader->get($url, ['retry-auth-failure' => false])->decodeJson();
- return $data['resources']['core'];
- }
- private function checkDiskSpace(Config $config)
- {
- if (!function_exists('disk_free_space')) {
- return true;
- }
- $minSpaceFree = 1024 * 1024;
- if ((($df = @disk_free_space($dir = $config->get('home'))) !== false && $df < $minSpaceFree)
- || (($df = @disk_free_space($dir = $config->get('vendor-dir'))) !== false && $df < $minSpaceFree)
- ) {
- return '<error>The disk hosting '.$dir.' is full</error>';
- }
- return true;
- }
- private function checkPubKeys(Config $config)
- {
- $home = $config->get('home');
- $errors = [];
- $io = $this->getIO();
- if (file_exists($home.'/keys.tags.pub') && file_exists($home.'/keys.dev.pub')) {
- $io->write('');
- }
- if (file_exists($home.'/keys.tags.pub')) {
- $io->write('Tags Public Key Fingerprint: ' . Keys::fingerprint($home.'/keys.tags.pub'));
- } else {
- $errors[] = '<error>Missing pubkey for tags verification</error>';
- }
- if (file_exists($home.'/keys.dev.pub')) {
- $io->write('Dev Public Key Fingerprint: ' . Keys::fingerprint($home.'/keys.dev.pub'));
- } else {
- $errors[] = '<error>Missing pubkey for dev verification</error>';
- }
- if ($errors) {
- $errors[] = '<error>Run composer self-update --update-keys to set them up</error>';
- }
- return $errors ?: true;
- }
- private function checkVersion(Config $config)
- {
- $result = $this->checkConnectivity();
- if ($result !== true) {
- return $result;
- }
- $versionsUtil = new Versions($config, $this->httpDownloader);
- try {
- $latest = $versionsUtil->getLatest();
- } catch (\Exception $e) {
- return $e;
- }
- if (Composer::VERSION !== $latest['version'] && Composer::VERSION !== '@package_version@') {
- return '<comment>You are not running the latest '.$versionsUtil->getChannel().' version, run `composer self-update` to update ('.Composer::VERSION.' => '.$latest['version'].')</comment>';
- }
- return true;
- }
- private function getCurlVersion(): string
- {
- if (extension_loaded('curl')) {
- if (!HttpDownloader::isCurlEnabled()) {
- return '<error>disabled via disable_functions, using php streams fallback, which reduces performance</error>';
- }
- $version = curl_version();
- return '<comment>'.$version['version'].'</comment> '.
- 'libz <comment>'.(!empty($version['libz_version']) ? $version['libz_version'] : 'missing').'</comment> '.
- 'ssl <comment>'.($version['ssl_version'] ?? 'missing').'</comment>';
- }
- return '<error>missing, using php streams fallback, which reduces performance</error>';
- }
- private function outputResult($result): void
- {
- $io = $this->getIO();
- if (true === $result) {
- $io->write('<info>OK</info>');
- return;
- }
- $hadError = false;
- $hadWarning = false;
- if ($result instanceof \Exception) {
- $result = '<error>['.get_class($result).'] '.$result->getMessage().'</error>';
- }
- if (!$result) {
- $hadError = true;
- } else {
- if (!is_array($result)) {
- $result = [$result];
- }
- foreach ($result as $message) {
- if (false !== strpos($message, '<error>')) {
- $hadError = true;
- } elseif (false !== strpos($message, '<warning>')) {
- $hadWarning = true;
- }
- }
- }
- if ($hadError) {
- $io->write('<error>FAIL</error>');
- $this->exitCode = max($this->exitCode, 2);
- } elseif ($hadWarning) {
- $io->write('<warning>WARNING</warning>');
- $this->exitCode = max($this->exitCode, 1);
- }
- if ($result) {
- foreach ($result as $message) {
- $io->write($message);
- }
- }
- }
- private function checkPlatform()
- {
- $output = '';
- $out = static function ($msg, $style) use (&$output): void {
- $output .= '<'.$style.'>'.$msg.'</'.$style.'>'.PHP_EOL;
- };
- $errors = [];
- $warnings = [];
- $displayIniMessage = false;
- $iniMessage = PHP_EOL.PHP_EOL.IniHelper::getMessage();
- $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.';
- if (!function_exists('json_decode')) {
- $errors['json'] = true;
- }
- if (!extension_loaded('Phar')) {
- $errors['phar'] = true;
- }
- if (!extension_loaded('filter')) {
- $errors['filter'] = true;
- }
- if (!extension_loaded('hash')) {
- $errors['hash'] = true;
- }
- if (!extension_loaded('iconv') && !extension_loaded('mbstring')) {
- $errors['iconv_mbstring'] = true;
- }
- if (!filter_var(ini_get('allow_url_fopen'), FILTER_VALIDATE_BOOLEAN)) {
- $errors['allow_url_fopen'] = true;
- }
- if (extension_loaded('ionCube Loader') && ioncube_loader_iversion() < 40009) {
- $errors['ioncube'] = ioncube_loader_version();
- }
- if (PHP_VERSION_ID < 70205) {
- $errors['php'] = PHP_VERSION;
- }
- if (!extension_loaded('openssl')) {
- $errors['openssl'] = true;
- }
- if (extension_loaded('openssl') && OPENSSL_VERSION_NUMBER < 0x1000100f) {
- $warnings['openssl_version'] = true;
- }
- if (!defined('HHVM_VERSION') && !extension_loaded('apcu') && filter_var(ini_get('apc.enable_cli'), FILTER_VALIDATE_BOOLEAN)) {
- $warnings['apc_cli'] = true;
- }
- if (!extension_loaded('zlib')) {
- $warnings['zlib'] = true;
- }
- ob_start();
- phpinfo(INFO_GENERAL);
- $phpinfo = ob_get_clean();
- if (Preg::isMatch('{Configure Command(?: *</td><td class="v">| *=> *)(.*?)(?:</td>|$)}m', $phpinfo, $match)) {
- $configure = $match[1];
- if (false !== strpos($configure, '--enable-sigchild')) {
- $warnings['sigchild'] = true;
- }
- if (false !== strpos($configure, '--with-curlwrappers')) {
- $warnings['curlwrappers'] = true;
- }
- }
- if (filter_var(ini_get('xdebug.profiler_enabled'), FILTER_VALIDATE_BOOLEAN)) {
- $warnings['xdebug_profile'] = true;
- } elseif (XdebugHandler::isXdebugActive()) {
- $warnings['xdebug_loaded'] = true;
- }
- if (defined('PHP_WINDOWS_VERSION_BUILD')
- && (version_compare(PHP_VERSION, '7.2.23', '<')
- || (version_compare(PHP_VERSION, '7.3.0', '>=')
- && version_compare(PHP_VERSION, '7.3.10', '<')))) {
- $warnings['onedrive'] = PHP_VERSION;
- }
- if (!empty($errors)) {
- foreach ($errors as $error => $current) {
- switch ($error) {
- case 'json':
- $text = PHP_EOL."The json extension is missing.".PHP_EOL;
- $text .= "Install it or recompile php without --disable-json";
- break;
- case 'phar':
- $text = PHP_EOL."The phar extension is missing.".PHP_EOL;
- $text .= "Install it or recompile php without --disable-phar";
- break;
- case 'filter':
- $text = PHP_EOL."The filter extension is missing.".PHP_EOL;
- $text .= "Install it or recompile php without --disable-filter";
- break;
- case 'hash':
- $text = PHP_EOL."The hash extension is missing.".PHP_EOL;
- $text .= "Install it or recompile php without --disable-hash";
- break;
- case 'iconv_mbstring':
- $text = PHP_EOL."The iconv OR mbstring extension is required and both are missing.".PHP_EOL;
- $text .= "Install either of them or recompile php without --disable-iconv";
- break;
- case 'php':
- $text = PHP_EOL."Your PHP ({$current}) is too old, you must upgrade to PHP 7.2.5 or higher.";
- break;
- case 'allow_url_fopen':
- $text = PHP_EOL."The allow_url_fopen setting is incorrect.".PHP_EOL;
- $text .= "Add the following to the end of your `php.ini`:".PHP_EOL;
- $text .= " allow_url_fopen = On";
- $displayIniMessage = true;
- break;
- case 'ioncube':
- $text = PHP_EOL."Your ionCube Loader extension ($current) is incompatible with Phar files.".PHP_EOL;
- $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;
- $text .= " zend_extension = /usr/lib/php5/20090626+lfs/ioncube_loader_lin_5.3.so";
- $displayIniMessage = true;
- break;
- case 'openssl':
- $text = PHP_EOL."The openssl extension is missing, which means that secure HTTPS transfers are impossible.".PHP_EOL;
- $text .= "If possible you should enable it or recompile php with --with-openssl";
- break;
- default:
- throw new \InvalidArgumentException(sprintf("DiagnoseCommand: Unknown error type \"%s\". Please report at https://github.com/composer/composer/issues/new.", $error));
- }
- $out($text, 'error');
- }
- $output .= PHP_EOL;
- }
- if (!empty($warnings)) {
- foreach ($warnings as $warning => $current) {
- switch ($warning) {
- case 'apc_cli':
- $text = "The apc.enable_cli setting is incorrect.".PHP_EOL;
- $text .= "Add the following to the end of your `php.ini`:".PHP_EOL;
- $text .= " apc.enable_cli = Off";
- $displayIniMessage = true;
- break;
- case 'zlib':
- $text = 'The zlib extension is not loaded, this can slow down Composer a lot.'.PHP_EOL;
- $text .= 'If possible, enable it or recompile php with --with-zlib'.PHP_EOL;
- $displayIniMessage = true;
- break;
- case 'sigchild':
- $text = "PHP was compiled with --enable-sigchild which can cause issues on some platforms.".PHP_EOL;
- $text .= "Recompile it without this flag if possible, see also:".PHP_EOL;
- $text .= " https://bugs.php.net/bug.php?id=22999";
- break;
- case 'curlwrappers':
- $text = "PHP was compiled with --with-curlwrappers which will cause issues with HTTP authentication and GitHub.".PHP_EOL;
- $text .= " Recompile it without this flag if possible";
- break;
- case 'openssl_version':
- $opensslVersion = strstr(trim(strstr(OPENSSL_VERSION_TEXT, ' ')), ' ', true);
- $opensslVersion = $opensslVersion ?: OPENSSL_VERSION_TEXT;
- $text = "The OpenSSL library ({$opensslVersion}) used by PHP does not support TLSv1.2 or TLSv1.1.".PHP_EOL;
- $text .= "If possible you should upgrade OpenSSL to version 1.0.1 or above.";
- break;
- case 'xdebug_loaded':
- $text = "The xdebug extension is loaded, this can slow down Composer a little.".PHP_EOL;
- $text .= " Disabling it when using Composer is recommended.";
- break;
- case 'xdebug_profile':
- $text = "The xdebug.profiler_enabled setting is enabled, this can slow down Composer a lot.".PHP_EOL;
- $text .= "Add the following to the end of your `php.ini` to disable it:".PHP_EOL;
- $text .= " xdebug.profiler_enabled = 0";
- $displayIniMessage = true;
- break;
- case 'onedrive':
- $text = "The Windows OneDrive folder is not supported on PHP versions below 7.2.23 and 7.3.10.".PHP_EOL;
- $text .= "Upgrade your PHP ({$current}) to use this location with Composer.".PHP_EOL;
- break;
- default:
- throw new \InvalidArgumentException(sprintf("DiagnoseCommand: Unknown warning type \"%s\". Please report at https://github.com/composer/composer/issues/new.", $warning));
- }
- $out($text, 'comment');
- }
- }
- if ($displayIniMessage) {
- $out($iniMessage, 'comment');
- }
- return !$warnings && !$errors ? true : $output;
- }
- private function checkConnectivity()
- {
- if (!ini_get('allow_url_fopen')) {
- return '<info>Skipped because allow_url_fopen is missing.</info>';
- }
- return true;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Command;
- use Composer\Plugin\CommandEvent;
- use Composer\Plugin\PluginEvents;
- use Symfony\Component\Console\Input\InputInterface;
- use Symfony\Component\Console\Input\InputOption;
- use Symfony\Component\Console\Output\OutputInterface;
- class DumpAutoloadCommand extends BaseCommand
- {
- protected function configure()
- {
- $this
- ->setName('dump-autoload')
- ->setAliases(['dumpautoload'])
- ->setDescription('Dumps the autoloader')
- ->setDefinition([
- new InputOption('optimize', 'o', InputOption::VALUE_NONE, 'Optimizes PSR0 and PSR4 packages to be loaded with classmaps too, good for production.'),
- new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize`.'),
- new InputOption('apcu', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
- new InputOption('apcu-prefix', null, InputOption::VALUE_REQUIRED, 'Use a custom prefix for the APCu autoloader cache. Implicitly enables --apcu'),
- 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.'),
- 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.'),
- new InputOption('ignore-platform-req', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Ignore a specific platform requirement (php & ext- packages).'),
- new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore all platform requirements (php & ext- packages).'),
- 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.'),
- ])
- ->setHelp(
- <<<EOT
- <info>php composer.phar dump-autoload</info>
- Read more at https://getcomposer.org/doc/03-cli.md#dump-autoload-dumpautoload-
- EOT
- )
- ;
- }
- protected function execute(InputInterface $input, OutputInterface $output)
- {
- $composer = $this->requireComposer();
- $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'dump-autoload', $input, $output);
- $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
- $installationManager = $composer->getInstallationManager();
- $localRepo = $composer->getRepositoryManager()->getLocalRepository();
- $package = $composer->getPackage();
- $config = $composer->getConfig();
- $optimize = $input->getOption('optimize') || $config->get('optimize-autoloader');
- $authoritative = $input->getOption('classmap-authoritative') || $config->get('classmap-authoritative');
- $apcuPrefix = $input->getOption('apcu-prefix');
- $apcu = $apcuPrefix !== null || $input->getOption('apcu') || $config->get('apcu-autoloader');
- if ($input->getOption('strict-psr') && !$optimize) {
- throw new \InvalidArgumentException('--strict-psr mode only works with optimized autoloader, use --optimize if you want a strict return value.');
- }
- if ($authoritative) {
- $this->getIO()->write('<info>Generating optimized autoload files (authoritative)</info>');
- } elseif ($optimize) {
- $this->getIO()->write('<info>Generating optimized autoload files</info>');
- } else {
- $this->getIO()->write('<info>Generating autoload files</info>');
- }
- $generator = $composer->getAutoloadGenerator();
- if ($input->getOption('no-dev')) {
- $generator->setDevMode(false);
- }
- if ($input->getOption('dev')) {
- if ($input->getOption('no-dev')) {
- throw new \InvalidArgumentException('You can not use both --no-dev and --dev as they conflict with each other.');
- }
- $generator->setDevMode(true);
- }
- $generator->setClassMapAuthoritative($authoritative);
- $generator->setRunScripts(true);
- $generator->setApcu($apcu, $apcuPrefix);
- $generator->setPlatformRequirementFilter($this->getPlatformRequirementFilter($input));
- $classMap = $generator->dump($config, $localRepo, $package, $installationManager, 'composer', $optimize);
- $numberOfClasses = count($classMap);
- if ($authoritative) {
- $this->getIO()->write('<info>Generated optimized autoload files (authoritative) containing '. $numberOfClasses .' classes</info>');
- } elseif ($optimize) {
- $this->getIO()->write('<info>Generated optimized autoload files containing '. $numberOfClasses .' classes</info>');
- } else {
- $this->getIO()->write('<info>Generated autoload files</info>');
- }
- if ($input->getOption('strict-psr') && count($classMap->getPsrViolations()) > 0) {
- return 1;
- }
- return 0;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Command;
- use Symfony\Component\Console\Input\InputInterface;
- use Composer\Console\Input\InputOption;
- use Symfony\Component\Console\Output\OutputInterface;
- use Composer\Console\Input\InputArgument;
- class ExecCommand extends BaseCommand
- {
- protected function configure()
- {
- $this
- ->setName('exec')
- ->setDescription('Executes a vendored binary/script')
- ->setDefinition([
- new InputOption('list', 'l', InputOption::VALUE_NONE),
- new InputArgument('binary', InputArgument::OPTIONAL, 'The binary to run, e.g. phpunit', null, function () {
- return $this->getBinaries(false);
- }),
- new InputArgument(
- 'args',
- InputArgument::IS_ARRAY | InputArgument::OPTIONAL,
- 'Arguments to pass to the binary. Use <info>--</info> to separate from composer arguments'
- ),
- ])
- ->setHelp(
- <<<EOT
- Executes a vendored binary/script.
- Read more at https://getcomposer.org/doc/03-cli.md#exec
- EOT
- )
- ;
- }
- protected function execute(InputInterface $input, OutputInterface $output)
- {
- $composer = $this->requireComposer();
- if ($input->getOption('list') || null === $input->getArgument('binary')) {
- $bins = $this->getBinaries(true);
- if ([] === $bins) {
- $binDir = $composer->getConfig()->get('bin-dir');
- throw new \RuntimeException("No binaries found in composer.json or in bin-dir ($binDir)");
- }
- $this->getIO()->write(
- <<<EOT
- <comment>Available binaries:</comment>
- EOT
- );
- foreach ($bins as $bin) {
- $this->getIO()->write(
- <<<EOT
- <info>- $bin</info>
- EOT
- );
- }
- return 0;
- }
- $binary = $input->getArgument('binary');
- $dispatcher = $composer->getEventDispatcher();
- $dispatcher->addListener('__exec_command', $binary);
- if (getcwd() !== $this->getApplication()->getInitialWorkingDirectory() && $this->getApplication()->getInitialWorkingDirectory() !== false) {
- try {
- chdir($this->getApplication()->getInitialWorkingDirectory());
- } catch (\Exception $e) {
- throw new \RuntimeException('Could not switch back to working directory "'.$this->getApplication()->getInitialWorkingDirectory().'"', 0, $e);
- }
- }
- return $dispatcher->dispatchScript('__exec_command', true, $input->getArgument('args'));
- }
- private function getBinaries(bool $forDisplay): array
- {
- $composer = $this->requireComposer();
- $binDir = $composer->getConfig()->get('bin-dir');
- $bins = glob($binDir . '/*');
- $localBins = $composer->getPackage()->getBinaries();
- if ($forDisplay) {
- $localBins = array_map(static function ($e) {
- return "$e (local)";
- }, $localBins);
- }
- $binaries = [];
- foreach (array_merge($bins, $localBins) as $bin) {
- if (isset($previousBin) && $bin === $previousBin.'.bat') {
- continue;
- }
- $previousBin = $bin;
- $binaries[] = basename($bin);
- }
- return $binaries;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Command;
- use Composer\Json\JsonFile;
- use Composer\Package\AliasPackage;
- use Composer\Package\BasePackage;
- use Composer\Package\CompletePackageInterface;
- use Composer\Pcre\Preg;
- use Composer\Repository\CompositeRepository;
- use Composer\Semver\Constraint\MatchAllConstraint;
- use Symfony\Component\Console\Formatter\OutputFormatter;
- use Symfony\Component\Console\Input\InputInterface;
- use Composer\Console\Input\InputOption;
- use Symfony\Component\Console\Output\OutputInterface;
- class FundCommand extends BaseCommand
- {
- protected function configure(): void
- {
- $this->setName('fund')
- ->setDescription('Discover how to help fund the maintenance of your dependencies')
- ->setDefinition([
- new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the output: text or json', 'text', ['text', 'json']),
- ])
- ;
- }
- protected function execute(InputInterface $input, OutputInterface $output): int
- {
- $composer = $this->requireComposer();
- $repo = $composer->getRepositoryManager()->getLocalRepository();
- $remoteRepos = new CompositeRepository($composer->getRepositoryManager()->getRepositories());
- $fundings = [];
- $packagesToLoad = [];
- foreach ($repo->getPackages() as $package) {
- if ($package instanceof AliasPackage) {
- continue;
- }
- $packagesToLoad[$package->getName()] = new MatchAllConstraint();
- }
- $result = $remoteRepos->loadPackages($packagesToLoad, ['dev' => BasePackage::STABILITY_DEV], []);
- foreach ($result['packages'] as $package) {
- if (
- !$package instanceof AliasPackage
- && $package instanceof CompletePackageInterface
- && $package->isDefaultBranch()
- && $package->getFunding()
- && isset($packagesToLoad[$package->getName()])
- ) {
- $fundings = $this->insertFundingData($fundings, $package);
- unset($packagesToLoad[$package->getName()]);
- }
- }
- foreach ($repo->getPackages() as $package) {
- if ($package instanceof AliasPackage || !isset($packagesToLoad[$package->getName()])) {
- continue;
- }
- if ($package instanceof CompletePackageInterface && $package->getFunding()) {
- $fundings = $this->insertFundingData($fundings, $package);
- }
- }
- ksort($fundings);
- $io = $this->getIO();
- $format = $input->getOption('format');
- if (!in_array($format, ['text', 'json'])) {
- $io->writeError(sprintf('Unsupported format "%s". See help for supported formats.', $format));
- return 1;
- }
- if ($fundings && $format === 'text') {
- $prev = null;
- $io->write('The following packages were found in your dependencies which publish funding information:');
- foreach ($fundings as $vendor => $links) {
- $io->write('');
- $io->write(sprintf("<comment>%s</comment>", $vendor));
- foreach ($links as $url => $packages) {
- $line = sprintf(' <info>%s</info>', implode(', ', $packages));
- if ($prev !== $line) {
- $io->write($line);
- $prev = $line;
- }
- $io->write(sprintf(' <href=%s>%s</>', OutputFormatter::escape($url), $url));
- }
- }
- $io->write("");
- $io->write("Please consider following these links and sponsoring the work of package authors!");
- $io->write("Thank you!");
- } elseif ($format === 'json') {
- $io->write(JsonFile::encode($fundings));
- } else {
- $io->write("No funding links were found in your package dependencies. This doesn't mean they don't need your support!");
- }
- return 0;
- }
- private function insertFundingData(array $fundings, CompletePackageInterface $package): array
- {
- foreach ($package->getFunding() as $fundingOption) {
- [$vendor, $packageName] = explode('/', $package->getPrettyName());
- if (empty($fundingOption['url'])) {
- continue;
- }
- $url = $fundingOption['url'];
- if (!empty($fundingOption['type']) && $fundingOption['type'] === 'github' && Preg::isMatch('{^https://github.com/([^/]+)$}', $url, $match)) {
- $url = 'https://github.com/sponsors/'.$match[1];
- }
- $fundings[$vendor][$url][] = $packageName;
- }
- return $fundings;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Command;
- use Composer\Factory;
- use Composer\Pcre\Preg;
- use Composer\Util\Filesystem;
- use Composer\Util\Platform;
- use Symfony\Component\Console\Command\Command;
- use Symfony\Component\Console\Completion\CompletionInput;
- use Symfony\Component\Console\Completion\CompletionSuggestions;
- use Symfony\Component\Console\Input\InputInterface;
- use Composer\Console\Input\InputArgument;
- use Symfony\Component\Console\Input\StringInput;
- use Symfony\Component\Console\Output\OutputInterface;
- class GlobalCommand extends BaseCommand
- {
- public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void
- {
- $application = $this->getApplication();
- if ($input->mustSuggestArgumentValuesFor('command-name')) {
- $suggestions->suggestValues(array_filter(array_map(static function (Command $command) {
- return $command->isHidden() ? null : $command->getName();
- }, $application->all())));
- return;
- }
- if ($application->has($commandName = $input->getArgument('command-name'))) {
- $input = $this->prepareSubcommandInput($input, true);
- $input = CompletionInput::fromString($input->__toString(), 2);
- $command = $application->find($commandName);
- $command->mergeApplicationDefinition();
- $input->bind($command->getDefinition());
- $command->complete($input, $suggestions);
- }
- }
- protected function configure(): void
- {
- $this
- ->setName('global')
- ->setDescription('Allows running commands in the global composer dir ($COMPOSER_HOME)')
- ->setDefinition([
- new InputArgument('command-name', InputArgument::REQUIRED, ''),
- new InputArgument('args', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, ''),
- ])
- ->setHelp(
- <<<EOT
- Use this command as a wrapper to run other Composer commands
- within the global context of COMPOSER_HOME.
- You can use this to install CLI utilities globally, all you need
- is to add the COMPOSER_HOME/vendor/bin dir to your PATH env var.
- COMPOSER_HOME is c:\Users\<user>\AppData\Roaming\Composer on Windows
- and /home/<user>/.composer on unix systems.
- If your system uses freedesktop.org standards, then it will first check
- XDG_CONFIG_HOME or default to /home/<user>/.config/composer
- Note: This path may vary depending on customizations to bin-dir in
- composer.json or the environmental variable COMPOSER_BIN_DIR.
- Read more at https://getcomposer.org/doc/03-cli.md#global
- EOT
- )
- ;
- }
- public function run(InputInterface $input, OutputInterface $output): int
- {
- if (!method_exists($input, '__toString')) {
- throw new \LogicException('Expected an Input instance that is stringable, got '.get_class($input));
- }
- $tokens = Preg::split('{\s+}', $input->__toString());
- $args = [];
- foreach ($tokens as $token) {
- if ($token && $token[0] !== '-') {
- $args[] = $token;
- if (count($args) >= 2) {
- break;
- }
- }
- }
- if (count($args) < 2) {
- return parent::run($input, $output);
- }
- $input = $this->prepareSubcommandInput($input);
- return $this->getApplication()->run($input, $output);
- }
- private function prepareSubcommandInput(InputInterface $input, bool $quiet = false): StringInput
- {
- if (!method_exists($input, '__toString')) {
- throw new \LogicException('Expected an Input instance that is stringable, got '.get_class($input));
- }
- if (Platform::getEnv('COMPOSER')) {
- Platform::clearEnv('COMPOSER');
- }
- $config = Factory::createConfig();
- $home = $config->get('home');
- if (!is_dir($home)) {
- $fs = new Filesystem();
- $fs->ensureDirectoryExists($home);
- if (!is_dir($home)) {
- throw new \RuntimeException('Could not create home directory');
- }
- }
- try {
- chdir($home);
- } catch (\Exception $e) {
- throw new \RuntimeException('Could not switch to home directory "'.$home.'"', 0, $e);
- }
- if (!$quiet) {
- $this->getIO()->writeError('<info>Changed current directory to '.$home.'</info>');
- }
- $input = new StringInput(Preg::replace('{\bg(?:l(?:o(?:b(?:a(?:l)?)?)?)?)?\b}', '', $input->__toString(), 1));
- $this->getApplication()->resetComposer();
- return $input;
- }
- public function isProxyCommand(): bool
- {
- return true;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Command;
- use Composer\Package\CompletePackageInterface;
- use Composer\Repository\RepositoryInterface;
- use Composer\Repository\RootPackageRepository;
- use Composer\Repository\RepositoryFactory;
- use Composer\Util\Platform;
- use Composer\Util\ProcessExecutor;
- use Composer\Console\Input\InputArgument;
- use Composer\Console\Input\InputOption;
- use Symfony\Component\Console\Input\InputInterface;
- use Symfony\Component\Console\Output\OutputInterface;
- class HomeCommand extends BaseCommand
- {
- use CompletionTrait;
- protected function configure(): void
- {
- $this
- ->setName('browse')
- ->setAliases(['home'])
- ->setDescription('Opens the package\'s repository URL or homepage in your browser')
- ->setDefinition([
- new InputArgument('packages', InputArgument::IS_ARRAY, 'Package(s) to browse to.', null, $this->suggestInstalledPackage()),
- new InputOption('homepage', 'H', InputOption::VALUE_NONE, 'Open the homepage instead of the repository URL.'),
- new InputOption('show', 's', InputOption::VALUE_NONE, 'Only show the homepage or repository URL.'),
- ])
- ->setHelp(
- <<<EOT
- The home command opens or shows a package's repository URL or
- homepage in your default browser.
- To open the homepage by default, use -H or --homepage.
- To show instead of open the repository or homepage URL, use -s or --show.
- Read more at https://getcomposer.org/doc/03-cli.md#browse-home
- EOT
- );
- }
- protected function execute(InputInterface $input, OutputInterface $output): int
- {
- $repos = $this->initializeRepos();
- $io = $this->getIO();
- $return = 0;
- $packages = $input->getArgument('packages');
- if (count($packages) === 0) {
- $io->writeError('No package specified, opening homepage for the root package');
- $packages = [$this->requireComposer()->getPackage()->getName()];
- }
- foreach ($packages as $packageName) {
- $handled = false;
- $packageExists = false;
- foreach ($repos as $repo) {
- foreach ($repo->findPackages($packageName) as $package) {
- $packageExists = true;
- if ($package instanceof CompletePackageInterface && $this->handlePackage($package, $input->getOption('homepage'), $input->getOption('show'))) {
- $handled = true;
- break 2;
- }
- }
- }
- if (!$packageExists) {
- $return = 1;
- $io->writeError('<warning>Package '.$packageName.' not found</warning>');
- }
- if (!$handled) {
- $return = 1;
- $io->writeError('<warning>'.($input->getOption('homepage') ? 'Invalid or missing homepage' : 'Invalid or missing repository URL').' for '.$packageName.'</warning>');
- }
- }
- return $return;
- }
- private function handlePackage(CompletePackageInterface $package, bool $showHomepage, bool $showOnly): bool
- {
- $support = $package->getSupport();
- $url = $support['source'] ?? $package->getSourceUrl();
- if (!$url || $showHomepage) {
- $url = $package->getHomepage();
- }
- if (!$url || !filter_var($url, FILTER_VALIDATE_URL)) {
- return false;
- }
- if ($showOnly) {
- $this->getIO()->write(sprintf('<info>%s</info>', $url));
- } else {
- $this->openBrowser($url);
- }
- return true;
- }
- private function openBrowser(string $url): void
- {
- $url = ProcessExecutor::escape($url);
- $process = new ProcessExecutor($this->getIO());
- if (Platform::isWindows()) {
- $process->execute('start "web" explorer ' . $url, $output);
- return;
- }
- $linux = $process->execute('which xdg-open', $output);
- $osx = $process->execute('which open', $output);
- if (0 === $linux) {
- $process->execute('xdg-open ' . $url, $output);
- } elseif (0 === $osx) {
- $process->execute('open ' . $url, $output);
- } else {
- $this->getIO()->writeError('No suitable browser opening command found, open yourself: ' . $url);
- }
- }
- private function initializeRepos(): array
- {
- $composer = $this->tryComposer();
- if ($composer) {
- return array_merge(
- [new RootPackageRepository(clone $composer->getPackage())],
- [$composer->getRepositoryManager()->getLocalRepository()],
- $composer->getRepositoryManager()->getRepositories()
- );
- }
- return RepositoryFactory::defaultReposWithDefaultManager($this->getIO());
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Command;
- use Composer\Factory;
- use Composer\Json\JsonFile;
- use Composer\Json\JsonValidationException;
- use Composer\Package\BasePackage;
- use Composer\Package\Package;
- use Composer\Pcre\Preg;
- use Composer\Repository\CompositeRepository;
- use Composer\Repository\PlatformRepository;
- use Composer\Repository\RepositoryFactory;
- use Composer\Util\Filesystem;
- use Composer\Util\Silencer;
- use Symfony\Component\Console\Input\ArrayInput;
- use Symfony\Component\Console\Input\InputInterface;
- use Composer\Console\Input\InputOption;
- use Symfony\Component\Console\Output\OutputInterface;
- use Symfony\Component\Process\ExecutableFinder;
- use Symfony\Component\Process\Process;
- use Symfony\Component\Console\Helper\FormatterHelper;
- class InitCommand extends BaseCommand
- {
- use CompletionTrait;
- use PackageDiscoveryTrait;
- private $gitConfig;
- protected function configure()
- {
- $this
- ->setName('init')
- ->setDescription('Creates a basic composer.json file in current directory')
- ->setDefinition([
- new InputOption('name', null, InputOption::VALUE_REQUIRED, 'Name of the package'),
- new InputOption('description', null, InputOption::VALUE_REQUIRED, 'Description of package'),
- new InputOption('author', null, InputOption::VALUE_REQUIRED, 'Author name of package'),
- new InputOption('type', null, InputOption::VALUE_OPTIONAL, 'Type of package (e.g. library, project, metapackage, composer-plugin)'),
- new InputOption('homepage', null, InputOption::VALUE_REQUIRED, 'Homepage of package'),
- 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()),
- 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()),
- new InputOption('stability', 's', InputOption::VALUE_REQUIRED, 'Minimum stability (empty or one of: '.implode(', ', array_keys(BasePackage::$stabilities)).')'),
- new InputOption('license', 'l', InputOption::VALUE_REQUIRED, 'License of package'),
- new InputOption('repository', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Add custom repositories, either by URL or using JSON arrays'),
- 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/)'),
- ])
- ->setHelp(
- <<<EOT
- The <info>init</info> command creates a basic composer.json file
- in the current directory.
- <info>php composer.phar init</info>
- Read more at https://getcomposer.org/doc/03-cli.md#init
- EOT
- )
- ;
- }
- protected function execute(InputInterface $input, OutputInterface $output)
- {
- $io = $this->getIO();
- $allowlist = ['name', 'description', 'author', 'type', 'homepage', 'require', 'require-dev', 'stability', 'license', 'autoload'];
- $options = array_filter(array_intersect_key($input->getOptions(), array_flip($allowlist)));
- if (isset($options['name']) && !Preg::isMatch('{^[a-z0-9_.-]+/[a-z0-9_.-]+$}D', $options['name'])) {
- throw new \InvalidArgumentException(
- '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_.-]+'
- );
- }
- if (isset($options['author'])) {
- $options['authors'] = $this->formatAuthors($options['author']);
- unset($options['author']);
- }
- $repositories = $input->getOption('repository');
- if (count($repositories) > 0) {
- $config = Factory::createConfig($io);
- foreach ($repositories as $repo) {
- $options['repositories'][] = RepositoryFactory::configFromString($io, $config, $repo, true);
- }
- }
- if (isset($options['stability'])) {
- $options['minimum-stability'] = $options['stability'];
- unset($options['stability']);
- }
- $options['require'] = isset($options['require']) ? $this->formatRequirements($options['require']) : new \stdClass;
- if ([] === $options['require']) {
- $options['require'] = new \stdClass;
- }
- if (isset($options['require-dev'])) {
- $options['require-dev'] = $this->formatRequirements($options['require-dev']);
- if ([] === $options['require-dev']) {
- $options['require-dev'] = new \stdClass;
- }
- }
- $autoloadPath = null;
- if (isset($options['autoload'])) {
- $autoloadPath = $options['autoload'];
- $namespace = $this->namespaceFromPackageName((string) $input->getOption('name'));
- $options['autoload'] = (object) [
- 'psr-4' => [
- $namespace . '\\' => $autoloadPath,
- ],
- ];
- }
- $file = new JsonFile(Factory::getComposerFile());
- $json = JsonFile::encode($options);
- if ($input->isInteractive()) {
- $io->writeError(['', $json, '']);
- if (!$io->askConfirmation('Do you confirm generation [<comment>yes</comment>]? ')) {
- $io->writeError('<error>Command aborted</error>');
- return 1;
- }
- } else {
- if (json_encode($options) === '{"require":{}}') {
- throw new \RuntimeException('You have to run this command in interactive mode, or specify at least some data using --name, --require, etc.');
- }
- $io->writeError('Writing '.$file->getPath());
- }
- $file->write($options);
- try {
- $file->validateSchema(JsonFile::LAX_SCHEMA);
- } catch (JsonValidationException $e) {
- $io->writeError('<error>Schema validation error, aborting</error>');
- $errors = ' - ' . implode(PHP_EOL . ' - ', $e->getErrors());
- $io->writeError($e->getMessage() . ':' . PHP_EOL . $errors);
- Silencer::call('unlink', $file->getPath());
- return 1;
- }
- if ($autoloadPath) {
- $filesystem = new Filesystem();
- $filesystem->ensureDirectoryExists($autoloadPath);
- if (!$this->hasDependencies($options)) {
- $this->runDumpAutoloadCommand($output);
- }
- }
- if ($input->isInteractive() && is_dir('.git')) {
- $ignoreFile = realpath('.gitignore');
- if (false === $ignoreFile) {
- $ignoreFile = realpath('.') . '/.gitignore';
- }
- if (!$this->hasVendorIgnore($ignoreFile)) {
- $question = 'Would you like the <info>vendor</info> directory added to your <info>.gitignore</info> [<comment>yes</comment>]? ';
- if ($io->askConfirmation($question)) {
- $this->addVendorIgnore($ignoreFile);
- }
- }
- }
- $question = 'Would you like to install dependencies now [<comment>yes</comment>]? ';
- if ($input->isInteractive() && $this->hasDependencies($options) && $io->askConfirmation($question)) {
- $this->updateDependencies($output);
- }
- if ($autoloadPath) {
- $namespace = $this->namespaceFromPackageName((string) $input->getOption('name'));
- $io->writeError('PSR-4 autoloading configured. Use "<comment>namespace '.$namespace.';</comment>" in '.$autoloadPath);
- $io->writeError('Include the Composer autoloader with: <comment>require \'vendor/autoload.php\';</comment>');
- }
- return 0;
- }
- protected function interact(InputInterface $input, OutputInterface $output)
- {
- $git = $this->getGitConfig();
- $io = $this->getIO();
- $formatter = $this->getHelperSet()->get('formatter');
- $repositories = $input->getOption('repository');
- if (count($repositories) > 0) {
- $config = Factory::createConfig($io);
- $io->loadConfiguration($config);
- $repoManager = RepositoryFactory::manager($io, $config);
- $repos = [new PlatformRepository];
- $createDefaultPackagistRepo = true;
- foreach ($repositories as $repo) {
- $repoConfig = RepositoryFactory::configFromString($io, $config, $repo, true);
- if (
- (isset($repoConfig['packagist']) && $repoConfig === ['packagist' => false])
- || (isset($repoConfig['packagist.org']) && $repoConfig === ['packagist.org' => false])
- ) {
- $createDefaultPackagistRepo = false;
- continue;
- }
- $repos[] = RepositoryFactory::createRepo($io, $config, $repoConfig, $repoManager);
- }
- if ($createDefaultPackagistRepo) {
- $repos[] = RepositoryFactory::createRepo($io, $config, [
- 'type' => 'composer',
- 'url' => 'https://repo.packagist.org',
- ], $repoManager);
- }
- $this->repos = new CompositeRepository($repos);
- unset($repos, $config, $repositories);
- }
- $io->writeError([
- '',
- $formatter->formatBlock('Welcome to the Composer config generator', 'bg=blue;fg=white', true),
- '',
- ]);
- $io->writeError([
- '',
- 'This command will guide you through creating your composer.json config.',
- '',
- ]);
- $cwd = realpath(".");
- $name = $input->getOption('name');
- if (null === $name) {
- $name = basename($cwd);
- $name = Preg::replace('{(?:([a-z])([A-Z])|([A-Z])([A-Z][a-z]))}', '\\1\\3-\\2\\4', $name);
- $name = strtolower($name);
- if (!empty($_SERVER['COMPOSER_DEFAULT_VENDOR'])) {
- $name = $_SERVER['COMPOSER_DEFAULT_VENDOR'] . '/' . $name;
- } elseif (isset($git['github.user'])) {
- $name = $git['github.user'] . '/' . $name;
- } elseif (!empty($_SERVER['USERNAME'])) {
- $name = $_SERVER['USERNAME'] . '/' . $name;
- } elseif (!empty($_SERVER['USER'])) {
- $name = $_SERVER['USER'] . '/' . $name;
- } elseif (get_current_user()) {
- $name = get_current_user() . '/' . $name;
- } else {
- $name .= '/' . $name;
- }
- $name = strtolower($name);
- }
- $name = $io->askAndValidate(
- 'Package name (<vendor>/<name>) [<comment>'.$name.'</comment>]: ',
- static function ($value) use ($name) {
- if (null === $value) {
- return $name;
- }
- if (!Preg::isMatch('{^[a-z0-9_.-]+/[a-z0-9_.-]+$}D', $value)) {
- throw new \InvalidArgumentException(
- '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_.-]+'
- );
- }
- return $value;
- },
- null,
- $name
- );
- $input->setOption('name', $name);
- $description = $input->getOption('description') ?: null;
- $description = $io->ask(
- 'Description [<comment>'.$description.'</comment>]: ',
- $description
- );
- $input->setOption('description', $description);
- if (null === $author = $input->getOption('author')) {
- if (!empty($_SERVER['COMPOSER_DEFAULT_AUTHOR'])) {
- $author_name = $_SERVER['COMPOSER_DEFAULT_AUTHOR'];
- } elseif (isset($git['user.name'])) {
- $author_name = $git['user.name'];
- }
- if (!empty($_SERVER['COMPOSER_DEFAULT_EMAIL'])) {
- $author_email = $_SERVER['COMPOSER_DEFAULT_EMAIL'];
- } elseif (isset($git['user.email'])) {
- $author_email = $git['user.email'];
- }
- if (isset($author_name, $author_email)) {
- $author = sprintf('%s <%s>', $author_name, $author_email);
- }
- }
- $author = $io->askAndValidate(
- 'Author ['.(is_string($author) ? '<comment>'.$author.'</comment>, ' : '') . 'n to skip]: ',
- function ($value) use ($author) {
- if ($value === 'n' || $value === 'no') {
- return;
- }
- $value = $value ?: $author;
- $author = $this->parseAuthorString($value ?? '');
- if ($author['email'] === null) {
- return $author['name'];
- }
- return sprintf('%s <%s>', $author['name'], $author['email']);
- },
- null,
- $author
- );
- $input->setOption('author', $author);
- $minimumStability = $input->getOption('stability') ?: null;
- $minimumStability = $io->askAndValidate(
- 'Minimum Stability [<comment>'.$minimumStability.'</comment>]: ',
- static function ($value) use ($minimumStability) {
- if (null === $value) {
- return $minimumStability;
- }
- if (!isset(BasePackage::$stabilities[$value])) {
- throw new \InvalidArgumentException(
- 'Invalid minimum stability "'.$value.'". Must be empty or one of: '.
- implode(', ', array_keys(BasePackage::$stabilities))
- );
- }
- return $value;
- },
- null,
- $minimumStability
- );
- $input->setOption('stability', $minimumStability);
- $type = $input->getOption('type') ?: false;
- $type = $io->ask(
- 'Package Type (e.g. library, project, metapackage, composer-plugin) [<comment>'.$type.'</comment>]: ',
- $type
- );
- $input->setOption('type', $type);
- if (null === $license = $input->getOption('license')) {
- if (!empty($_SERVER['COMPOSER_DEFAULT_LICENSE'])) {
- $license = $_SERVER['COMPOSER_DEFAULT_LICENSE'];
- }
- }
- $license = $io->ask(
- 'License [<comment>'.$license.'</comment>]: ',
- $license
- );
- $input->setOption('license', $license);
- $io->writeError(['', 'Define your dependencies.', '']);
- $repos = $this->getRepos();
- $preferredStability = $minimumStability ?: 'stable';
- $platformRepo = null;
- if ($repos instanceof CompositeRepository) {
- foreach ($repos->getRepositories() as $candidateRepo) {
- if ($candidateRepo instanceof PlatformRepository) {
- $platformRepo = $candidateRepo;
- break;
- }
- }
- }
- $question = 'Would you like to define your dependencies (require) interactively [<comment>yes</comment>]? ';
- $require = $input->getOption('require');
- $requirements = [];
- if (count($require) > 0 || $io->askConfirmation($question)) {
- $requirements = $this->determineRequirements($input, $output, $require, $platformRepo, $preferredStability);
- }
- $input->setOption('require', $requirements);
- $question = 'Would you like to define your dev dependencies (require-dev) interactively [<comment>yes</comment>]? ';
- $requireDev = $input->getOption('require-dev');
- $devRequirements = [];
- if (count($requireDev) > 0 || $io->askConfirmation($question)) {
- $devRequirements = $this->determineRequirements($input, $output, $requireDev, $platformRepo, $preferredStability);
- }
- $input->setOption('require-dev', $devRequirements);
- $autoload = $input->getOption('autoload') ?: 'src/';
- $namespace = $this->namespaceFromPackageName((string) $input->getOption('name'));
- $autoload = $io->askAndValidate(
- 'Add PSR-4 autoload mapping? Maps namespace "'.$namespace.'" to the entered relative path. [<comment>'.$autoload.'</comment>, n to skip]: ',
- static function ($value) use ($autoload) {
- if (null === $value) {
- return $autoload;
- }
- if ($value === 'n' || $value === 'no') {
- return;
- }
- $value = $value ?: $autoload;
- if (!Preg::isMatch('{^[^/][A-Za-z0-9\-_/]+/$}', $value)) {
- throw new \InvalidArgumentException(sprintf(
- 'The src folder name "%s" is invalid. Please add a relative path with tailing forward slash. [A-Za-z0-9_-/]+/',
- $value
- ));
- }
- return $value;
- },
- null,
- $autoload
- );
- $input->setOption('autoload', $autoload);
- }
- private function parseAuthorString(string $author): array
- {
- if (Preg::isMatch('/^(?P<name>[- .,\p{L}\p{N}\p{Mn}\'’"()]+)(?:\s+<(?P<email>.+?)>)?$/u', $author, $match)) {
- $hasEmail = isset($match['email']) && '' !== $match['email'];
- if ($hasEmail && !$this->isValidEmail($match['email'])) {
- throw new \InvalidArgumentException('Invalid email "'.$match['email'].'"');
- }
- return [
- 'name' => trim($match['name']),
- 'email' => $hasEmail ? $match['email'] : null,
- ];
- }
- throw new \InvalidArgumentException(
- 'Invalid author string. Must be in the formats: '.
- 'Jane Doe or John Smith <john@example.com>'
- );
- }
- protected function formatAuthors(string $author): array
- {
- $author = $this->parseAuthorString($author);
- if (null === $author['email']) {
- unset($author['email']);
- }
- return [$author];
- }
- public function namespaceFromPackageName(string $packageName): ?string
- {
- if (!$packageName || strpos($packageName, '/') === false) {
- return null;
- }
- $namespace = array_map(
- static function ($part): string {
- $part = Preg::replace('/[^a-z0-9]/i', ' ', $part);
- $part = ucwords($part);
- return str_replace(' ', '', $part);
- },
- explode('/', $packageName)
- );
- return implode('\\', $namespace);
- }
- protected function getGitConfig(): array
- {
- if (null !== $this->gitConfig) {
- return $this->gitConfig;
- }
- $finder = new ExecutableFinder();
- $gitBin = $finder->find('git');
- $cmd = new Process([$gitBin, 'config', '-l']);
- $cmd->run();
- if ($cmd->isSuccessful()) {
- $this->gitConfig = [];
- Preg::matchAll('{^([^=]+)=(.*)$}m', $cmd->getOutput(), $matches);
- foreach ($matches[1] as $key => $match) {
- $this->gitConfig[$match] = $matches[2][$key];
- }
- return $this->gitConfig;
- }
- return $this->gitConfig = [];
- }
- protected function hasVendorIgnore(string $ignoreFile, string $vendor = 'vendor'): bool
- {
- if (!file_exists($ignoreFile)) {
- return false;
- }
- $pattern = sprintf('{^/?%s(/\*?)?$}', preg_quote($vendor));
- $lines = file($ignoreFile, FILE_IGNORE_NEW_LINES);
- foreach ($lines as $line) {
- if (Preg::isMatch($pattern, $line)) {
- return true;
- }
- }
- return false;
- }
- protected function addVendorIgnore(string $ignoreFile, string $vendor = '/vendor/'): void
- {
- $contents = "";
- if (file_exists($ignoreFile)) {
- $contents = file_get_contents($ignoreFile);
- if (strpos($contents, "\n") !== 0) {
- $contents .= "\n";
- }
- }
- file_put_contents($ignoreFile, $contents . $vendor. "\n");
- }
- protected function isValidEmail(string $email): bool
- {
- if (!function_exists('filter_var')) {
- return true;
- }
- return false !== filter_var($email, FILTER_VALIDATE_EMAIL);
- }
- private function updateDependencies(OutputInterface $output): void
- {
- try {
- $updateCommand = $this->getApplication()->find('update');
- $this->getApplication()->resetComposer();
- $updateCommand->run(new ArrayInput([]), $output);
- } catch (\Exception $e) {
- $this->getIO()->writeError('Could not update dependencies. Run `composer update` to see more information.');
- }
- }
- private function runDumpAutoloadCommand(OutputInterface $output): void
- {
- try {
- $command = $this->getApplication()->find('dump-autoload');
- $this->getApplication()->resetComposer();
- $command->run(new ArrayInput([]), $output);
- } catch (\Exception $e) {
- $this->getIO()->writeError('Could not run dump-autoload.');
- }
- }
- private function hasDependencies(array $options): bool
- {
- $requires = (array) $options['require'];
- $devRequires = isset($options['require-dev']) ? (array) $options['require-dev'] : [];
- return !empty($requires) || !empty($devRequires);
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Command;
- use Composer\Installer;
- use Composer\Plugin\CommandEvent;
- use Composer\Plugin\PluginEvents;
- use Composer\Advisory\Auditor;
- use Composer\Util\HttpDownloader;
- use Symfony\Component\Console\Input\InputInterface;
- use Composer\Console\Input\InputOption;
- use Composer\Console\Input\InputArgument;
- use Symfony\Component\Console\Output\OutputInterface;
- class InstallCommand extends BaseCommand
- {
- use CompletionTrait;
- protected function configure()
- {
- $this
- ->setName('install')
- ->setAliases(['i'])
- ->setDescription('Installs the project dependencies from the composer.lock file if present, or falls back on the composer.json')
- ->setDefinition([
- new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
- new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist (default behavior).'),
- 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()),
- new InputOption('dry-run', null, InputOption::VALUE_NONE, 'Outputs the operations but will not execute anything (implicitly enables --verbose).'),
- new InputOption('dev', null, InputOption::VALUE_NONE, 'DEPRECATED: Enables installation of require-dev packages (enabled by default, only present for BC).'),
- new InputOption('no-suggest', null, InputOption::VALUE_NONE, 'DEPRECATED: This flag does not exist anymore.'),
- new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables installation of require-dev packages.'),
- new InputOption('no-autoloader', null, InputOption::VALUE_NONE, 'Skips autoloader generation'),
- new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
- new InputOption('no-install', null, InputOption::VALUE_NONE, 'Do not use, only defined here to catch misuse of the install command.'),
- new InputOption('audit', null, InputOption::VALUE_NONE, 'Run an audit after installation is complete.'),
- new InputOption('audit-format', null, InputOption::VALUE_REQUIRED, 'Audit output format. Must be "table", "plain", "json", or "summary".', Auditor::FORMAT_SUMMARY, Auditor::FORMATS),
- new InputOption('verbose', 'v|vv|vvv', InputOption::VALUE_NONE, 'Shows more details including new commits pulled in when updating packages.'),
- new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump'),
- new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
- new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
- new InputOption('apcu-autoloader-prefix', null, InputOption::VALUE_REQUIRED, 'Use a custom prefix for the APCu autoloader cache. Implicitly enables --apcu-autoloader'),
- new InputOption('ignore-platform-req', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Ignore a specific platform requirement (php & ext- packages).'),
- new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore all platform requirements (php & ext- packages).'),
- new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Should not be provided, use composer require instead to add a given package to composer.json.'),
- ])
- ->setHelp(
- <<<EOT
- The <info>install</info> command reads the composer.lock file from
- the current directory, processes it, and downloads and installs all the
- libraries and dependencies outlined in that file. If the file does not
- exist it will look for composer.json and do the same.
- <info>php composer.phar install</info>
- Read more at https://getcomposer.org/doc/03-cli.md#install-i
- EOT
- )
- ;
- }
- protected function execute(InputInterface $input, OutputInterface $output)
- {
- $io = $this->getIO();
- if ($input->getOption('dev')) {
- $io->writeError('<warning>You are using the deprecated option "--dev". It has no effect and will break in Composer 3.</warning>');
- }
- if ($input->getOption('no-suggest')) {
- $io->writeError('<warning>You are using the deprecated option "--no-suggest". It has no effect and will break in Composer 3.</warning>');
- }
- $args = $input->getArgument('packages');
- if (count($args) > 0) {
- $io->writeError('<error>Invalid argument '.implode(' ', $args).'. Use "composer require '.implode(' ', $args).'" instead to add packages to your composer.json.</error>');
- return 1;
- }
- if ($input->getOption('no-install')) {
- $io->writeError('<error>Invalid option "--no-install". Use "composer update --no-install" instead if you are trying to update the composer.lock file.</error>');
- return 1;
- }
- $composer = $this->requireComposer();
- if (!$composer->getLocker()->isLocked() && !HttpDownloader::isCurlEnabled()) {
- $io->writeError('<warning>Composer is operating significantly slower than normal because you do not have the PHP curl extension enabled.</warning>');
- }
- $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'install', $input, $output);
- $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
- $install = Installer::create($io, $composer);
- $config = $composer->getConfig();
- [$preferSource, $preferDist] = $this->getPreferredInstallOptions($config, $input);
- $optimize = $input->getOption('optimize-autoloader') || $config->get('optimize-autoloader');
- $authoritative = $input->getOption('classmap-authoritative') || $config->get('classmap-authoritative');
- $apcuPrefix = $input->getOption('apcu-autoloader-prefix');
- $apcu = $apcuPrefix !== null || $input->getOption('apcu-autoloader') || $config->get('apcu-autoloader');
- $composer->getInstallationManager()->setOutputProgress(!$input->getOption('no-progress'));
- $install
- ->setDryRun($input->getOption('dry-run'))
- ->setVerbose($input->getOption('verbose'))
- ->setPreferSource($preferSource)
- ->setPreferDist($preferDist)
- ->setDevMode(!$input->getOption('no-dev'))
- ->setDumpAutoloader(!$input->getOption('no-autoloader'))
- ->setOptimizeAutoloader($optimize)
- ->setClassMapAuthoritative($authoritative)
- ->setApcuAutoloader($apcu, $apcuPrefix)
- ->setPlatformRequirementFilter($this->getPlatformRequirementFilter($input))
- ->setAudit($input->getOption('audit'))
- ->setAuditFormat($this->getAuditFormat($input))
- ;
- if ($input->getOption('no-plugins')) {
- $install->disablePlugins();
- }
- return $install->run();
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Command;
- use Composer\Console\Input\InputOption;
- use Composer\Json\JsonFile;
- use Composer\Package\CompletePackageInterface;
- use Composer\Plugin\CommandEvent;
- use Composer\Plugin\PluginEvents;
- use Composer\Repository\RepositoryUtils;
- use Composer\Util\PackageInfo;
- use Composer\Util\PackageSorter;
- use Symfony\Component\Console\Formatter\OutputFormatter;
- use Symfony\Component\Console\Helper\Table;
- use Symfony\Component\Console\Input\InputInterface;
- use Symfony\Component\Console\Output\OutputInterface;
- use Symfony\Component\Console\Style\SymfonyStyle;
- class LicensesCommand extends BaseCommand
- {
- protected function configure(): void
- {
- $this
- ->setName('licenses')
- ->setDescription('Shows information about licenses of dependencies')
- ->setDefinition([
- new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the output: text, json or summary', 'text', ['text', 'json', 'summary']),
- new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables search in require-dev packages.'),
- ])
- ->setHelp(
- <<<EOT
- The license command displays detailed information about the licenses of
- the installed dependencies.
- Read more at https://getcomposer.org/doc/03-cli.md#licenses
- EOT
- )
- ;
- }
- protected function execute(InputInterface $input, OutputInterface $output): int
- {
- $composer = $this->requireComposer();
- $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'licenses', $input, $output);
- $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
- $root = $composer->getPackage();
- $repo = $composer->getRepositoryManager()->getLocalRepository();
- if ($input->getOption('no-dev')) {
- $packages = RepositoryUtils::filterRequiredPackages($repo->getPackages(), $root);
- } else {
- $packages = $repo->getPackages();
- }
- $packages = PackageSorter::sortPackagesAlphabetically($packages);
- $io = $this->getIO();
- switch ($format = $input->getOption('format')) {
- case 'text':
- $io->write('Name: <comment>'.$root->getPrettyName().'</comment>');
- $io->write('Version: <comment>'.$root->getFullPrettyVersion().'</comment>');
- $io->write('Licenses: <comment>'.(implode(', ', $root->getLicense()) ?: 'none').'</comment>');
- $io->write('Dependencies:');
- $io->write('');
- $table = new Table($output);
- $table->setStyle('compact');
- $table->setHeaders(['Name', 'Version', 'Licenses']);
- foreach ($packages as $package) {
- $link = PackageInfo::getViewSourceOrHomepageUrl($package);
- if ($link !== null) {
- $name = '<href='.OutputFormatter::escape($link).'>'.$package->getPrettyName().'</>';
- } else {
- $name = $package->getPrettyName();
- }
- $table->addRow([
- $name,
- $package->getFullPrettyVersion(),
- implode(', ', $package instanceof CompletePackageInterface ? $package->getLicense() : []) ?: 'none',
- ]);
- }
- $table->render();
- break;
- case 'json':
- $dependencies = [];
- foreach ($packages as $package) {
- $dependencies[$package->getPrettyName()] = [
- 'version' => $package->getFullPrettyVersion(),
- 'license' => $package instanceof CompletePackageInterface ? $package->getLicense() : [],
- ];
- }
- $io->write(JsonFile::encode([
- 'name' => $root->getPrettyName(),
- 'version' => $root->getFullPrettyVersion(),
- 'license' => $root->getLicense(),
- 'dependencies' => $dependencies,
- ]));
- break;
- case 'summary':
- $usedLicenses = [];
- foreach ($packages as $package) {
- $licenses = $package instanceof CompletePackageInterface ? $package->getLicense() : [];
- if (count($licenses) === 0) {
- $licenses[] = 'none';
- }
- foreach ($licenses as $licenseName) {
- if (!isset($usedLicenses[$licenseName])) {
- $usedLicenses[$licenseName] = 0;
- }
- $usedLicenses[$licenseName]++;
- }
- }
- arsort($usedLicenses, SORT_NUMERIC);
- $rows = [];
- foreach ($usedLicenses as $usedLicense => $numberOfDependencies) {
- $rows[] = [$usedLicense, $numberOfDependencies];
- }
- $symfonyIo = new SymfonyStyle($input, $output);
- $symfonyIo->table(
- ['License', 'Number of dependencies'],
- $rows
- );
- break;
- default:
- throw new \RuntimeException(sprintf('Unsupported format "%s". See help for supported formats.', $format));
- }
- return 0;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Command;
- use Symfony\Component\Console\Input\InputInterface;
- use Composer\Console\Input\InputArgument;
- use Symfony\Component\Console\Input\ArrayInput;
- use Composer\Console\Input\InputOption;
- use Symfony\Component\Console\Output\OutputInterface;
- class OutdatedCommand extends BaseCommand
- {
- use CompletionTrait;
- protected function configure(): void
- {
- $this
- ->setName('outdated')
- ->setDescription('Shows a list of installed packages that have updates available, including their latest version')
- ->setDefinition([
- new InputArgument('package', InputArgument::OPTIONAL, 'Package to inspect. Or a name including a wildcard (*) to filter lists of packages instead.', null, $this->suggestInstalledPackage(false)),
- new InputOption('outdated', 'o', InputOption::VALUE_NONE, 'Show only packages that are outdated (this is the default, but present here for compat with `show`'),
- new InputOption('all', 'a', InputOption::VALUE_NONE, 'Show all installed packages with their latest versions'),
- new InputOption('locked', null, InputOption::VALUE_NONE, 'Shows updates for packages from the lock file, regardless of what is currently in vendor dir'),
- new InputOption('direct', 'D', InputOption::VALUE_NONE, 'Shows only packages that are directly required by the root package'),
- new InputOption('strict', null, InputOption::VALUE_NONE, 'Return a non-zero exit code when there are outdated packages'),
- new InputOption('major-only', 'M', InputOption::VALUE_NONE, 'Show only packages that have major SemVer-compatible updates.'),
- new InputOption('minor-only', 'm', InputOption::VALUE_NONE, 'Show only packages that have minor SemVer-compatible updates.'),
- new InputOption('patch-only', 'p', InputOption::VALUE_NONE, 'Show only packages that have patch SemVer-compatible updates.'),
- new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the output: text or json', 'text', ['json', 'text']),
- new InputOption('ignore', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Ignore specified package(s). Use it if you don\'t want to be informed about new versions of some packages.', null, $this->suggestInstalledPackage(false)),
- new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables search in require-dev packages.'),
- 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'),
- new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore all platform requirements (php & ext- packages). Use with the --outdated option'),
- ])
- ->setHelp(
- <<<EOT
- The outdated command is just a proxy for `composer show -l`
- The color coding (or signage if you have ANSI colors disabled) for dependency versions is as such:
- - <info>green</info> (=): Dependency is in the latest version and is up to date.
- - <comment>yellow</comment> (~): Dependency has a new version available that includes backwards
- compatibility breaks according to semver, so upgrade when you can but it
- may involve work.
- - <highlight>red</highlight> (!): Dependency has a new version that is semver-compatible and you should upgrade it.
- Read more at https://getcomposer.org/doc/03-cli.md#outdated
- EOT
- )
- ;
- }
- protected function execute(InputInterface $input, OutputInterface $output): int
- {
- $args = [
- 'command' => 'show',
- '--latest' => true,
- ];
- if (!$input->getOption('all')) {
- $args['--outdated'] = true;
- }
- if ($input->getOption('direct')) {
- $args['--direct'] = true;
- }
- if (null !== $input->getArgument('package')) {
- $args['package'] = $input->getArgument('package');
- }
- if ($input->getOption('strict')) {
- $args['--strict'] = true;
- }
- if ($input->getOption('major-only')) {
- $args['--major-only'] = true;
- }
- if ($input->getOption('minor-only')) {
- $args['--minor-only'] = true;
- }
- if ($input->getOption('patch-only')) {
- $args['--patch-only'] = true;
- }
- if ($input->getOption('locked')) {
- $args['--locked'] = true;
- }
- if ($input->getOption('no-dev')) {
- $args['--no-dev'] = true;
- }
- $args['--ignore-platform-req'] = $input->getOption('ignore-platform-req');
- if ($input->getOption('ignore-platform-reqs')) {
- $args['--ignore-platform-reqs'] = true;
- }
- $args['--format'] = $input->getOption('format');
- $args['--ignore'] = $input->getOption('ignore');
- $input = new ArrayInput($args);
- return $this->getApplication()->run($input, $output);
- }
- public function isProxyCommand(): bool
- {
- return true;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Command;
- use Composer\Factory;
- use Composer\Filter\PlatformRequirementFilter\IgnoreAllPlatformRequirementFilter;
- use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterFactory;
- use Composer\Package\CompletePackageInterface;
- use Composer\Package\PackageInterface;
- use Composer\Package\Version\VersionParser;
- use Composer\Package\Version\VersionSelector;
- use Composer\Pcre\Preg;
- use Composer\Repository\CompositeRepository;
- use Composer\Repository\PlatformRepository;
- use Composer\Repository\RepositoryFactory;
- use Composer\Repository\RepositorySet;
- use Composer\Semver\Constraint\Constraint;
- use Composer\Util\Filesystem;
- use Symfony\Component\Console\Input\InputInterface;
- use Symfony\Component\Console\Output\OutputInterface;
- trait PackageDiscoveryTrait
- {
- private $repos;
- private $repositorySets;
- protected function getRepos(): CompositeRepository
- {
- if (null === $this->repos) {
- $this->repos = new CompositeRepository(array_merge(
- [new PlatformRepository],
- RepositoryFactory::defaultReposWithDefaultManager($this->getIO())
- ));
- }
- return $this->repos;
- }
- private function getRepositorySet(InputInterface $input, ?string $minimumStability = null): RepositorySet
- {
- $key = $minimumStability ?? 'default';
- if (!isset($this->repositorySets[$key])) {
- $this->repositorySets[$key] = $repositorySet = new RepositorySet($minimumStability ?? $this->getMinimumStability($input));
- $repositorySet->addRepository($this->getRepos());
- }
- return $this->repositorySets[$key];
- }
- private function getMinimumStability(InputInterface $input): string
- {
- if ($input->hasOption('stability')) {
- return VersionParser::normalizeStability($input->getOption('stability') ?? 'stable');
- }
- $file = Factory::getComposerFile();
- if (is_file($file) && Filesystem::isReadable($file) && is_array($composer = json_decode((string) file_get_contents($file), true))) {
- if (!empty($composer['minimum-stability'])) {
- return VersionParser::normalizeStability($composer['minimum-stability']);
- }
- }
- return 'stable';
- }
- final protected function determineRequirements(InputInterface $input, OutputInterface $output, array $requires = [], ?PlatformRepository $platformRepo = null, string $preferredStability = 'stable', bool $checkProvidedVersions = true, bool $fixed = false): array
- {
- if (count($requires) > 0) {
- $requires = $this->normalizeRequirements($requires);
- $result = [];
- $io = $this->getIO();
- foreach ($requires as $requirement) {
- if (isset($requirement['version']) && Preg::isMatch('{^\d+(\.\d+)?$}', $requirement['version'])) {
- $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');
- }
- if (!isset($requirement['version'])) {
- [$name, $version] = $this->findBestVersionAndNameForPackage($input, $requirement['name'], $platformRepo, $preferredStability, $fixed);
- $requirement['version'] = $version;
- $requirement['name'] = $name;
- $io->writeError(sprintf(
- 'Using version <info>%s</info> for <info>%s</info>',
- $requirement['version'],
- $requirement['name']
- ));
- }
- $result[] = $requirement['name'] . ' ' . $requirement['version'];
- }
- return $result;
- }
- $versionParser = new VersionParser();
- $composer = $this->tryComposer();
- $installedRepo = null;
- if (null !== $composer) {
- $installedRepo = $composer->getRepositoryManager()->getLocalRepository();
- }
- $existingPackages = [];
- if (null !== $installedRepo) {
- foreach ($installedRepo->getPackages() as $package) {
- $existingPackages[] = $package->getName();
- }
- }
- unset($composer, $installedRepo);
- $io = $this->getIO();
- while (null !== $package = $io->ask('Search for a package: ')) {
- $matches = $this->getRepos()->search($package);
- if (count($matches) > 0) {
- foreach ($matches as $position => $foundPackage) {
- if (in_array($foundPackage['name'], $existingPackages, true)) {
- unset($matches[$position]);
- }
- }
- $matches = array_values($matches);
- $exactMatch = false;
- foreach ($matches as $match) {
- if ($match['name'] === $package) {
- $exactMatch = true;
- break;
- }
- }
- if (!$exactMatch) {
- $providers = $this->getRepos()->getProviders($package);
- if (count($providers) > 0) {
- array_unshift($matches, ['name' => $package, 'description' => '']);
- }
- $choices = [];
- foreach ($matches as $position => $foundPackage) {
- $abandoned = '';
- if (isset($foundPackage['abandoned'])) {
- if (is_string($foundPackage['abandoned'])) {
- $replacement = sprintf('Use %s instead', $foundPackage['abandoned']);
- } else {
- $replacement = 'No replacement was suggested';
- }
- $abandoned = sprintf('<warning>Abandoned. %s.</warning>', $replacement);
- }
- $choices[] = sprintf(' <info>%5s</info> %s %s', "[$position]", $foundPackage['name'], $abandoned);
- }
- $io->writeError([
- '',
- sprintf('Found <info>%s</info> packages matching <info>%s</info>', count($matches), $package),
- '',
- ]);
- $io->writeError($choices);
- $io->writeError('');
- $validator = static function (string $selection) use ($matches, $versionParser) {
- if ('' === $selection) {
- return false;
- }
- if (is_numeric($selection) && isset($matches[(int) $selection])) {
- $package = $matches[(int) $selection];
- return $package['name'];
- }
- if (Preg::isMatch('{^\s*(?P<name>[\S/]+)(?:\s+(?P<version>\S+))?\s*$}', $selection, $packageMatches)) {
- if (isset($packageMatches['version'])) {
- $versionParser->parseConstraints($packageMatches['version']);
- return $packageMatches['name'].' '.$packageMatches['version'];
- }
- return $packageMatches['name'];
- }
- throw new \Exception('Not a valid selection');
- };
- $package = $io->askAndValidate(
- 'Enter package # to add, or the complete package name if it is not listed: ',
- $validator,
- 3,
- ''
- );
- }
- if (false !== $package && false === strpos($package, ' ')) {
- $validator = static function (string $input) {
- $input = trim($input);
- return strlen($input) > 0 ? $input : false;
- };
- $constraint = $io->askAndValidate(
- 'Enter the version constraint to require (or leave blank to use the latest version): ',
- $validator,
- 3,
- ''
- );
- if (false === $constraint) {
- [, $constraint] = $this->findBestVersionAndNameForPackage($input, $package, $platformRepo, $preferredStability);
- $io->writeError(sprintf(
- 'Using version <info>%s</info> for <info>%s</info>',
- $constraint,
- $package
- ));
- }
- $package .= ' '.$constraint;
- }
- if (false !== $package) {
- $requires[] = $package;
- $existingPackages[] = explode(' ', $package)[0];
- }
- }
- }
- return $requires;
- }
- private function findBestVersionAndNameForPackage(InputInterface $input, string $name, ?PlatformRepository $platformRepo = null, string $preferredStability = 'stable', bool $fixed = false): array
- {
- if ($input->hasOption('ignore-platform-reqs') && $input->hasOption('ignore-platform-req')) {
- $platformRequirementFilter = $this->getPlatformRequirementFilter($input);
- } else {
- $platformRequirementFilter = PlatformRequirementFilterFactory::ignoreNothing();
- }
- $repoSet = $this->getRepositorySet($input);
- $versionSelector = new VersionSelector($repoSet, $platformRepo);
- $effectiveMinimumStability = $this->getMinimumStability($input);
- $package = $versionSelector->findBestCandidate($name, null, $preferredStability, $platformRequirementFilter, 0, $this->getIO());
- if (false === $package) {
- if ($platformRequirementFilter->isIgnored($name)) {
- return [$name, '*'];
- }
- $providers = $repoSet->getProviders($name);
- if (count($providers) > 0) {
- $constraint = '*';
- if ($input->isInteractive()) {
- $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) {
- $parser = new VersionParser();
- $parser->parseConstraints($value);
- return $value;
- }, 3, '*');
- }
- return [$name, $constraint];
- }
- if (!($platformRequirementFilter instanceof IgnoreAllPlatformRequirementFilter) && false !== ($candidate = $versionSelector->findBestCandidate($name, null, $preferredStability, PlatformRequirementFilterFactory::ignoreAll()))) {
- throw new \InvalidArgumentException(sprintf(
- 'Package %s has requirements incompatible with your PHP version, PHP extensions and Composer version' . $this->getPlatformExceptionDetails($candidate, $platformRepo),
- $name
- ));
- }
- if (false !== ($package = $versionSelector->findBestCandidate($name, null, $preferredStability, $platformRequirementFilter, RepositorySet::ALLOW_UNACCEPTABLE_STABILITIES))) {
- if (false !== ($allReposPackage = $versionSelector->findBestCandidate($name, null, $preferredStability, $platformRequirementFilter, RepositorySet::ALLOW_SHADOWED_REPOSITORIES))) {
- throw new \InvalidArgumentException(
- '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.'
- );
- }
- throw new \InvalidArgumentException(sprintf(
- 'Could not find a version of package %s matching your minimum-stability (%s). Require it with an explicit version constraint allowing its desired stability.',
- $name,
- $effectiveMinimumStability
- ));
- }
- if (!$platformRequirementFilter instanceof IgnoreAllPlatformRequirementFilter && false !== ($candidate = $versionSelector->findBestCandidate($name, null, $preferredStability, PlatformRequirementFilterFactory::ignoreAll(), RepositorySet::ALLOW_UNACCEPTABLE_STABILITIES))) {
- $additional = '';
- if (false === $versionSelector->findBestCandidate($name, null, $preferredStability, PlatformRequirementFilterFactory::ignoreAll())) {
- $additional = PHP_EOL.PHP_EOL.'Additionally, the package was only found with a stability of "'.$candidate->getStability().'" while your minimum stability is "'.$effectiveMinimumStability.'".';
- }
- throw new \InvalidArgumentException(sprintf(
- 'Could not find package %s in any version matching your PHP version, PHP extensions and Composer version' . $this->getPlatformExceptionDetails($candidate, $platformRepo) . '%s',
- $name,
- $additional
- ));
- }
- $similar = $this->findSimilar($name);
- if (count($similar) > 0) {
- if (in_array($name, $similar, true)) {
- throw new \InvalidArgumentException(sprintf(
- "Could not find package %s. It was however found via repository search, which indicates a consistency issue with the repository.",
- $name
- ));
- }
- throw new \InvalidArgumentException(sprintf(
- "Could not find package %s.\n\nDid you mean " . (count($similar) > 1 ? 'one of these' : 'this') . "?\n %s",
- $name,
- implode("\n ", $similar)
- ));
- }
- throw new \InvalidArgumentException(sprintf(
- '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).',
- $name,
- $effectiveMinimumStability
- ));
- }
- return [
- $package->getPrettyName(),
- $fixed ? $package->getPrettyVersion() : $versionSelector->findRecommendedRequireVersion($package),
- ];
- }
- private function findSimilar(string $package): array
- {
- try {
- if (null === $this->repos) {
- throw new \LogicException('findSimilar was called before $this->repos was initialized');
- }
- $results = $this->repos->search($package);
- } catch (\Throwable $e) {
- if ($e instanceof \LogicException) {
- throw $e;
- }
- return [];
- }
- $similarPackages = [];
- $installedRepo = $this->requireComposer()->getRepositoryManager()->getLocalRepository();
- foreach ($results as $result) {
- if (null !== $installedRepo->findPackage($result['name'], '*')) {
- continue;
- }
- $similarPackages[$result['name']] = levenshtein($package, $result['name']);
- }
- asort($similarPackages);
- return array_keys(array_slice($similarPackages, 0, 5));
- }
- private function getPlatformExceptionDetails(PackageInterface $candidate, ?PlatformRepository $platformRepo = null): string
- {
- $details = [];
- if (null === $platformRepo) {
- return '';
- }
- foreach ($candidate->getRequires() as $link) {
- if (!PlatformRepository::isPlatformPackage($link->getTarget())) {
- continue;
- }
- $platformPkg = $platformRepo->findPackage($link->getTarget(), '*');
- if (null === $platformPkg) {
- if ($platformRepo->isPlatformPackageDisabled($link->getTarget())) {
- $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".';
- } else {
- $details[] = $candidate->getPrettyName().' '.$candidate->getPrettyVersion().' requires '.$link->getTarget().' '.$link->getPrettyConstraint().' but it is not present.';
- }
- continue;
- }
- if (!$link->getConstraint()->matches(new Constraint('==', $platformPkg->getVersion()))) {
- $platformPkgVersion = $platformPkg->getPrettyVersion();
- $platformExtra = $platformPkg->getExtra();
- if (isset($platformExtra['config.platform']) && $platformPkg instanceof CompletePackageInterface) {
- $platformPkgVersion .= ' ('.$platformPkg->getDescription().')';
- }
- $details[] = $candidate->getPrettyName().' '.$candidate->getPrettyVersion().' requires '.$link->getTarget().' '.$link->getPrettyConstraint().' which does not match your installed version '.$platformPkgVersion.'.';
- }
- }
- if (count($details) === 0) {
- return '';
- }
- return ':'.PHP_EOL.' - ' . implode(PHP_EOL.' - ', $details);
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Command;
- use Symfony\Component\Console\Input\InputInterface;
- use Symfony\Component\Console\Output\OutputInterface;
- use Composer\Console\Input\InputArgument;
- use Composer\Console\Input\InputOption;
- class ProhibitsCommand extends BaseDependencyCommand
- {
- use CompletionTrait;
- protected function configure(): void
- {
- $this
- ->setName('prohibits')
- ->setAliases(['why-not'])
- ->setDescription('Shows which packages prevent the given package from being installed')
- ->setDefinition([
- new InputArgument(self::ARGUMENT_PACKAGE, InputArgument::REQUIRED, 'Package to inspect', null, $this->suggestAvailablePackage()),
- new InputArgument(self::ARGUMENT_CONSTRAINT, InputArgument::REQUIRED, 'Version constraint, which version you expected to be installed'),
- new InputOption(self::OPTION_RECURSIVE, 'r', InputOption::VALUE_NONE, 'Recursively resolves up to the root package'),
- new InputOption(self::OPTION_TREE, 't', InputOption::VALUE_NONE, 'Prints the results as a nested tree'),
- new InputOption('locked', null, InputOption::VALUE_NONE, 'Read dependency information from composer.lock'),
- ])
- ->setHelp(
- <<<EOT
- Displays detailed information about why a package cannot be installed.
- <info>php composer.phar prohibits composer/composer</info>
- Read more at https://getcomposer.org/doc/03-cli.md#prohibits-why-not-
- EOT
- )
- ;
- }
- protected function execute(InputInterface $input, OutputInterface $output): int
- {
- return parent::doExecute($input, $output, true);
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Command;
- use Composer\DependencyResolver\Operation\InstallOperation;
- use Composer\DependencyResolver\Operation\UninstallOperation;
- use Composer\DependencyResolver\Transaction;
- use Composer\Package\AliasPackage;
- use Composer\Package\BasePackage;
- use Composer\Pcre\Preg;
- use Composer\Plugin\CommandEvent;
- use Composer\Plugin\PluginEvents;
- use Composer\Script\ScriptEvents;
- use Composer\Util\Platform;
- use Symfony\Component\Console\Input\InputInterface;
- use Composer\Console\Input\InputOption;
- use Composer\Console\Input\InputArgument;
- use Symfony\Component\Console\Output\OutputInterface;
- class ReinstallCommand extends BaseCommand
- {
- use CompletionTrait;
- protected function configure(): void
- {
- $this
- ->setName('reinstall')
- ->setDescription('Uninstalls and reinstalls the given package names')
- ->setDefinition([
- new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
- new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist (default behavior).'),
- 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()),
- new InputOption('no-autoloader', null, InputOption::VALUE_NONE, 'Skips autoloader generation'),
- new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
- new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump'),
- new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
- new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
- new InputOption('apcu-autoloader-prefix', null, InputOption::VALUE_REQUIRED, 'Use a custom prefix for the APCu autoloader cache. Implicitly enables --apcu-autoloader'),
- new InputOption('ignore-platform-req', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Ignore a specific platform requirement (php & ext- packages).'),
- new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore all platform requirements (php & ext- packages).'),
- new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::REQUIRED, 'List of package names to reinstall, can include a wildcard (*) to match any substring.', null, $this->suggestInstalledPackage(false)),
- ])
- ->setHelp(
- <<<EOT
- The <info>reinstall</info> command looks up installed packages by name,
- uninstalls them and reinstalls them. This lets you do a clean install
- of a package if you messed with its files, or if you wish to change
- the installation type using --prefer-install.
- <info>php composer.phar reinstall acme/foo "acme/bar-*"</info>
- Read more at https://getcomposer.org/doc/03-cli.md#reinstall
- EOT
- )
- ;
- }
- protected function execute(InputInterface $input, OutputInterface $output): int
- {
- $io = $this->getIO();
- $composer = $this->requireComposer();
- $localRepo = $composer->getRepositoryManager()->getLocalRepository();
- $packagesToReinstall = [];
- $packageNamesToReinstall = [];
- foreach ($input->getArgument('packages') as $pattern) {
- $patternRegexp = BasePackage::packageNameToRegexp($pattern);
- $matched = false;
- foreach ($localRepo->getCanonicalPackages() as $package) {
- if (Preg::isMatch($patternRegexp, $package->getName())) {
- $matched = true;
- $packagesToReinstall[] = $package;
- $packageNamesToReinstall[] = $package->getName();
- }
- }
- if (!$matched) {
- $io->writeError('<warning>Pattern "' . $pattern . '" does not match any currently installed packages.</warning>');
- }
- }
- if (!$packagesToReinstall) {
- $io->writeError('<warning>Found no packages to reinstall, aborting.</warning>');
- return 1;
- }
- $uninstallOperations = [];
- foreach ($packagesToReinstall as $package) {
- $uninstallOperations[] = new UninstallOperation($package);
- }
- $presentPackages = $localRepo->getPackages();
- $resultPackages = $presentPackages;
- foreach ($presentPackages as $index => $package) {
- if (in_array($package->getName(), $packageNamesToReinstall, true)) {
- unset($presentPackages[$index]);
- }
- }
- $transaction = new Transaction($presentPackages, $resultPackages);
- $installOperations = $transaction->getOperations();
- $installOrder = [];
- foreach ($installOperations as $index => $op) {
- if ($op instanceof InstallOperation && !$op->getPackage() instanceof AliasPackage) {
- $installOrder[$op->getPackage()->getName()] = $index;
- }
- }
- usort($uninstallOperations, static function ($a, $b) use ($installOrder): int {
- return $installOrder[$b->getPackage()->getName()] - $installOrder[$a->getPackage()->getName()];
- });
- $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'reinstall', $input, $output);
- $eventDispatcher = $composer->getEventDispatcher();
- $eventDispatcher->dispatch($commandEvent->getName(), $commandEvent);
- $config = $composer->getConfig();
- [$preferSource, $preferDist] = $this->getPreferredInstallOptions($config, $input);
- $installationManager = $composer->getInstallationManager();
- $downloadManager = $composer->getDownloadManager();
- $package = $composer->getPackage();
- $installationManager->setOutputProgress(!$input->getOption('no-progress'));
- if ($input->getOption('no-plugins')) {
- $installationManager->disablePlugins();
- }
- $downloadManager->setPreferSource($preferSource);
- $downloadManager->setPreferDist($preferDist);
- $devMode = $localRepo->getDevMode() !== null ? $localRepo->getDevMode() : true;
- Platform::putEnv('COMPOSER_DEV_MODE', $devMode ? '1' : '0');
- $eventDispatcher->dispatchScript(ScriptEvents::PRE_INSTALL_CMD, $devMode);
- $installationManager->execute($localRepo, $uninstallOperations, $devMode);
- $installationManager->execute($localRepo, $installOperations, $devMode);
- if (!$input->getOption('no-autoloader')) {
- $optimize = $input->getOption('optimize-autoloader') || $config->get('optimize-autoloader');
- $authoritative = $input->getOption('classmap-authoritative') || $config->get('classmap-authoritative');
- $apcuPrefix = $input->getOption('apcu-autoloader-prefix');
- $apcu = $apcuPrefix !== null || $input->getOption('apcu-autoloader') || $config->get('apcu-autoloader');
- $generator = $composer->getAutoloadGenerator();
- $generator->setClassMapAuthoritative($authoritative);
- $generator->setApcu($apcu, $apcuPrefix);
- $generator->setPlatformRequirementFilter($this->getPlatformRequirementFilter($input));
- $generator->dump($config, $localRepo, $package, $installationManager, 'composer', $optimize);
- }
- $eventDispatcher->dispatchScript(ScriptEvents::POST_INSTALL_CMD, $devMode);
- return 0;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Command;
- use Composer\Config\JsonConfigSource;
- use Composer\DependencyResolver\Request;
- use Composer\Installer;
- use Composer\Pcre\Preg;
- use Composer\Plugin\CommandEvent;
- use Composer\Plugin\PluginEvents;
- use Composer\Json\JsonFile;
- use Composer\Factory;
- use Symfony\Component\Console\Input\InputInterface;
- use Composer\Console\Input\InputOption;
- use Composer\Console\Input\InputArgument;
- use Symfony\Component\Console\Output\OutputInterface;
- use Composer\Package\BasePackage;
- use Composer\Advisory\Auditor;
- class RemoveCommand extends BaseCommand
- {
- use CompletionTrait;
- protected function configure()
- {
- $this
- ->setName('remove')
- ->setDescription('Removes a package from the require or require-dev')
- ->setDefinition([
- new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::REQUIRED, 'Packages that should be removed.', null, $this->suggestRootRequirement()),
- new InputOption('dev', null, InputOption::VALUE_NONE, 'Removes a package from the require-dev section.'),
- new InputOption('dry-run', null, InputOption::VALUE_NONE, 'Outputs the operations but will not execute anything (implicitly enables --verbose).'),
- new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
- new InputOption('no-update', null, InputOption::VALUE_NONE, 'Disables the automatic update of the dependencies (implies --no-install).'),
- new InputOption('no-install', null, InputOption::VALUE_NONE, 'Skip the install step after updating the composer.lock file.'),
- 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).'),
- new InputOption('audit-format', null, InputOption::VALUE_REQUIRED, 'Audit output format. Must be "table", "plain", "json", or "summary".', Auditor::FORMAT_SUMMARY, Auditor::FORMATS),
- new InputOption('update-no-dev', null, InputOption::VALUE_NONE, 'Run the dependency update with the --no-dev option.'),
- new InputOption('update-with-dependencies', 'w', InputOption::VALUE_NONE, 'Allows inherited dependencies to be updated with explicit dependencies. (Deprecrated, is now default behavior)'),
- new InputOption('update-with-all-dependencies', 'W', InputOption::VALUE_NONE, 'Allows all inherited dependencies to be updated, including those that are root requirements.'),
- new InputOption('with-all-dependencies', null, InputOption::VALUE_NONE, 'Alias for --update-with-all-dependencies'),
- new InputOption('no-update-with-dependencies', null, InputOption::VALUE_NONE, 'Does not allow inherited dependencies to be updated with explicit dependencies.'),
- new InputOption('unused', null, InputOption::VALUE_NONE, 'Remove all packages which are locked but not required by any other package.'),
- new InputOption('ignore-platform-req', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Ignore a specific platform requirement (php & ext- packages).'),
- new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore all platform requirements (php & ext- packages).'),
- new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump'),
- new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
- new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
- new InputOption('apcu-autoloader-prefix', null, InputOption::VALUE_REQUIRED, 'Use a custom prefix for the APCu autoloader cache. Implicitly enables --apcu-autoloader'),
- ])
- ->setHelp(
- <<<EOT
- The <info>remove</info> command removes a package from the current
- list of installed packages
- <info>php composer.phar remove</info>
- Read more at https://getcomposer.org/doc/03-cli.md#remove
- EOT
- )
- ;
- }
- protected function interact(InputInterface $input, OutputInterface $output)
- {
- if ($input->getOption('unused')) {
- $composer = $this->requireComposer();
- $locker = $composer->getLocker();
- if (!$locker->isLocked()) {
- throw new \UnexpectedValueException('A valid composer.lock file is required to run this command with --unused');
- }
- $lockedPackages = $locker->getLockedRepository()->getPackages();
- $required = [];
- foreach (array_merge($composer->getPackage()->getRequires(), $composer->getPackage()->getDevRequires()) as $link) {
- $required[$link->getTarget()] = true;
- }
- do {
- $found = false;
- foreach ($lockedPackages as $index => $package) {
- foreach ($package->getNames() as $name) {
- if (isset($required[$name])) {
- foreach ($package->getRequires() as $link) {
- $required[$link->getTarget()] = true;
- }
- $found = true;
- unset($lockedPackages[$index]);
- break;
- }
- }
- }
- } while ($found);
- $unused = [];
- foreach ($lockedPackages as $package) {
- $unused[] = $package->getName();
- }
- $input->setArgument('packages', array_merge($input->getArgument('packages'), $unused));
- if (count($input->getArgument('packages')) === 0) {
- $this->getIO()->writeError('<info>No unused packages to remove</info>');
- $this->setCode(static function (): int {
- return 0;
- });
- }
- }
- }
- protected function execute(InputInterface $input, OutputInterface $output)
- {
- $packages = $input->getArgument('packages');
- $packages = array_map('strtolower', $packages);
- $file = Factory::getComposerFile();
- $jsonFile = new JsonFile($file);
- $composer = $jsonFile->read();
- $composerBackup = file_get_contents($jsonFile->getPath());
- $json = new JsonConfigSource($jsonFile);
- $type = $input->getOption('dev') ? 'require-dev' : 'require';
- $altType = !$input->getOption('dev') ? 'require-dev' : 'require';
- $io = $this->getIO();
- if ($input->getOption('update-with-dependencies')) {
- $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>');
- }
- foreach (['require', 'require-dev'] as $linkType) {
- if (isset($composer[$linkType])) {
- foreach ($composer[$linkType] as $name => $version) {
- $composer[$linkType][strtolower($name)] = $name;
- }
- }
- }
- $dryRun = $input->getOption('dry-run');
- $toRemove = [];
- foreach ($packages as $package) {
- if (isset($composer[$type][$package])) {
- if ($dryRun) {
- $toRemove[$type][] = $composer[$type][$package];
- } else {
- $json->removeLink($type, $composer[$type][$package]);
- }
- } elseif (isset($composer[$altType][$package])) {
- $io->writeError('<warning>' . $composer[$altType][$package] . ' could not be found in ' . $type . ' but it is present in ' . $altType . '</warning>');
- if ($io->isInteractive()) {
- if ($io->askConfirmation('Do you want to remove it from ' . $altType . ' [<comment>yes</comment>]? ')) {
- if ($dryRun) {
- $toRemove[$altType][] = $composer[$altType][$package];
- } else {
- $json->removeLink($altType, $composer[$altType][$package]);
- }
- }
- }
- } elseif (isset($composer[$type]) && count($matches = Preg::grep(BasePackage::packageNameToRegexp($package), array_keys($composer[$type]))) > 0) {
- foreach ($matches as $matchedPackage) {
- if ($dryRun) {
- $toRemove[$type][] = $matchedPackage;
- } else {
- $json->removeLink($type, $matchedPackage);
- }
- }
- } elseif (isset($composer[$altType]) && count($matches = Preg::grep(BasePackage::packageNameToRegexp($package), array_keys($composer[$altType]))) > 0) {
- foreach ($matches as $matchedPackage) {
- $io->writeError('<warning>' . $matchedPackage . ' could not be found in ' . $type . ' but it is present in ' . $altType . '</warning>');
- if ($io->isInteractive()) {
- if ($io->askConfirmation('Do you want to remove it from ' . $altType . ' [<comment>yes</comment>]? ')) {
- if ($dryRun) {
- $toRemove[$altType][] = $matchedPackage;
- } else {
- $json->removeLink($altType, $matchedPackage);
- }
- }
- }
- }
- } else {
- $io->writeError('<warning>'.$package.' is not required in your composer.json and has not been removed</warning>');
- }
- }
- $io->writeError('<info>'.$file.' has been updated</info>');
- if ($input->getOption('no-update')) {
- return 0;
- }
- if ($composer = $this->tryComposer()) {
- $composer->getPluginManager()->deactivateInstalledPlugins();
- }
- $this->resetComposer();
- $composer = $this->requireComposer();
- if ($dryRun) {
- $rootPackage = $composer->getPackage();
- $links = [
- 'require' => $rootPackage->getRequires(),
- 'require-dev' => $rootPackage->getDevRequires(),
- ];
- foreach ($toRemove as $type => $names) {
- foreach ($names as $name) {
- unset($links[$type][$name]);
- }
- }
- $rootPackage->setRequires($links['require']);
- $rootPackage->setDevRequires($links['require-dev']);
- }
- $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'remove', $input, $output);
- $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
- $allowPlugins = $composer->getConfig()->get('allow-plugins');
- $removedPlugins = is_array($allowPlugins) ? array_intersect(array_keys($allowPlugins), $packages) : [];
- if (!$dryRun && is_array($allowPlugins) && count($removedPlugins) > 0) {
- if (count($allowPlugins) === count($removedPlugins)) {
- $json->removeConfigSetting('allow-plugins');
- } else {
- foreach ($removedPlugins as $plugin) {
- $json->removeConfigSetting('allow-plugins.'.$plugin);
- }
- }
- }
- $composer->getInstallationManager()->setOutputProgress(!$input->getOption('no-progress'));
- $install = Installer::create($io, $composer);
- $updateDevMode = !$input->getOption('update-no-dev');
- $optimize = $input->getOption('optimize-autoloader') || $composer->getConfig()->get('optimize-autoloader');
- $authoritative = $input->getOption('classmap-authoritative') || $composer->getConfig()->get('classmap-authoritative');
- $apcuPrefix = $input->getOption('apcu-autoloader-prefix');
- $apcu = $apcuPrefix !== null || $input->getOption('apcu-autoloader') || $composer->getConfig()->get('apcu-autoloader');
- $updateAllowTransitiveDependencies = Request::UPDATE_LISTED_WITH_TRANSITIVE_DEPS_NO_ROOT_REQUIRE;
- $flags = '';
- if ($input->getOption('update-with-all-dependencies') || $input->getOption('with-all-dependencies')) {
- $updateAllowTransitiveDependencies = Request::UPDATE_LISTED_WITH_TRANSITIVE_DEPS;
- $flags .= ' --with-all-dependencies';
- } elseif ($input->getOption('no-update-with-dependencies')) {
- $updateAllowTransitiveDependencies = Request::UPDATE_ONLY_LISTED;
- $flags .= ' --with-dependencies';
- }
- $io->writeError('<info>Running composer update '.implode(' ', $packages).$flags.'</info>');
- $install
- ->setVerbose($input->getOption('verbose'))
- ->setDevMode($updateDevMode)
- ->setOptimizeAutoloader($optimize)
- ->setClassMapAuthoritative($authoritative)
- ->setApcuAutoloader($apcu, $apcuPrefix)
- ->setUpdate(true)
- ->setInstall(!$input->getOption('no-install'))
- ->setUpdateAllowTransitiveDependencies($updateAllowTransitiveDependencies)
- ->setPlatformRequirementFilter($this->getPlatformRequirementFilter($input))
- ->setDryRun($dryRun)
- ->setAudit(!$input->getOption('no-audit'))
- ->setAuditFormat($this->getAuditFormat($input))
- ;
- if ($composer->getLocker()->isLocked()) {
- $install->setUpdateAllowList($packages);
- }
- $status = $install->run();
- if ($status !== 0) {
- $io->writeError("\n".'<error>Removal failed, reverting '.$file.' to its original content.</error>');
- file_put_contents($jsonFile->getPath(), $composerBackup);
- }
- if (!$dryRun) {
- foreach ($packages as $package) {
- if ($composer->getRepositoryManager()->getLocalRepository()->findPackages($package)) {
- $io->writeError('<error>Removal failed, '.$package.' is still present, it may be required by another package. See `composer why '.$package.'`.</error>');
- return 2;
- }
- }
- }
- return $status;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Command;
- use Composer\DependencyResolver\Request;
- use Composer\Package\CompletePackageInterface;
- use Composer\Util\Filesystem;
- use Composer\Util\PackageSorter;
- use Seld\Signal\SignalHandler;
- use Symfony\Component\Console\Input\InputInterface;
- use Composer\Console\Input\InputArgument;
- use Composer\Console\Input\InputOption;
- use Symfony\Component\Console\Output\OutputInterface;
- use Composer\Factory;
- use Composer\Installer;
- use Composer\Installer\InstallerEvents;
- use Composer\Json\JsonFile;
- use Composer\Json\JsonManipulator;
- use Composer\Package\Version\VersionParser;
- use Composer\Package\Loader\ArrayLoader;
- use Composer\Package\BasePackage;
- use Composer\Plugin\CommandEvent;
- use Composer\Plugin\PluginEvents;
- use Composer\Repository\CompositeRepository;
- use Composer\Repository\PlatformRepository;
- use Composer\IO\IOInterface;
- use Composer\Advisory\Auditor;
- use Composer\Util\Silencer;
- class RequireCommand extends BaseCommand
- {
- use CompletionTrait;
- use PackageDiscoveryTrait;
- private $newlyCreated;
- private $firstRequire;
- private $json;
- private $file;
- private $composerBackup;
- private $lock;
- private $lockBackup;
- private $dependencyResolutionCompleted = false;
- protected function configure()
- {
- $this
- ->setName('require')
- ->setAliases(['r'])
- ->setDescription('Adds required packages to your composer.json and installs them')
- ->setDefinition([
- 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()),
- new InputOption('dev', null, InputOption::VALUE_NONE, 'Add requirement to require-dev.'),
- new InputOption('dry-run', null, InputOption::VALUE_NONE, 'Outputs the operations but will not execute anything (implicitly enables --verbose).'),
- new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
- new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist (default behavior).'),
- 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()),
- new InputOption('fixed', null, InputOption::VALUE_NONE, 'Write fixed version to the composer.json.'),
- new InputOption('no-suggest', null, InputOption::VALUE_NONE, 'DEPRECATED: This flag does not exist anymore.'),
- new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
- new InputOption('no-update', null, InputOption::VALUE_NONE, 'Disables the automatic update of the dependencies (implies --no-install).'),
- new InputOption('no-install', null, InputOption::VALUE_NONE, 'Skip the install step after updating the composer.lock file.'),
- 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).'),
- new InputOption('audit-format', null, InputOption::VALUE_REQUIRED, 'Audit output format. Must be "table", "plain", "json", or "summary".', Auditor::FORMAT_SUMMARY, Auditor::FORMATS),
- new InputOption('update-no-dev', null, InputOption::VALUE_NONE, 'Run the dependency update with the --no-dev option.'),
- new InputOption('update-with-dependencies', 'w', InputOption::VALUE_NONE, 'Allows inherited dependencies to be updated, except those that are root requirements.'),
- new InputOption('update-with-all-dependencies', 'W', InputOption::VALUE_NONE, 'Allows all inherited dependencies to be updated, including those that are root requirements.'),
- new InputOption('with-dependencies', null, InputOption::VALUE_NONE, 'Alias for --update-with-dependencies'),
- new InputOption('with-all-dependencies', null, InputOption::VALUE_NONE, 'Alias for --update-with-all-dependencies'),
- new InputOption('ignore-platform-req', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Ignore a specific platform requirement (php & ext- packages).'),
- new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore all platform requirements (php & ext- packages).'),
- 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).'),
- 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).'),
- new InputOption('sort-packages', null, InputOption::VALUE_NONE, 'Sorts packages when adding/updating a new dependency'),
- new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump'),
- new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
- new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
- new InputOption('apcu-autoloader-prefix', null, InputOption::VALUE_REQUIRED, 'Use a custom prefix for the APCu autoloader cache. Implicitly enables --apcu-autoloader'),
- ])
- ->setHelp(
- <<<EOT
- The require command adds required packages to your composer.json and installs them.
- If you do not specify a package, composer will prompt you to search for a package, and given results, provide a list of
- matches to require.
- If you do not specify a version constraint, composer will choose a suitable one based on the available package versions.
- If you do not want to install the new dependencies immediately you can call it with --no-update
- Read more at https://getcomposer.org/doc/03-cli.md#require
- EOT
- )
- ;
- }
- protected function execute(InputInterface $input, OutputInterface $output)
- {
- $this->file = Factory::getComposerFile();
- $io = $this->getIO();
- if ($input->getOption('no-suggest')) {
- $io->writeError('<warning>You are using the deprecated option "--no-suggest". It has no effect and will break in Composer 3.</warning>');
- }
- $this->newlyCreated = !file_exists($this->file);
- if ($this->newlyCreated && !file_put_contents($this->file, "{\n}\n")) {
- $io->writeError('<error>'.$this->file.' could not be created.</error>');
- return 1;
- }
- if (!Filesystem::isReadable($this->file)) {
- $io->writeError('<error>'.$this->file.' is not readable.</error>');
- return 1;
- }
- if (filesize($this->file) === 0) {
- file_put_contents($this->file, "{\n}\n");
- }
- $this->json = new JsonFile($this->file);
- $this->lock = Factory::getLockFile($this->file);
- $this->composerBackup = file_get_contents($this->json->getPath());
- $this->lockBackup = file_exists($this->lock) ? file_get_contents($this->lock) : null;
- $signalHandler = SignalHandler::create([SignalHandler::SIGINT, SignalHandler::SIGTERM, SignalHandler::SIGHUP], function (string $signal, SignalHandler $handler) {
- $this->getIO()->writeError('Received '.$signal.', aborting', true, IOInterface::DEBUG);
- $this->revertComposerFile();
- $handler->exitWithLastSignal();
- });
- if (!is_writable($this->file) && false === Silencer::call('file_put_contents', $this->file, $this->composerBackup)) {
- $io->writeError('<error>'.$this->file.' is not writable.</error>');
- return 1;
- }
- if ($input->getOption('fixed') === true) {
- $config = $this->json->read();
- $packageType = empty($config['type']) ? 'library' : $config['type'];
- if ($packageType !== 'project') {
- $io->writeError('<error>The "--fixed" option is only allowed for packages with a "project" type to prevent possible misuses.</error>');
- if (!isset($config['type'])) {
- $io->writeError('<error>If your package is not a library, you can explicitly specify the "type" by using "composer config type project".</error>');
- }
- return 1;
- }
- }
- $composer = $this->requireComposer();
- $repos = $composer->getRepositoryManager()->getRepositories();
- $platformOverrides = $composer->getConfig()->get('platform');
- $this->repos = new CompositeRepository(array_merge(
- [$platformRepo = new PlatformRepository([], $platformOverrides)],
- $repos
- ));
- if ($composer->getPackage()->getPreferStable()) {
- $preferredStability = 'stable';
- } else {
- $preferredStability = $composer->getPackage()->getMinimumStability();
- }
- try {
- $requirements = $this->determineRequirements(
- $input,
- $output,
- $input->getArgument('packages'),
- $platformRepo,
- $preferredStability,
- !$input->getOption('no-update'),
- $input->getOption('fixed')
- );
- } catch (\Exception $e) {
- if ($this->newlyCreated) {
- $this->revertComposerFile();
- throw new \RuntimeException('No composer.json present in the current directory ('.$this->file.'), this may be the cause of the following exception.', 0, $e);
- }
- throw $e;
- }
- $requirements = $this->formatRequirements($requirements);
- if (!$input->getOption('dev') && $io->isInteractive()) {
- $devPackages = [];
- $devTags = ['dev', 'testing', 'static analysis'];
- $currentRequiresByKey = $this->getPackagesByRequireKey();
- foreach ($requirements as $name => $version) {
- if (isset($currentRequiresByKey[$name])) {
- continue;
- }
- $pkg = PackageSorter::getMostCurrentVersion($this->getRepos()->findPackages($name));
- if ($pkg instanceof CompletePackageInterface && count(array_intersect($devTags, array_map('strtolower', $pkg->getKeywords()))) > 0) {
- $devPackages[] = $name;
- }
- }
- if (count($devPackages) === count($requirements)) {
- $plural = count($requirements) > 1 ? 's' : '';
- $plural2 = count($requirements) > 1 ? 'are' : 'is';
- $io->warning('The package'.$plural.' you required '.$plural2.' recommended to be placed in require-dev but you did not use --dev.');
- if ($io->askConfirmation('<info>Do you want to re-run the command with --dev?</> [<comment>yes</>]? ')) {
- $input->setOption('dev', true);
- }
- }
- }
- $requireKey = $input->getOption('dev') ? 'require-dev' : 'require';
- $removeKey = $input->getOption('dev') ? 'require' : 'require-dev';
- $versionParser = new VersionParser();
- foreach ($requirements as $package => $constraint) {
- if (strtolower($package) === $composer->getPackage()->getName()) {
- $io->writeError(sprintf('<error>Root package \'%s\' cannot require itself in its composer.json</error>', $package));
- return 1;
- }
- if ($constraint === 'self.version') {
- continue;
- }
- $versionParser->parseConstraints($constraint);
- }
- $inconsistentRequireKeys = $this->getInconsistentRequireKeys($requirements, $requireKey);
- if (count($inconsistentRequireKeys) > 0) {
- foreach ($inconsistentRequireKeys as $package) {
- $io->warning(sprintf(
- '%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.',
- $package,
- $removeKey,
- $input->getOption('dev') ? 'with' : 'without',
- $requireKey
- ));
- }
- if ($io->isInteractive()) {
- if (!$io->askConfirmation(sprintf('<info>Do you want to move %s?</info> [<comment>no</comment>]? ', count($inconsistentRequireKeys) > 1 ? 'these requirements' : 'this requirement'), false)) {
- 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)) {
- return 0;
- }
- $input->setOption('dev', true);
- [$requireKey, $removeKey] = [$removeKey, $requireKey];
- }
- }
- }
- $sortPackages = $input->getOption('sort-packages') || $composer->getConfig()->get('sort-packages');
- $this->firstRequire = $this->newlyCreated;
- if (!$this->firstRequire) {
- $composerDefinition = $this->json->read();
- if (count($composerDefinition['require'] ?? []) === 0 && count($composerDefinition['require-dev'] ?? []) === 0) {
- $this->firstRequire = true;
- }
- }
- if (!$input->getOption('dry-run') && !$this->updateFileCleanly($this->json, $requirements, $requireKey, $removeKey, $sortPackages)) {
- $composerDefinition = $this->json->read();
- foreach ($requirements as $package => $version) {
- $composerDefinition[$requireKey][$package] = $version;
- unset($composerDefinition[$removeKey][$package]);
- if (isset($composerDefinition[$removeKey]) && count($composerDefinition[$removeKey]) === 0) {
- unset($composerDefinition[$removeKey]);
- }
- }
- $this->json->write($composerDefinition);
- }
- $io->writeError('<info>'.$this->file.' has been '.($this->newlyCreated ? 'created' : 'updated').'</info>');
- if ($input->getOption('no-update')) {
- return 0;
- }
- $composer->getPluginManager()->deactivateInstalledPlugins();
- try {
- return $this->doUpdate($input, $output, $io, $requirements, $requireKey, $removeKey);
- } catch (\Exception $e) {
- if (!$this->dependencyResolutionCompleted) {
- $this->revertComposerFile();
- }
- throw $e;
- } finally {
- $signalHandler->unregister();
- }
- }
- private function getInconsistentRequireKeys(array $newRequirements, string $requireKey): array
- {
- $requireKeys = $this->getPackagesByRequireKey();
- $inconsistentRequirements = [];
- foreach ($requireKeys as $package => $packageRequireKey) {
- if (!isset($newRequirements[$package])) {
- continue;
- }
- if ($requireKey !== $packageRequireKey) {
- $inconsistentRequirements[] = $package;
- }
- }
- return $inconsistentRequirements;
- }
- private function getPackagesByRequireKey(): array
- {
- $composerDefinition = $this->json->read();
- $require = [];
- $requireDev = [];
- if (isset($composerDefinition['require'])) {
- $require = $composerDefinition['require'];
- }
- if (isset($composerDefinition['require-dev'])) {
- $requireDev = $composerDefinition['require-dev'];
- }
- return array_merge(
- array_fill_keys(array_keys($require), 'require'),
- array_fill_keys(array_keys($requireDev), 'require-dev')
- );
- }
- private function doUpdate(InputInterface $input, OutputInterface $output, IOInterface $io, array $requirements, string $requireKey, string $removeKey): int
- {
- $this->resetComposer();
- $composer = $this->requireComposer();
- $this->dependencyResolutionCompleted = false;
- $composer->getEventDispatcher()->addListener(InstallerEvents::PRE_OPERATIONS_EXEC, function (): void {
- $this->dependencyResolutionCompleted = true;
- }, 10000);
- if ($input->getOption('dry-run')) {
- $rootPackage = $composer->getPackage();
- $links = [
- 'require' => $rootPackage->getRequires(),
- 'require-dev' => $rootPackage->getDevRequires(),
- ];
- $loader = new ArrayLoader();
- $newLinks = $loader->parseLinks($rootPackage->getName(), $rootPackage->getPrettyVersion(), BasePackage::$supportedLinkTypes[$requireKey]['method'], $requirements);
- $links[$requireKey] = array_merge($links[$requireKey], $newLinks);
- foreach ($requirements as $package => $constraint) {
- unset($links[$removeKey][$package]);
- }
- $rootPackage->setRequires($links['require']);
- $rootPackage->setDevRequires($links['require-dev']);
- }
- $updateDevMode = !$input->getOption('update-no-dev');
- $optimize = $input->getOption('optimize-autoloader') || $composer->getConfig()->get('optimize-autoloader');
- $authoritative = $input->getOption('classmap-authoritative') || $composer->getConfig()->get('classmap-authoritative');
- $apcuPrefix = $input->getOption('apcu-autoloader-prefix');
- $apcu = $apcuPrefix !== null || $input->getOption('apcu-autoloader') || $composer->getConfig()->get('apcu-autoloader');
- $updateAllowTransitiveDependencies = Request::UPDATE_ONLY_LISTED;
- $flags = '';
- if ($input->getOption('update-with-all-dependencies') || $input->getOption('with-all-dependencies')) {
- $updateAllowTransitiveDependencies = Request::UPDATE_LISTED_WITH_TRANSITIVE_DEPS;
- $flags .= ' --with-all-dependencies';
- } elseif ($input->getOption('update-with-dependencies') || $input->getOption('with-dependencies')) {
- $updateAllowTransitiveDependencies = Request::UPDATE_LISTED_WITH_TRANSITIVE_DEPS_NO_ROOT_REQUIRE;
- $flags .= ' --with-dependencies';
- }
- $io->writeError('<info>Running composer update '.implode(' ', array_keys($requirements)).$flags.'</info>');
- $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'require', $input, $output);
- $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
- $composer->getInstallationManager()->setOutputProgress(!$input->getOption('no-progress'));
- $install = Installer::create($io, $composer);
- [$preferSource, $preferDist] = $this->getPreferredInstallOptions($composer->getConfig(), $input);
- $install
- ->setDryRun($input->getOption('dry-run'))
- ->setVerbose($input->getOption('verbose'))
- ->setPreferSource($preferSource)
- ->setPreferDist($preferDist)
- ->setDevMode($updateDevMode)
- ->setOptimizeAutoloader($optimize)
- ->setClassMapAuthoritative($authoritative)
- ->setApcuAutoloader($apcu, $apcuPrefix)
- ->setUpdate(true)
- ->setInstall(!$input->getOption('no-install'))
- ->setUpdateAllowTransitiveDependencies($updateAllowTransitiveDependencies)
- ->setPlatformRequirementFilter($this->getPlatformRequirementFilter($input))
- ->setPreferStable($input->getOption('prefer-stable'))
- ->setPreferLowest($input->getOption('prefer-lowest'))
- ->setAudit(!$input->getOption('no-audit'))
- ->setAuditFormat($this->getAuditFormat($input))
- ;
- if (!$this->firstRequire && $composer->getLocker()->isLocked()) {
- $install->setUpdateAllowList(array_keys($requirements));
- }
- $status = $install->run();
- if ($status !== 0) {
- if ($status === Installer::ERROR_DEPENDENCY_RESOLUTION_FAILED) {
- foreach ($this->normalizeRequirements($input->getArgument('packages')) as $req) {
- if (!isset($req['version'])) {
- $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.');
- break;
- }
- }
- }
- $this->revertComposerFile();
- }
- return $status;
- }
- private function updateFileCleanly(JsonFile $json, array $new, string $requireKey, string $removeKey, bool $sortPackages): bool
- {
- $contents = file_get_contents($json->getPath());
- $manipulator = new JsonManipulator($contents);
- foreach ($new as $package => $constraint) {
- if (!$manipulator->addLink($requireKey, $package, $constraint, $sortPackages)) {
- return false;
- }
- if (!$manipulator->removeSubNode($removeKey, $package)) {
- return false;
- }
- }
- $manipulator->removeMainKeyIfEmpty($removeKey);
- file_put_contents($json->getPath(), $manipulator->getContents());
- return true;
- }
- protected function interact(InputInterface $input, OutputInterface $output): void
- {
- }
- private function revertComposerFile(): void
- {
- $io = $this->getIO();
- if ($this->newlyCreated) {
- $io->writeError("\n".'<error>Installation failed, deleting '.$this->file.'.</error>');
- unlink($this->json->getPath());
- if (file_exists($this->lock)) {
- unlink($this->lock);
- }
- } else {
- $msg = ' to its ';
- if ($this->lockBackup) {
- $msg = ' and '.$this->lock.' to their ';
- }
- $io->writeError("\n".'<error>Installation failed, reverting '.$this->file.$msg.'original content.</error>');
- file_put_contents($this->json->getPath(), $this->composerBackup);
- if ($this->lockBackup) {
- file_put_contents($this->lock, $this->lockBackup);
- }
- }
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Command;
- use Composer\Script\Event as ScriptEvent;
- use Composer\Script\ScriptEvents;
- use Composer\Util\ProcessExecutor;
- use Composer\Util\Platform;
- use Symfony\Component\Console\Input\InputInterface;
- use Composer\Console\Input\InputOption;
- use Composer\Console\Input\InputArgument;
- use Symfony\Component\Console\Output\OutputInterface;
- class RunScriptCommand extends BaseCommand
- {
- protected $scriptEvents = [
- ScriptEvents::PRE_INSTALL_CMD,
- ScriptEvents::POST_INSTALL_CMD,
- ScriptEvents::PRE_UPDATE_CMD,
- ScriptEvents::POST_UPDATE_CMD,
- ScriptEvents::PRE_STATUS_CMD,
- ScriptEvents::POST_STATUS_CMD,
- ScriptEvents::POST_ROOT_PACKAGE_INSTALL,
- ScriptEvents::POST_CREATE_PROJECT_CMD,
- ScriptEvents::PRE_ARCHIVE_CMD,
- ScriptEvents::POST_ARCHIVE_CMD,
- ScriptEvents::PRE_AUTOLOAD_DUMP,
- ScriptEvents::POST_AUTOLOAD_DUMP,
- ];
- protected function configure(): void
- {
- $this
- ->setName('run-script')
- ->setAliases(['run'])
- ->setDescription('Runs the scripts defined in composer.json')
- ->setDefinition([
- new InputArgument('script', InputArgument::OPTIONAL, 'Script name to run.', null, function () {
- return array_keys($this->requireComposer()->getPackage()->getScripts());
- }),
- new InputArgument('args', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, ''),
- new InputOption('timeout', null, InputOption::VALUE_REQUIRED, 'Sets script timeout in seconds, or 0 for never.'),
- new InputOption('dev', null, InputOption::VALUE_NONE, 'Sets the dev mode.'),
- new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables the dev mode.'),
- new InputOption('list', 'l', InputOption::VALUE_NONE, 'List scripts.'),
- ])
- ->setHelp(
- <<<EOT
- The <info>run-script</info> command runs scripts defined in composer.json:
- <info>php composer.phar run-script post-update-cmd</info>
- Read more at https://getcomposer.org/doc/03-cli.md#run-script
- EOT
- )
- ;
- }
- protected function execute(InputInterface $input, OutputInterface $output): int
- {
- if ($input->getOption('list')) {
- return $this->listScripts($output);
- }
- $script = $input->getArgument('script');
- if ($script === null) {
- throw new \RuntimeException('Missing required argument "script"');
- }
- if (!in_array($script, $this->scriptEvents)) {
- if (defined('Composer\Script\ScriptEvents::'.str_replace('-', '_', strtoupper($script)))) {
- throw new \InvalidArgumentException(sprintf('Script "%s" cannot be run with this command', $script));
- }
- }
- $composer = $this->requireComposer();
- $devMode = $input->getOption('dev') || !$input->getOption('no-dev');
- $event = new ScriptEvent($script, $composer, $this->getIO(), $devMode);
- $hasListeners = $composer->getEventDispatcher()->hasEventListeners($event);
- if (!$hasListeners) {
- throw new \InvalidArgumentException(sprintf('Script "%s" is not defined in this package', $script));
- }
- $args = $input->getArgument('args');
- if (null !== $timeout = $input->getOption('timeout')) {
- if (!ctype_digit($timeout)) {
- throw new \RuntimeException('Timeout value must be numeric and positive if defined, or 0 for forever');
- }
- ProcessExecutor::setTimeout((int) $timeout);
- }
- Platform::putEnv('COMPOSER_DEV_MODE', $devMode ? '1' : '0');
- return $composer->getEventDispatcher()->dispatchScript($script, $devMode, $args);
- }
- protected function listScripts(OutputInterface $output): int
- {
- $scripts = $this->requireComposer()->getPackage()->getScripts();
- if (!count($scripts)) {
- return 0;
- }
- $io = $this->getIO();
- $io->writeError('<info>scripts:</info>');
- $table = [];
- foreach ($scripts as $name => $script) {
- $description = '';
- try {
- $cmd = $this->getApplication()->find($name);
- if ($cmd instanceof ScriptAliasCommand) {
- $description = $cmd->getDescription();
- }
- } catch (\Symfony\Component\Console\Exception\CommandNotFoundException $e) {
- }
- $table[] = [' '.$name, $description];
- }
- $this->renderTable($table, $output);
- return 0;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Command;
- use Symfony\Component\Console\Input\InputInterface;
- use Composer\Console\Input\InputOption;
- use Composer\Console\Input\InputArgument;
- use Symfony\Component\Console\Output\OutputInterface;
- class ScriptAliasCommand extends BaseCommand
- {
- private $script;
- private $description;
- public function __construct(string $script, ?string $description)
- {
- $this->script = $script;
- $this->description = $description ?? 'Runs the '.$script.' script as defined in composer.json';
- parent::__construct();
- }
- protected function configure(): void
- {
- $this
- ->setName($this->script)
- ->setDescription($this->description)
- ->setDefinition([
- new InputOption('dev', null, InputOption::VALUE_NONE, 'Sets the dev mode.'),
- new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables the dev mode.'),
- new InputArgument('args', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, ''),
- ])
- ->setHelp(
- <<<EOT
- The <info>run-script</info> command runs scripts defined in composer.json:
- <info>php composer.phar run-script post-update-cmd</info>
- Read more at https://getcomposer.org/doc/03-cli.md#run-script
- EOT
- )
- ;
- }
- protected function execute(InputInterface $input, OutputInterface $output): int
- {
- $composer = $this->requireComposer();
- $args = $input->getArguments();
- return $composer->getEventDispatcher()->dispatchScript($this->script, $input->getOption('dev') || !$input->getOption('no-dev'), $args['args']);
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Command;
- use Composer\Factory;
- use Composer\Json\JsonFile;
- use Symfony\Component\Console\Formatter\OutputFormatter;
- use Symfony\Component\Console\Input\InputInterface;
- use Composer\Console\Input\InputArgument;
- use Composer\Console\Input\InputOption;
- use Symfony\Component\Console\Output\OutputInterface;
- use Composer\Repository\CompositeRepository;
- use Composer\Repository\PlatformRepository;
- use Composer\Repository\RepositoryInterface;
- use Composer\Plugin\CommandEvent;
- use Composer\Plugin\PluginEvents;
- class SearchCommand extends BaseCommand
- {
- protected function configure(): void
- {
- $this
- ->setName('search')
- ->setDescription('Searches for packages')
- ->setDefinition([
- new InputOption('only-name', 'N', InputOption::VALUE_NONE, 'Search only in package names'),
- new InputOption('only-vendor', 'O', InputOption::VALUE_NONE, 'Search only for vendor / organization names, returns only "vendor" as result'),
- new InputOption('type', 't', InputOption::VALUE_REQUIRED, 'Search for a specific package type'),
- new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the output: text or json', 'text', ['json', 'text']),
- new InputArgument('tokens', InputArgument::IS_ARRAY | InputArgument::REQUIRED, 'tokens to search for'),
- ])
- ->setHelp(
- <<<EOT
- The search command searches for packages by its name
- <info>php composer.phar search symfony composer</info>
- Read more at https://getcomposer.org/doc/03-cli.md#search
- EOT
- )
- ;
- }
- protected function execute(InputInterface $input, OutputInterface $output): int
- {
- $platformRepo = new PlatformRepository;
- $io = $this->getIO();
- $format = $input->getOption('format');
- if (!in_array($format, ['text', 'json'])) {
- $io->writeError(sprintf('Unsupported format "%s". See help for supported formats.', $format));
- return 1;
- }
- if (!($composer = $this->tryComposer())) {
- $composer = Factory::create($this->getIO(), [], $input->hasParameterOption('--no-plugins'));
- }
- $localRepo = $composer->getRepositoryManager()->getLocalRepository();
- $installedRepo = new CompositeRepository([$localRepo, $platformRepo]);
- $repos = new CompositeRepository(array_merge([$installedRepo], $composer->getRepositoryManager()->getRepositories()));
- $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'search', $input, $output);
- $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
- $mode = RepositoryInterface::SEARCH_FULLTEXT;
- if ($input->getOption('only-name') === true) {
- if ($input->getOption('only-vendor') === true) {
- throw new \InvalidArgumentException('--only-name and --only-vendor cannot be used together');
- }
- $mode = RepositoryInterface::SEARCH_NAME;
- } elseif ($input->getOption('only-vendor') === true) {
- $mode = RepositoryInterface::SEARCH_VENDOR;
- }
- $type = $input->getOption('type');
- $query = implode(' ', $input->getArgument('tokens'));
- if ($mode !== RepositoryInterface::SEARCH_FULLTEXT) {
- $query = preg_quote($query);
- }
- $results = $repos->search($query, $mode, $type);
- if ($results && $format === 'text') {
- $width = $this->getTerminalWidth();
- $nameLength = 0;
- foreach ($results as $result) {
- $nameLength = max(strlen($result['name']), $nameLength);
- }
- $nameLength += 1;
- foreach ($results as $result) {
- $description = $result['description'] ?? '';
- $warning = !empty($result['abandoned']) ? '<warning>! Abandoned !</warning> ' : '';
- $remaining = $width - $nameLength - strlen($warning) - 2;
- if (strlen($description) > $remaining) {
- $description = substr($description, 0, $remaining - 3) . '...';
- }
- $link = $result['url'] ?? null;
- if ($link !== null) {
- $io->write('<href='.OutputFormatter::escape($link).'>'.$result['name'].'</>'. str_repeat(' ', $nameLength - strlen($result['name'])) . $warning . $description);
- } else {
- $io->write(str_pad($result['name'], $nameLength, ' ') . $warning . $description);
- }
- }
- } elseif ($format === 'json') {
- $io->write(JsonFile::encode($results));
- }
- return 0;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Command;
- use Composer\Composer;
- use Composer\Factory;
- use Composer\Config;
- use Composer\Pcre\Preg;
- use Composer\Util\Filesystem;
- use Composer\Util\Platform;
- use Composer\SelfUpdate\Keys;
- use Composer\SelfUpdate\Versions;
- use Composer\IO\IOInterface;
- use Composer\Downloader\FilesystemException;
- use Composer\Downloader\TransportException;
- use Symfony\Component\Console\Input\InputInterface;
- use Composer\Console\Input\InputOption;
- use Composer\Console\Input\InputArgument;
- use Symfony\Component\Console\Output\OutputInterface;
- use Symfony\Component\Finder\Finder;
- class SelfUpdateCommand extends BaseCommand
- {
- private const HOMEPAGE = 'getcomposer.org';
- private const OLD_INSTALL_EXT = '-old.phar';
- protected function configure(): void
- {
- $this
- ->setName('self-update')
- ->setAliases(['selfupdate'])
- ->setDescription('Updates composer.phar to the latest version')
- ->setDefinition([
- new InputOption('rollback', 'r', InputOption::VALUE_NONE, 'Revert to an older installation of composer'),
- 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'),
- new InputArgument('version', InputArgument::OPTIONAL, 'The version to update to'),
- new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
- new InputOption('update-keys', null, InputOption::VALUE_NONE, 'Prompt user for a key update'),
- new InputOption('stable', null, InputOption::VALUE_NONE, 'Force an update to the stable channel'),
- new InputOption('preview', null, InputOption::VALUE_NONE, 'Force an update to the preview channel'),
- new InputOption('snapshot', null, InputOption::VALUE_NONE, 'Force an update to the snapshot channel'),
- new InputOption('1', null, InputOption::VALUE_NONE, 'Force an update to the stable channel, but only use 1.x versions'),
- new InputOption('2', null, InputOption::VALUE_NONE, 'Force an update to the stable channel, but only use 2.x versions'),
- new InputOption('2.2', null, InputOption::VALUE_NONE, 'Force an update to the stable channel, but only use 2.2.x LTS versions'),
- new InputOption('set-channel-only', null, InputOption::VALUE_NONE, 'Only store the channel as the default one and then exit'),
- ])
- ->setHelp(
- <<<EOT
- The <info>self-update</info> command checks getcomposer.org for newer
- versions of composer and if found, installs the latest.
- <info>php composer.phar self-update</info>
- Read more at https://getcomposer.org/doc/03-cli.md#self-update-selfupdate-
- EOT
- )
- ;
- }
- protected function execute(InputInterface $input, OutputInterface $output): int
- {
- if ($_SERVER['argv'][0] === 'Standard input code') {
- return 1;
- }
- class_exists('Composer\Util\Platform');
- class_exists('Composer\Downloader\FilesystemException');
- $config = Factory::createConfig();
- if ($config->get('disable-tls') === true) {
- $baseUrl = 'http://' . self::HOMEPAGE;
- } else {
- $baseUrl = 'https://' . self::HOMEPAGE;
- }
- $io = $this->getIO();
- $httpDownloader = Factory::createHttpDownloader($io, $config);
- $versionsUtil = new Versions($config, $httpDownloader);
- $requestedChannel = null;
- foreach (Versions::CHANNELS as $channel) {
- if ($input->getOption($channel)) {
- $requestedChannel = $channel;
- $versionsUtil->setChannel($channel, $io);
- break;
- }
- }
- if ($input->getOption('set-channel-only')) {
- return 0;
- }
- $cacheDir = $config->get('cache-dir');
- $rollbackDir = $config->get('data-dir');
- $home = $config->get('home');
- $localFilename = realpath($_SERVER['argv'][0]);
- if (false === $localFilename) {
- $localFilename = $_SERVER['argv'][0];
- }
- if ($input->getOption('update-keys')) {
- $this->fetchKeys($io, $config);
- return 0;
- }
- if (!file_exists($localFilename)) {
- throw new FilesystemException('Composer update failed: the "'.$localFilename.'" is not accessible');
- }
- $tmpDir = is_writable(dirname($localFilename)) ? dirname($localFilename) : $cacheDir;
- if (!is_writable($tmpDir)) {
- throw new FilesystemException('Composer update failed: the "'.$tmpDir.'" directory used to download the temp file could not be written');
- }
- if (function_exists('posix_getpwuid') && function_exists('posix_geteuid')) {
- $composerUser = posix_getpwuid(posix_geteuid());
- $homeDirOwnerId = fileowner($home);
- if (is_array($composerUser) && $homeDirOwnerId !== false) {
- $homeOwner = posix_getpwuid($homeDirOwnerId);
- if (is_array($homeOwner) && isset($composerUser['name'], $homeOwner['name']) && $composerUser['name'] !== $homeOwner['name']) {
- $io->writeError('<warning>You are running Composer as "'.$composerUser['name'].'", while "'.$home.'" is owned by "'.$homeOwner['name'].'"</warning>');
- }
- }
- }
- if ($input->getOption('rollback')) {
- return $this->rollback($output, $rollbackDir, $localFilename);
- }
- $latest = $versionsUtil->getLatest();
- $latestStable = $versionsUtil->getLatest('stable');
- try {
- $latestPreview = $versionsUtil->getLatest('preview');
- } catch (\UnexpectedValueException $e) {
- $latestPreview = $latestStable;
- }
- $latestVersion = $latest['version'];
- $updateVersion = $input->getArgument('version') ?? $latestVersion;
- $currentMajorVersion = Preg::replace('{^(\d+).*}', '$1', Composer::getVersion());
- $updateMajorVersion = Preg::replace('{^(\d+).*}', '$1', $updateVersion);
- $previewMajorVersion = Preg::replace('{^(\d+).*}', '$1', $latestPreview['version']);
- if ($versionsUtil->getChannel() === 'stable' && null === $input->getArgument('version')) {
- if ($currentMajorVersion < $updateMajorVersion) {
- $skippedVersion = $updateVersion;
- $versionsUtil->setChannel($currentMajorVersion);
- $latest = $versionsUtil->getLatest();
- $latestStable = $versionsUtil->getLatest('stable');
- $latestVersion = $latest['version'];
- $updateVersion = $latestVersion;
- $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>');
- } elseif ($currentMajorVersion < $previewMajorVersion) {
- $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>');
- }
- }
- $effectiveChannel = $requestedChannel === null ? $versionsUtil->getChannel() : $requestedChannel;
- if (is_numeric($effectiveChannel) && strpos($latestStable['version'], $effectiveChannel) !== 0) {
- $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>');
- }
- if (isset($latest['eol'])) {
- $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>');
- }
- if (Preg::isMatch('{^[0-9a-f]{40}$}', $updateVersion) && $updateVersion !== $latestVersion) {
- $io->writeError('<error>You can not update to a specific SHA-1 as those phars are not available for download</error>');
- return 1;
- }
- $channelString = $versionsUtil->getChannel();
- if (is_numeric($channelString)) {
- $channelString .= '.x';
- }
- if (Composer::VERSION === $updateVersion) {
- $io->writeError(
- sprintf(
- '<info>You are already using the latest available Composer version %s (%s channel).</info>',
- $updateVersion,
- $channelString
- )
- );
- if ($input->getOption('clean-backups')) {
- $this->cleanBackups($rollbackDir, $this->getLastBackupVersion($rollbackDir));
- }
- return 0;
- }
- $tempFilename = $tmpDir . '/' . basename($localFilename, '.phar').'-temp'.random_int(0, 10000000).'.phar';
- $backupFile = sprintf(
- '%s/%s-%s%s',
- $rollbackDir,
- strtr(Composer::RELEASE_DATE, ' :', '_-'),
- Preg::replace('{^([0-9a-f]{7})[0-9a-f]{33}$}', '$1', Composer::VERSION),
- self::OLD_INSTALL_EXT
- );
- $updatingToTag = !Preg::isMatch('{^[0-9a-f]{40}$}', $updateVersion);
- $io->write(sprintf("Upgrading to version <info>%s</info> (%s channel).", $updateVersion, $channelString));
- $remoteFilename = $baseUrl . ($updatingToTag ? "/download/{$updateVersion}/composer.phar" : '/composer.phar');
- try {
- $signature = $httpDownloader->get($remoteFilename.'.sig')->getBody();
- } catch (TransportException $e) {
- if ($e->getStatusCode() === 404) {
- throw new \InvalidArgumentException('Version "'.$updateVersion.'" could not be found.', 0, $e);
- }
- throw $e;
- }
- $io->writeError(' ', false);
- $httpDownloader->copy($remoteFilename, $tempFilename);
- $io->writeError('');
- if (!file_exists($tempFilename) || null === $signature || '' === $signature) {
- $io->writeError('<error>The download of the new composer version failed for an unexpected reason</error>');
- return 1;
- }
- if (!extension_loaded('openssl') && $config->get('disable-tls')) {
- $io->writeError('<warning>Skipping phar signature verification as you have disabled OpenSSL via config.disable-tls</warning>');
- } else {
- if (!extension_loaded('openssl')) {
- throw new \RuntimeException('The openssl extension is required for phar signatures to be verified but it is not available. '
- . '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.');
- }
- $sigFile = 'file://'.$home.'/' . ($updatingToTag ? 'keys.tags.pub' : 'keys.dev.pub');
- if (!file_exists($sigFile)) {
- file_put_contents(
- $home.'/keys.dev.pub',
- <<<DEVPUBKEY
- -----BEGIN PUBLIC KEY-----
- MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAnBDHjZS6e0ZMoK3xTD7f
- FNCzlXjX/Aie2dit8QXA03pSrOTbaMnxON3hUL47Lz3g1SC6YJEMVHr0zYq4elWi
- i3ecFEgzLcj+pZM5X6qWu2Ozz4vWx3JYo1/a/HYdOuW9e3lwS8VtS0AVJA+U8X0A
- hZnBmGpltHhO8hPKHgkJtkTUxCheTcbqn4wGHl8Z2SediDcPTLwqezWKUfrYzu1f
- o/j3WFwFs6GtK4wdYtiXr+yspBZHO3y1udf8eFFGcb2V3EaLOrtfur6XQVizjOuk
- 8lw5zzse1Qp/klHqbDRsjSzJ6iL6F4aynBc6Euqt/8ccNAIz0rLjLhOraeyj4eNn
- 8iokwMKiXpcrQLTKH+RH1JCuOVxQ436bJwbSsp1VwiqftPQieN+tzqy+EiHJJmGf
- TBAbWcncicCk9q2md+AmhNbvHO4PWbbz9TzC7HJb460jyWeuMEvw3gNIpEo2jYa9
- pMV6cVqnSa+wOc0D7pC9a6bne0bvLcm3S+w6I5iDB3lZsb3A9UtRiSP7aGSo7D72
- 8tC8+cIgZcI7k9vjvOqH+d7sdOU2yPCnRY6wFh62/g8bDnUpr56nZN1G89GwM4d4
- r/TU7BQQIzsZgAiqOGXvVklIgAMiV0iucgf3rNBLjjeNEwNSTTG9F0CtQ+7JLwaE
- wSEuAuRm+pRqi8BRnQ/GKUcCAwEAAQ==
- -----END PUBLIC KEY-----
- DEVPUBKEY
- );
- file_put_contents(
- $home.'/keys.tags.pub',
- <<<TAGSPUBKEY
- -----BEGIN PUBLIC KEY-----
- MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA0Vi/2K6apCVj76nCnCl2
- MQUPdK+A9eqkYBacXo2wQBYmyVlXm2/n/ZsX6pCLYPQTHyr5jXbkQzBw8SKqPdlh
- vA7NpbMeNCz7wP/AobvUXM8xQuXKbMDTY2uZ4O7sM+PfGbptKPBGLe8Z8d2sUnTO
- bXtX6Lrj13wkRto7st/w/Yp33RHe9SlqkiiS4MsH1jBkcIkEHsRaveZzedUaxY0M
- mba0uPhGUInpPzEHwrYqBBEtWvP97t2vtfx8I5qv28kh0Y6t+jnjL1Urid2iuQZf
- noCMFIOu4vksK5HxJxxrN0GOmGmwVQjOOtxkwikNiotZGPR4KsVj8NnBrLX7oGuM
- nQvGciiu+KoC2r3HDBrpDeBVdOWxDzT5R4iI0KoLzFh2pKqwbY+obNPS2bj+2dgJ
- rV3V5Jjry42QOCBN3c88wU1PKftOLj2ECpewY6vnE478IipiEu7EAdK8Zwj2LmTr
- RKQUSa9k7ggBkYZWAeO/2Ag0ey3g2bg7eqk+sHEq5ynIXd5lhv6tC5PBdHlWipDK
- tl2IxiEnejnOmAzGVivE1YGduYBjN+mjxDVy8KGBrjnz1JPgAvgdwJ2dYw4Rsc/e
- TzCFWGk/HM6a4f0IzBWbJ5ot0PIi4amk07IotBXDWwqDiQTwyuGCym5EqWQ2BD95
- RGv89BPD+2DLnJysngsvVaUCAwEAAQ==
- -----END PUBLIC KEY-----
- TAGSPUBKEY
- );
- }
- $pubkeyid = openssl_pkey_get_public($sigFile);
- if (false === $pubkeyid) {
- throw new \RuntimeException('Failed loading the public key from '.$sigFile);
- }
- $algo = defined('OPENSSL_ALGO_SHA384') ? OPENSSL_ALGO_SHA384 : 'SHA384';
- if (!in_array('sha384', array_map('strtolower', openssl_get_md_methods()), true)) {
- throw new \RuntimeException('SHA384 is not supported by your openssl extension, could not verify the phar file integrity');
- }
- $signatureData = json_decode($signature, true);
- $signatureSha384 = base64_decode($signatureData['sha384'], true);
- if (false === $signatureSha384) {
- throw new \RuntimeException('Failed loading the phar signature from '.$remoteFilename.'.sig, got '.$signature);
- }
- $verified = 1 === openssl_verify((string) file_get_contents($tempFilename), $signatureSha384, $pubkeyid, $algo);
- if (PHP_VERSION_ID < 80000) {
- openssl_free_key($pubkeyid);
- }
- if (!$verified) {
- 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');
- }
- }
- if ($input->getOption('clean-backups')) {
- $this->cleanBackups($rollbackDir);
- }
- if (!$this->setLocalPhar($localFilename, $tempFilename, $backupFile)) {
- @unlink($tempFilename);
- return 1;
- }
- if (file_exists($backupFile)) {
- $io->writeError(sprintf(
- 'Use <info>composer self-update --rollback</info> to return to version <comment>%s</comment>',
- Composer::VERSION
- ));
- } else {
- $io->writeError('<warning>A backup of the current version could not be written to '.$backupFile.', no rollback possible</warning>');
- }
- return 0;
- }
- protected function fetchKeys(IOInterface $io, Config $config): void
- {
- if (!$io->isInteractive()) {
- throw new \RuntimeException('Public keys can not be fetched in non-interactive mode, please run Composer interactively');
- }
- $io->write('Open <info>https://composer.github.io/pubkeys.html</info> to find the latest keys');
- $validator = static function ($value): string {
- if (!Preg::isMatch('{^-----BEGIN PUBLIC KEY-----$}', trim($value))) {
- throw new \UnexpectedValueException('Invalid input');
- }
- return trim($value)."\n";
- };
- $devKey = '';
- while (!Preg::isMatch('{(-----BEGIN PUBLIC KEY-----.+?-----END PUBLIC KEY-----)}s', $devKey, $match)) {
- $devKey = $io->askAndValidate('Enter Dev / Snapshot Public Key (including lines with -----): ', $validator);
- while ($line = $io->ask('')) {
- $devKey .= trim($line)."\n";
- if (trim($line) === '-----END PUBLIC KEY-----') {
- break;
- }
- }
- }
- file_put_contents($keyPath = $config->get('home').'/keys.dev.pub', $match[0]);
- $io->write('Stored key with fingerprint: ' . Keys::fingerprint($keyPath));
- $tagsKey = '';
- while (!Preg::isMatch('{(-----BEGIN PUBLIC KEY-----.+?-----END PUBLIC KEY-----)}s', $tagsKey, $match)) {
- $tagsKey = $io->askAndValidate('Enter Tags Public Key (including lines with -----): ', $validator);
- while ($line = $io->ask('')) {
- $tagsKey .= trim($line)."\n";
- if (trim($line) === '-----END PUBLIC KEY-----') {
- break;
- }
- }
- }
- file_put_contents($keyPath = $config->get('home').'/keys.tags.pub', $match[0]);
- $io->write('Stored key with fingerprint: ' . Keys::fingerprint($keyPath));
- $io->write('Public keys stored in '.$config->get('home'));
- }
- protected function rollback(OutputInterface $output, string $rollbackDir, string $localFilename): int
- {
- $rollbackVersion = $this->getLastBackupVersion($rollbackDir);
- if (null === $rollbackVersion) {
- throw new \UnexpectedValueException('Composer rollback failed: no installation to roll back to in "'.$rollbackDir.'"');
- }
- $oldFile = $rollbackDir . '/' . $rollbackVersion . self::OLD_INSTALL_EXT;
- if (!is_file($oldFile)) {
- throw new FilesystemException('Composer rollback failed: "'.$oldFile.'" could not be found');
- }
- if (!Filesystem::isReadable($oldFile)) {
- throw new FilesystemException('Composer rollback failed: "'.$oldFile.'" could not be read');
- }
- $io = $this->getIO();
- $io->writeError(sprintf("Rolling back to version <info>%s</info>.", $rollbackVersion));
- if (!$this->setLocalPhar($localFilename, $oldFile)) {
- return 1;
- }
- return 0;
- }
- protected function setLocalPhar(string $localFilename, string $newFilename, ?string $backupTarget = null): bool
- {
- $io = $this->getIO();
- $perms = @fileperms($localFilename);
- if ($perms !== false) {
- @chmod($newFilename, $perms);
- }
- if (!$this->validatePhar($newFilename, $error)) {
- $io->writeError('<error>The '.($backupTarget !== null ? 'update' : 'backup').' file is corrupted ('.$error.')</error>');
- if ($backupTarget !== null) {
- $io->writeError('<error>Please re-run the self-update command to try again.</error>');
- }
- return false;
- }
- if ($backupTarget !== null) {
- @copy($localFilename, $backupTarget);
- }
- try {
- if (Platform::isWindows()) {
- copy($newFilename, $localFilename);
- @unlink($newFilename);
- } else {
- rename($newFilename, $localFilename);
- }
- return true;
- } catch (\Exception $e) {
- if (!is_writable(dirname($localFilename))
- && $io->isInteractive()
- && $this->isWindowsNonAdminUser()) {
- return $this->tryAsWindowsAdmin($localFilename, $newFilename);
- }
- @unlink($newFilename);
- $action = 'Composer '.($backupTarget !== null ? 'update' : 'rollback');
- throw new FilesystemException($action.' failed: "'.$localFilename.'" could not be written.'.PHP_EOL.$e->getMessage());
- }
- }
- protected function cleanBackups(string $rollbackDir, ?string $except = null): void
- {
- $finder = $this->getOldInstallationFinder($rollbackDir);
- $io = $this->getIO();
- $fs = new Filesystem;
- foreach ($finder as $file) {
- if ($file->getBasename(self::OLD_INSTALL_EXT) === $except) {
- continue;
- }
- $file = (string) $file;
- $io->writeError('<info>Removing: '.$file.'</info>');
- $fs->remove($file);
- }
- }
- protected function getLastBackupVersion(string $rollbackDir): ?string
- {
- $finder = $this->getOldInstallationFinder($rollbackDir);
- $finder->sortByName();
- $files = iterator_to_array($finder);
- if (count($files) > 0) {
- return end($files)->getBasename(self::OLD_INSTALL_EXT);
- }
- return null;
- }
- protected function getOldInstallationFinder(string $rollbackDir): Finder
- {
- return Finder::create()
- ->depth(0)
- ->files()
- ->name('*' . self::OLD_INSTALL_EXT)
- ->in($rollbackDir);
- }
- protected function validatePhar(string $pharFile, ?string &$error): bool
- {
- if ((bool) ini_get('phar.readonly')) {
- return true;
- }
- try {
- $phar = new \Phar($pharFile);
- unset($phar);
- $result = true;
- } catch (\Exception $e) {
- if (!$e instanceof \UnexpectedValueException && !$e instanceof \PharException) {
- throw $e;
- }
- $error = $e->getMessage();
- $result = false;
- }
- return $result;
- }
- protected function isWindowsNonAdminUser(): bool
- {
- if (!Platform::isWindows()) {
- return false;
- }
- exec('fltmc.exe filters', $output, $exitCode);
- return $exitCode !== 0;
- }
- protected function tryAsWindowsAdmin(string $localFilename, string $newFilename): bool
- {
- $io = $this->getIO();
- $io->writeError('<error>Unable to write "'.$localFilename.'". Access is denied.</error>');
- $helpMessage = 'Please run the self-update command as an Administrator.';
- $question = 'Complete this operation with Administrator privileges [<comment>Y,n</comment>]? ';
- if (!$io->askConfirmation($question, true)) {
- $io->writeError('<warning>Operation cancelled. '.$helpMessage.'</warning>');
- return false;
- }
- $tmpFile = tempnam(sys_get_temp_dir(), '');
- if (false === $tmpFile) {
- $io->writeError('<error>Operation failed.'.$helpMessage.'</error>');
- return false;
- }
- $script = $tmpFile.'.vbs';
- rename($tmpFile, $script);
- $checksum = hash_file('sha256', $newFilename);
- $source = str_replace('/', '\\', $newFilename);
- $destination = str_replace('/', '\\', $localFilename);
- $vbs = <<<EOT
- Set UAC = CreateObject("Shell.Application")
- UAC.ShellExecute "cmd.exe", "/c copy /b /y ""$source"" ""$destination""", "", "runas", 0
- Wscript.Sleep(300)
- EOT;
- file_put_contents($script, $vbs);
- exec('"'.$script.'"');
- @unlink($script);
- if ($result = Filesystem::isReadable($localFilename) && (hash_file('sha256', $localFilename) === $checksum)) {
- $io->writeError('<info>Operation succeeded.</info>');
- @unlink($newFilename);
- } else {
- $io->writeError('<error>Operation failed.'.$helpMessage.'</error>');
- }
- return $result;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Command;
- use Composer\Composer;
- use Composer\DependencyResolver\DefaultPolicy;
- use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterInterface;
- use Composer\IO\IOInterface;
- use Composer\Json\JsonFile;
- use Composer\Package\BasePackage;
- use Composer\Package\CompletePackageInterface;
- use Composer\Package\Link;
- use Composer\Package\AliasPackage;
- use Composer\Package\PackageInterface;
- use Composer\Package\Version\VersionParser;
- use Composer\Package\Version\VersionSelector;
- use Composer\Pcre\Preg;
- use Composer\Plugin\CommandEvent;
- use Composer\Plugin\PluginEvents;
- use Composer\Repository\InstalledArrayRepository;
- use Composer\Repository\ComposerRepository;
- use Composer\Repository\CompositeRepository;
- use Composer\Repository\FilterRepository;
- use Composer\Repository\PlatformRepository;
- use Composer\Repository\RepositoryFactory;
- use Composer\Repository\InstalledRepository;
- use Composer\Repository\RepositoryInterface;
- use Composer\Repository\RepositorySet;
- use Composer\Repository\RepositoryUtils;
- use Composer\Repository\RootPackageRepository;
- use Composer\Semver\Constraint\ConstraintInterface;
- use Composer\Semver\Semver;
- use Composer\Spdx\SpdxLicenses;
- use Composer\Util\PackageInfo;
- use Symfony\Component\Console\Completion\CompletionInput;
- use Symfony\Component\Console\Formatter\OutputFormatter;
- use Symfony\Component\Console\Formatter\OutputFormatterStyle;
- use Composer\Console\Input\InputArgument;
- use Symfony\Component\Console\Input\InputInterface;
- use Composer\Console\Input\InputOption;
- use Symfony\Component\Console\Output\OutputInterface;
- class ShowCommand extends BaseCommand
- {
- use CompletionTrait;
- protected $versionParser;
- protected $colors;
- private $repositorySet;
- protected function configure()
- {
- $this
- ->setName('show')
- ->setAliases(['info'])
- ->setDescription('Shows information about packages')
- ->setDefinition([
- new InputArgument('package', InputArgument::OPTIONAL, 'Package to inspect. Or a name including a wildcard (*) to filter lists of packages instead.', null, $this->suggestPackageBasedOnMode()),
- new InputArgument('version', InputArgument::OPTIONAL, 'Version or version constraint to inspect'),
- new InputOption('all', null, InputOption::VALUE_NONE, 'List all packages'),
- new InputOption('locked', null, InputOption::VALUE_NONE, 'List all locked packages'),
- new InputOption('installed', 'i', InputOption::VALUE_NONE, 'List installed packages only (enabled by default, only present for BC).'),
- new InputOption('platform', 'p', InputOption::VALUE_NONE, 'List platform packages only'),
- new InputOption('available', 'a', InputOption::VALUE_NONE, 'List available packages only'),
- new InputOption('self', 's', InputOption::VALUE_NONE, 'Show the root package information'),
- new InputOption('name-only', 'N', InputOption::VALUE_NONE, 'List package names only'),
- new InputOption('path', 'P', InputOption::VALUE_NONE, 'Show package paths'),
- new InputOption('tree', 't', InputOption::VALUE_NONE, 'List the dependencies as a tree'),
- new InputOption('latest', 'l', InputOption::VALUE_NONE, 'Show the latest version'),
- new InputOption('outdated', 'o', InputOption::VALUE_NONE, 'Show the latest version but only for packages that are outdated'),
- new InputOption('ignore', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Ignore specified package(s). Use it with the --outdated option if you don\'t want to be informed about new versions of some packages.', null, $this->suggestInstalledPackage(false)),
- new InputOption('major-only', 'M', InputOption::VALUE_NONE, 'Show only packages that have major SemVer-compatible updates. Use with the --latest or --outdated option.'),
- new InputOption('minor-only', 'm', InputOption::VALUE_NONE, 'Show only packages that have minor SemVer-compatible updates. Use with the --latest or --outdated option.'),
- new InputOption('patch-only', null, InputOption::VALUE_NONE, 'Show only packages that have patch SemVer-compatible updates. Use with the --latest or --outdated option.'),
- new InputOption('direct', 'D', InputOption::VALUE_NONE, 'Shows only packages that are directly required by the root package'),
- new InputOption('strict', null, InputOption::VALUE_NONE, 'Return a non-zero exit code when there are outdated packages'),
- new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the output: text or json', 'text', ['json', 'text']),
- new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables search in require-dev packages.'),
- 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'),
- new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore all platform requirements (php & ext- packages). Use with the --outdated option'),
- ])
- ->setHelp(
- <<<EOT
- The show command displays detailed information about a package, or
- lists all packages available.
- Read more at https://getcomposer.org/doc/03-cli.md#show
- EOT
- )
- ;
- }
- protected function suggestPackageBasedOnMode(): \Closure
- {
- return function (CompletionInput $input) {
- if ($input->getOption('available') || $input->getOption('all')) {
- return $this->suggestAvailablePackageInclPlatform()($input);
- }
- if ($input->getOption('platform')) {
- return $this->suggestPlatformPackage()($input);
- }
- return $this->suggestInstalledPackage(false)($input);
- };
- }
- protected function execute(InputInterface $input, OutputInterface $output)
- {
- $this->versionParser = new VersionParser;
- if ($input->getOption('tree')) {
- $this->initStyles($output);
- }
- $composer = $this->tryComposer();
- $io = $this->getIO();
- if ($input->getOption('installed')) {
- $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>');
- }
- if ($input->getOption('outdated')) {
- $input->setOption('latest', true);
- } elseif (count($input->getOption('ignore')) > 0) {
- $io->writeError('<warning>You are using the option "ignore" for action other than "outdated", it will be ignored.</warning>');
- }
- if ($input->getOption('direct') && ($input->getOption('all') || $input->getOption('available') || $input->getOption('platform'))) {
- $io->writeError('The --direct (-D) option is not usable in combination with --all, --platform (-p) or --available (-a)');
- return 1;
- }
- if ($input->getOption('tree') && ($input->getOption('all') || $input->getOption('available'))) {
- $io->writeError('The --tree (-t) option is not usable in combination with --all or --available (-a)');
- return 1;
- }
- if (count(array_filter([$input->getOption('patch-only'), $input->getOption('minor-only'), $input->getOption('major-only')])) > 1) {
- $io->writeError('Only one of --major-only, --minor-only or --patch-only can be used at once');
- return 1;
- }
- if ($input->getOption('tree') && $input->getOption('latest')) {
- $io->writeError('The --tree (-t) option is not usable in combination with --latest (-l)');
- return 1;
- }
- if ($input->getOption('tree') && $input->getOption('path')) {
- $io->writeError('The --tree (-t) option is not usable in combination with --path (-P)');
- return 1;
- }
- $format = $input->getOption('format');
- if (!in_array($format, ['text', 'json'])) {
- $io->writeError(sprintf('Unsupported format "%s". See help for supported formats.', $format));
- return 1;
- }
- $platformReqFilter = $this->getPlatformRequirementFilter($input);
- $platformOverrides = [];
- if ($composer) {
- $platformOverrides = $composer->getConfig()->get('platform');
- }
- $platformRepo = new PlatformRepository([], $platformOverrides);
- $lockedRepo = null;
- if ($input->getOption('self')) {
- $package = clone $this->requireComposer()->getPackage();
- if ($input->getOption('name-only')) {
- $io->write($package->getName());
- return 0;
- }
- if ($input->getArgument('package')) {
- throw new \InvalidArgumentException('You cannot use --self together with a package name');
- }
- $repos = $installedRepo = new InstalledRepository([new RootPackageRepository($package)]);
- } elseif ($input->getOption('platform')) {
- $repos = $installedRepo = new InstalledRepository([$platformRepo]);
- } elseif ($input->getOption('available')) {
- $installedRepo = new InstalledRepository([$platformRepo]);
- if ($composer) {
- $repos = new CompositeRepository($composer->getRepositoryManager()->getRepositories());
- $installedRepo->addRepository($composer->getRepositoryManager()->getLocalRepository());
- } else {
- $defaultRepos = RepositoryFactory::defaultReposWithDefaultManager($io);
- $repos = new CompositeRepository($defaultRepos);
- $io->writeError('No composer.json found in the current directory, showing available packages from ' . implode(', ', array_keys($defaultRepos)));
- }
- } elseif ($input->getOption('all') && $composer) {
- $localRepo = $composer->getRepositoryManager()->getLocalRepository();
- $locker = $composer->getLocker();
- if ($locker->isLocked()) {
- $lockedRepo = $locker->getLockedRepository(true);
- $installedRepo = new InstalledRepository([$lockedRepo, $localRepo, $platformRepo]);
- } else {
- $installedRepo = new InstalledRepository([$localRepo, $platformRepo]);
- }
- $repos = new CompositeRepository(array_merge([new FilterRepository($installedRepo, ['canonical' => false])], $composer->getRepositoryManager()->getRepositories()));
- } elseif ($input->getOption('all')) {
- $defaultRepos = RepositoryFactory::defaultReposWithDefaultManager($io);
- $io->writeError('No composer.json found in the current directory, showing available packages from ' . implode(', ', array_keys($defaultRepos)));
- $installedRepo = new InstalledRepository([$platformRepo]);
- $repos = new CompositeRepository(array_merge([$installedRepo], $defaultRepos));
- } elseif ($input->getOption('locked')) {
- if (!$composer || !$composer->getLocker()->isLocked()) {
- throw new \UnexpectedValueException('A valid composer.json and composer.lock files is required to run this command with --locked');
- }
- $locker = $composer->getLocker();
- $lockedRepo = $locker->getLockedRepository(!$input->getOption('no-dev'));
- $repos = $installedRepo = new InstalledRepository([$lockedRepo]);
- } else {
- if (!$composer) {
- $composer = $this->requireComposer();
- }
- $rootPkg = $composer->getPackage();
- $repos = $installedRepo = new InstalledRepository([$composer->getRepositoryManager()->getLocalRepository()]);
- if ($input->getOption('no-dev')) {
- $packages = RepositoryUtils::filterRequiredPackages($installedRepo->getPackages(), $rootPkg);
- $repos = $installedRepo = new InstalledRepository([new InstalledArrayRepository(array_map(static function ($pkg): PackageInterface {
- return clone $pkg;
- }, $packages))]);
- }
- if (!$installedRepo->getPackages() && ($rootPkg->getRequires() || $rootPkg->getDevRequires())) {
- $io->writeError('<warning>No dependencies installed. Try running composer install or update.</warning>');
- }
- }
- if ($composer) {
- $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'show', $input, $output);
- $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
- }
- if ($input->getOption('latest') && null === $composer) {
- $io->writeError('No composer.json found in the current directory, disabling "latest" option');
- $input->setOption('latest', false);
- }
- $packageFilter = $input->getArgument('package');
- if (isset($package)) {
- $versions = [$package->getPrettyVersion() => $package->getVersion()];
- } elseif (null !== $packageFilter && !str_contains($packageFilter, '*')) {
- [$package, $versions] = $this->getPackage($installedRepo, $repos, $packageFilter, $input->getArgument('version'));
- if (!isset($package)) {
- $options = $input->getOptions();
- $hint = '';
- if ($input->getOption('locked')) {
- $hint .= ' in lock file';
- }
- if (isset($options['working-dir'])) {
- $hint .= ' in ' . $options['working-dir'] . '/composer.json';
- }
- if (PlatformRepository::isPlatformPackage($packageFilter) && !$input->getOption('platform')) {
- $hint .= ', try using --platform (-p) to show platform packages';
- }
- if (!$input->getOption('all')) {
- $hint .= ', try using --available (-a) to show all available packages';
- }
- throw new \InvalidArgumentException('Package "' . $packageFilter . '" not found'.$hint.'.');
- }
- }
- if (isset($package)) {
- assert(isset($versions));
- $exitCode = 0;
- if ($input->getOption('tree')) {
- $arrayTree = $this->generatePackageTree($package, $installedRepo, $repos);
- if ('json' === $format) {
- $io->write(JsonFile::encode(['installed' => [$arrayTree]]));
- } else {
- $this->displayPackageTree([$arrayTree]);
- }
- return $exitCode;
- }
- $latestPackage = null;
- if ($input->getOption('latest')) {
- $latestPackage = $this->findLatestPackage($package, $composer, $platformRepo, $input->getOption('major-only'), $input->getOption('minor-only'), $input->getOption('patch-only'), $platformReqFilter);
- }
- if (
- $input->getOption('outdated')
- && $input->getOption('strict')
- && null !== $latestPackage
- && $latestPackage->getFullPrettyVersion() !== $package->getFullPrettyVersion()
- && (!$latestPackage instanceof CompletePackageInterface || !$latestPackage->isAbandoned())
- ) {
- $exitCode = 1;
- }
- if ($input->getOption('path')) {
- $io->write($package->getName(), false);
- $io->write(' ' . strtok(realpath($composer->getInstallationManager()->getInstallPath($package)), "\r\n"));
- return $exitCode;
- }
- if ('json' === $format) {
- $this->printPackageInfoAsJson($package, $versions, $installedRepo, $latestPackage ?: null);
- } else {
- $this->printPackageInfo($package, $versions, $installedRepo, $latestPackage ?: null);
- }
- return $exitCode;
- }
- if ($input->getOption('tree')) {
- $rootRequires = $this->getRootRequires();
- $packages = $installedRepo->getPackages();
- usort($packages, static function (BasePackage $a, BasePackage $b): int {
- return strcmp((string) $a, (string) $b);
- });
- $arrayTree = [];
- foreach ($packages as $package) {
- if (in_array($package->getName(), $rootRequires, true)) {
- $arrayTree[] = $this->generatePackageTree($package, $installedRepo, $repos);
- }
- }
- if ('json' === $format) {
- $io->write(JsonFile::encode(['installed' => $arrayTree]));
- } else {
- $this->displayPackageTree($arrayTree);
- }
- return 0;
- }
- $packages = [];
- $packageFilterRegex = null;
- if (null !== $packageFilter) {
- $packageFilterRegex = '{^'.str_replace('\\*', '.*?', preg_quote($packageFilter)).'$}i';
- }
- $packageListFilter = null;
- if ($input->getOption('direct')) {
- $packageListFilter = $this->getRootRequires();
- }
- if ($input->getOption('path') && null === $composer) {
- $io->writeError('No composer.json found in the current directory, disabling "path" option');
- $input->setOption('path', false);
- }
- foreach (RepositoryUtils::flattenRepositories($repos) as $repo) {
- if ($repo === $platformRepo) {
- $type = 'platform';
- } elseif ($lockedRepo !== null && $repo === $lockedRepo) {
- $type = 'locked';
- } elseif ($repo === $installedRepo || in_array($repo, $installedRepo->getRepositories(), true)) {
- $type = 'installed';
- } else {
- $type = 'available';
- }
- if ($repo instanceof ComposerRepository) {
- foreach ($repo->getPackageNames($packageFilter) as $name) {
- $packages[$type][$name] = $name;
- }
- } else {
- foreach ($repo->getPackages() as $package) {
- if (!isset($packages[$type][$package->getName()])
- || !is_object($packages[$type][$package->getName()])
- || version_compare($packages[$type][$package->getName()]->getVersion(), $package->getVersion(), '<')
- ) {
- while ($package instanceof AliasPackage) {
- $package = $package->getAliasOf();
- }
- if (!$packageFilterRegex || Preg::isMatch($packageFilterRegex, $package->getName())) {
- if (null === $packageListFilter || in_array($package->getName(), $packageListFilter, true)) {
- $packages[$type][$package->getName()] = $package;
- }
- }
- }
- }
- if ($repo === $platformRepo) {
- foreach ($platformRepo->getDisabledPackages() as $name => $package) {
- $packages[$type][$name] = $package;
- }
- }
- }
- }
- $showAllTypes = $input->getOption('all');
- $showLatest = $input->getOption('latest');
- $showMajorOnly = $input->getOption('major-only');
- $showMinorOnly = $input->getOption('minor-only');
- $showPatchOnly = $input->getOption('patch-only');
- $ignoredPackages = array_map('strtolower', $input->getOption('ignore'));
- $indent = $showAllTypes ? ' ' : '';
- $latestPackages = [];
- $exitCode = 0;
- $viewData = [];
- $viewMetaData = [];
- foreach (['platform' => true, 'locked' => true, 'available' => false, 'installed' => true] as $type => $showVersion) {
- if (isset($packages[$type])) {
- ksort($packages[$type]);
- $nameLength = $versionLength = $latestLength = 0;
- if ($showLatest && $showVersion) {
- foreach ($packages[$type] as $package) {
- if (is_object($package)) {
- $latestPackage = $this->findLatestPackage($package, $composer, $platformRepo, $showMajorOnly, $showMinorOnly, $showPatchOnly, $platformReqFilter);
- if ($latestPackage === null) {
- continue;
- }
- $latestPackages[$package->getPrettyName()] = $latestPackage;
- }
- }
- }
- $writePath = !$input->getOption('name-only') && $input->getOption('path');
- $writeVersion = !$input->getOption('name-only') && !$input->getOption('path') && $showVersion;
- $writeLatest = $writeVersion && $showLatest;
- $writeDescription = !$input->getOption('name-only') && !$input->getOption('path');
- $hasOutdatedPackages = false;
- $viewData[$type] = [];
- foreach ($packages[$type] as $package) {
- $packageViewData = [];
- if (is_object($package)) {
- $latestPackage = null;
- if ($showLatest && isset($latestPackages[$package->getPrettyName()])) {
- $latestPackage = $latestPackages[$package->getPrettyName()];
- }
- $packageIsUpToDate = $latestPackage && $latestPackage->getFullPrettyVersion() === $package->getFullPrettyVersion() && (!$latestPackage instanceof CompletePackageInterface || !$latestPackage->isAbandoned());
- $packageIsUpToDate = $packageIsUpToDate || ($latestPackage === null && $showMajorOnly);
- $packageIsIgnored = \in_array($package->getPrettyName(), $ignoredPackages, true);
- if ($input->getOption('outdated') && ($packageIsUpToDate || $packageIsIgnored)) {
- continue;
- }
- if ($input->getOption('outdated') || $input->getOption('strict')) {
- $hasOutdatedPackages = true;
- }
- $packageViewData['name'] = $package->getPrettyName();
- $packageViewData['direct-dependency'] = in_array($package->getName(), $this->getRootRequires(), true);
- if ($format !== 'json' || true !== $input->getOption('name-only')) {
- $packageViewData['homepage'] = $package instanceof CompletePackageInterface ? $package->getHomepage() : null;
- $packageViewData['source'] = PackageInfo::getViewSourceUrl($package);
- }
- $nameLength = max($nameLength, strlen($package->getPrettyName()));
- if ($writeVersion) {
- $packageViewData['version'] = $package->getFullPrettyVersion();
- $versionLength = max($versionLength, strlen($package->getFullPrettyVersion()));
- }
- if ($writeLatest && $latestPackage) {
- $packageViewData['latest'] = $latestPackage->getFullPrettyVersion();
- $packageViewData['latest-status'] = $this->getUpdateStatus($latestPackage, $package);
- $latestLength = max($latestLength, strlen($packageViewData['latest']));
- } elseif ($writeLatest) {
- $packageViewData['latest'] = '[none matched]';
- $packageViewData['latest-status'] = 'up-to-date';
- $latestLength = max($latestLength, strlen($packageViewData['latest']));
- }
- if ($writeDescription && $package instanceof CompletePackageInterface) {
- $packageViewData['description'] = $package->getDescription();
- }
- if ($writePath) {
- $packageViewData['path'] = strtok(realpath($composer->getInstallationManager()->getInstallPath($package)), "\r\n");
- }
- $packageIsAbandoned = false;
- if ($latestPackage instanceof CompletePackageInterface && $latestPackage->isAbandoned()) {
- $replacementPackageName = $latestPackage->getReplacementPackage();
- $replacement = $replacementPackageName !== null
- ? 'Use ' . $latestPackage->getReplacementPackage() . ' instead'
- : 'No replacement was suggested';
- $packageWarning = sprintf(
- 'Package %s is abandoned, you should avoid using it. %s.',
- $package->getPrettyName(),
- $replacement
- );
- $packageViewData['warning'] = $packageWarning;
- $packageIsAbandoned = $replacementPackageName ?? true;
- }
- $packageViewData['abandoned'] = $packageIsAbandoned;
- } else {
- $packageViewData['name'] = $package;
- $nameLength = max($nameLength, strlen($package));
- }
- $viewData[$type][] = $packageViewData;
- }
- $viewMetaData[$type] = [
- 'nameLength' => $nameLength,
- 'versionLength' => $versionLength,
- 'latestLength' => $latestLength,
- 'writeLatest' => $writeLatest,
- ];
- if ($input->getOption('strict') && $hasOutdatedPackages) {
- $exitCode = 1;
- break;
- }
- }
- }
- if ('json' === $format) {
- $io->write(JsonFile::encode($viewData));
- } else {
- if ($input->getOption('latest') && array_filter($viewData)) {
- if (!$io->isDecorated()) {
- $io->writeError('Legend:');
- $io->writeError('! patch or minor release available - update recommended');
- $io->writeError('~ major release available - update possible');
- if (!$input->getOption('outdated')) {
- $io->writeError('= up to date version');
- }
- } else {
- $io->writeError('<info>Color legend:</info>');
- $io->writeError('- <highlight>patch or minor</highlight> release available - update recommended');
- $io->writeError('- <comment>major</comment> release available - update possible');
- if (!$input->getOption('outdated')) {
- $io->writeError('- <info>up to date</info> version');
- }
- }
- }
- $width = $this->getTerminalWidth();
- foreach ($viewData as $type => $packages) {
- $nameLength = $viewMetaData[$type]['nameLength'];
- $versionLength = $viewMetaData[$type]['versionLength'];
- $latestLength = $viewMetaData[$type]['latestLength'];
- $writeLatest = $viewMetaData[$type]['writeLatest'];
- $versionFits = $nameLength + $versionLength + 3 <= $width;
- $latestFits = $nameLength + $versionLength + $latestLength + 3 <= $width;
- $descriptionFits = $nameLength + $versionLength + $latestLength + 24 <= $width;
- if ($latestFits && !$io->isDecorated()) {
- $latestLength += 2;
- }
- if ($showAllTypes) {
- if ('available' === $type) {
- $io->write('<comment>' . $type . '</comment>:');
- } else {
- $io->write('<info>' . $type . '</info>:');
- }
- }
- if ($writeLatest && !$input->getOption('direct')) {
- $directDeps = [];
- $transitiveDeps = [];
- foreach ($packages as $pkg) {
- if ($pkg['direct-dependency'] ?? false) {
- $directDeps[] = $pkg;
- } else {
- $transitiveDeps[] = $pkg;
- }
- }
- $io->write('');
- $io->write('<info>Direct dependencies required in composer.json:</>');
- if (\count($directDeps) > 0) {
- $this->printPackages($io, $directDeps, $indent, $versionFits, $latestFits, $descriptionFits, $width, $versionLength, $nameLength, $latestLength);
- } else {
- $io->write('Everything up to date');
- }
- $io->write('');
- $io->write('<info>Transitive dependencies not required in composer.json:</>');
- if (\count($transitiveDeps) > 0) {
- $this->printPackages($io, $transitiveDeps, $indent, $versionFits, $latestFits, $descriptionFits, $width, $versionLength, $nameLength, $latestLength);
- } else {
- $io->write('Everything up to date');
- }
- } else {
- $this->printPackages($io, $packages, $indent, $versionFits, $latestFits, $descriptionFits, $width, $versionLength, $nameLength, $latestLength);
- }
- if ($showAllTypes) {
- $io->write('');
- }
- }
- }
- return $exitCode;
- }
- private function printPackages(IOInterface $io, array $packages, string $indent, bool $writeVersion, bool $writeLatest, bool $writeDescription, int $width, int $versionLength, int $nameLength, int $latestLength): void
- {
- foreach ($packages as $package) {
- $link = $package['source'] ?? $package['homepage'] ?? '';
- if ($link !== '') {
- $io->write($indent . '<href='.OutputFormatter::escape($link).'>'.$package['name'].'</>'. str_repeat(' ', $nameLength - strlen($package['name'])), false);
- } else {
- $io->write($indent . str_pad($package['name'], $nameLength, ' '), false);
- }
- if (isset($package['version']) && $writeVersion) {
- $io->write(' ' . str_pad($package['version'], $versionLength, ' '), false);
- }
- if (isset($package['latest']) && isset($package['latest-status']) && $writeLatest) {
- $latestVersion = $package['latest'];
- $updateStatus = $package['latest-status'];
- $style = $this->updateStatusToVersionStyle($updateStatus);
- if (!$io->isDecorated()) {
- $latestVersion = str_replace(['up-to-date', 'semver-safe-update', 'update-possible'], ['=', '!', '~'], $updateStatus) . ' ' . $latestVersion;
- }
- $io->write(' <' . $style . '>' . str_pad($latestVersion, $latestLength, ' ') . '</' . $style . '>', false);
- }
- if (isset($package['description']) && $writeDescription) {
- $description = strtok($package['description'], "\r\n");
- $remaining = $width - $nameLength - $versionLength - 4;
- if ($writeLatest) {
- $remaining -= $latestLength;
- }
- if (strlen($description) > $remaining) {
- $description = substr($description, 0, $remaining - 3) . '...';
- }
- $io->write(' ' . $description, false);
- }
- if (isset($package['path'])) {
- $io->write(' ' . $package['path'], false);
- }
- $io->write('');
- if (isset($package['warning'])) {
- $io->write('<warning>' . $package['warning'] . '</warning>');
- }
- }
- }
- protected function getRootRequires(): array
- {
- $rootPackage = $this->requireComposer()->getPackage();
- return array_map(
- 'strtolower',
- array_keys(array_merge($rootPackage->getRequires(), $rootPackage->getDevRequires()))
- );
- }
- protected function getVersionStyle(PackageInterface $latestPackage, PackageInterface $package)
- {
- return $this->updateStatusToVersionStyle($this->getUpdateStatus($latestPackage, $package));
- }
- protected function getPackage(InstalledRepository $installedRepo, RepositoryInterface $repos, string $name, $version = null): array
- {
- $name = strtolower($name);
- $constraint = is_string($version) ? $this->versionParser->parseConstraints($version) : $version;
- $policy = new DefaultPolicy();
- $repositorySet = new RepositorySet('dev');
- $repositorySet->allowInstalledRepositories();
- $repositorySet->addRepository($repos);
- $matchedPackage = null;
- $versions = [];
- if (PlatformRepository::isPlatformPackage($name)) {
- $pool = $repositorySet->createPoolWithAllPackages();
- } else {
- $pool = $repositorySet->createPoolForPackage($name);
- }
- $matches = $pool->whatProvides($name, $constraint);
- foreach ($matches as $index => $package) {
- if ($package instanceof AliasPackage && $package->getVersion() === VersionParser::DEFAULT_BRANCH_ALIAS) {
- $package = $package->getAliasOf();
- }
- if (null === $version && $installedRepo->hasPackage($package)) {
- $matchedPackage = $package;
- }
- $versions[$package->getPrettyVersion()] = $package->getVersion();
- $matches[$index] = $package->getId();
- }
- if (!$matchedPackage && $matches && $preferred = $policy->selectPreferredPackages($pool, $matches)) {
- $matchedPackage = $pool->literalToPackage($preferred[0]);
- }
- return [$matchedPackage, $versions];
- }
- protected function printPackageInfo(CompletePackageInterface $package, array $versions, InstalledRepository $installedRepo, ?PackageInterface $latestPackage = null): void
- {
- $io = $this->getIO();
- $this->printMeta($package, $versions, $installedRepo, $latestPackage ?: null);
- $this->printLinks($package, Link::TYPE_REQUIRE);
- $this->printLinks($package, Link::TYPE_DEV_REQUIRE, 'requires (dev)');
- if ($package->getSuggests()) {
- $io->write("\n<info>suggests</info>");
- foreach ($package->getSuggests() as $suggested => $reason) {
- $io->write($suggested . ' <comment>' . $reason . '</comment>');
- }
- }
- $this->printLinks($package, Link::TYPE_PROVIDE);
- $this->printLinks($package, Link::TYPE_CONFLICT);
- $this->printLinks($package, Link::TYPE_REPLACE);
- }
- protected function printMeta(CompletePackageInterface $package, array $versions, InstalledRepository $installedRepo, ?PackageInterface $latestPackage = null): void
- {
- $io = $this->getIO();
- $io->write('<info>name</info> : ' . $package->getPrettyName());
- $io->write('<info>descrip.</info> : ' . $package->getDescription());
- $io->write('<info>keywords</info> : ' . implode(', ', $package->getKeywords() ?: []));
- $this->printVersions($package, $versions, $installedRepo);
- if ($latestPackage) {
- $style = $this->getVersionStyle($latestPackage, $package);
- $io->write('<info>latest</info> : <'.$style.'>' . $latestPackage->getPrettyVersion() . '</'.$style.'>');
- } else {
- $latestPackage = $package;
- }
- $io->write('<info>type</info> : ' . $package->getType());
- $this->printLicenses($package);
- $io->write('<info>homepage</info> : ' . $package->getHomepage());
- $io->write('<info>source</info> : ' . sprintf('[%s] <comment>%s</comment> %s', $package->getSourceType(), $package->getSourceUrl(), $package->getSourceReference()));
- $io->write('<info>dist</info> : ' . sprintf('[%s] <comment>%s</comment> %s', $package->getDistType(), $package->getDistUrl(), $package->getDistReference()));
- if ($installedRepo->hasPackage($package)) {
- $io->write('<info>path</info> : ' . sprintf('%s', realpath($this->requireComposer()->getInstallationManager()->getInstallPath($package))));
- }
- $io->write('<info>names</info> : ' . implode(', ', $package->getNames()));
- if ($latestPackage instanceof CompletePackageInterface && $latestPackage->isAbandoned()) {
- $replacement = ($latestPackage->getReplacementPackage() !== null)
- ? ' The author suggests using the ' . $latestPackage->getReplacementPackage(). ' package instead.'
- : null;
- $io->writeError(
- sprintf('<warning>Attention: This package is abandoned and no longer maintained.%s</warning>', $replacement)
- );
- }
- if ($package->getSupport()) {
- $io->write("\n<info>support</info>");
- foreach ($package->getSupport() as $type => $value) {
- $io->write('<comment>' . $type . '</comment> : '.$value);
- }
- }
- if ($package->getAutoload()) {
- $io->write("\n<info>autoload</info>");
- $autoloadConfig = $package->getAutoload();
- foreach ($autoloadConfig as $type => $autoloads) {
- $io->write('<comment>' . $type . '</comment>');
- if ($type === 'psr-0' || $type === 'psr-4') {
- foreach ($autoloads as $name => $path) {
- $io->write(($name ?: '*') . ' => ' . (is_array($path) ? implode(', ', $path) : ($path ?: '.')));
- }
- } elseif ($type === 'classmap') {
- $io->write(implode(', ', $autoloadConfig[$type]));
- }
- }
- if ($package->getIncludePaths()) {
- $io->write('<comment>include-path</comment>');
- $io->write(implode(', ', $package->getIncludePaths()));
- }
- }
- }
- protected function printVersions(CompletePackageInterface $package, array $versions, InstalledRepository $installedRepo): void
- {
- $versions = array_keys($versions);
- $versions = Semver::rsort($versions);
- if ($installedPackages = $installedRepo->findPackages($package->getName())) {
- foreach ($installedPackages as $installedPackage) {
- $installedVersion = $installedPackage->getPrettyVersion();
- $key = array_search($installedVersion, $versions);
- if (false !== $key) {
- $versions[$key] = '<info>* ' . $installedVersion . '</info>';
- }
- }
- }
- $versions = implode(', ', $versions);
- $this->getIO()->write('<info>versions</info> : ' . $versions);
- }
- protected function printLinks(CompletePackageInterface $package, string $linkType, ?string $title = null): void
- {
- $title = $title ?: $linkType;
- $io = $this->getIO();
- if ($links = $package->{'get'.ucfirst($linkType)}()) {
- $io->write("\n<info>" . $title . "</info>");
- foreach ($links as $link) {
- $io->write($link->getTarget() . ' <comment>' . $link->getPrettyConstraint() . '</comment>');
- }
- }
- }
- protected function printLicenses(CompletePackageInterface $package): void
- {
- $spdxLicenses = new SpdxLicenses();
- $licenses = $package->getLicense();
- $io = $this->getIO();
- foreach ($licenses as $licenseId) {
- $license = $spdxLicenses->getLicenseByIdentifier($licenseId);
- if (!$license) {
- $out = $licenseId;
- } else {
- if ($license[1] === true) {
- $out = sprintf('%s (%s) (OSI approved) %s', $license[0], $licenseId, $license[2]);
- } else {
- $out = sprintf('%s (%s) %s', $license[0], $licenseId, $license[2]);
- }
- }
- $io->write('<info>license</info> : ' . $out);
- }
- }
- protected function printPackageInfoAsJson(CompletePackageInterface $package, array $versions, InstalledRepository $installedRepo, ?PackageInterface $latestPackage = null): void
- {
- $json = [
- 'name' => $package->getPrettyName(),
- 'description' => $package->getDescription(),
- 'keywords' => $package->getKeywords() ?: [],
- 'type' => $package->getType(),
- 'homepage' => $package->getHomepage(),
- 'names' => $package->getNames(),
- ];
- $json = $this->appendVersions($json, $versions);
- $json = $this->appendLicenses($json, $package);
- if ($latestPackage) {
- $json['latest'] = $latestPackage->getPrettyVersion();
- } else {
- $latestPackage = $package;
- }
- if (null !== $package->getSourceType()) {
- $json['source'] = [
- 'type' => $package->getSourceType(),
- 'url' => $package->getSourceUrl(),
- 'reference' => $package->getSourceReference(),
- ];
- }
- if (null !== $package->getDistType()) {
- $json['dist'] = [
- 'type' => $package->getDistType(),
- 'url' => $package->getDistUrl(),
- 'reference' => $package->getDistReference(),
- ];
- }
- if ($installedRepo->hasPackage($package)) {
- $json['path'] = realpath($this->requireComposer()->getInstallationManager()->getInstallPath($package));
- if ($json['path'] === false) {
- unset($json['path']);
- }
- }
- if ($latestPackage instanceof CompletePackageInterface && $latestPackage->isAbandoned()) {
- $json['replacement'] = $latestPackage->getReplacementPackage();
- }
- if ($package->getSuggests()) {
- $json['suggests'] = $package->getSuggests();
- }
- if ($package->getSupport()) {
- $json['support'] = $package->getSupport();
- }
- $json = $this->appendAutoload($json, $package);
- if ($package->getIncludePaths()) {
- $json['include_path'] = $package->getIncludePaths();
- }
- $json = $this->appendLinks($json, $package);
- $this->getIO()->write(JsonFile::encode($json));
- }
- private function appendVersions(array $json, array $versions): array
- {
- uasort($versions, 'version_compare');
- $versions = array_keys(array_reverse($versions));
- $json['versions'] = $versions;
- return $json;
- }
- private function appendLicenses(array $json, CompletePackageInterface $package): array
- {
- if ($licenses = $package->getLicense()) {
- $spdxLicenses = new SpdxLicenses();
- $json['licenses'] = array_map(static function ($licenseId) use ($spdxLicenses) {
- $license = $spdxLicenses->getLicenseByIdentifier($licenseId);
- if (!$license) {
- return $licenseId;
- }
- return [
- 'name' => $license[0],
- 'osi' => $licenseId,
- 'url' => $license[2],
- ];
- }, $licenses);
- }
- return $json;
- }
- private function appendAutoload(array $json, CompletePackageInterface $package): array
- {
- if ($package->getAutoload()) {
- $autoload = [];
- foreach ($package->getAutoload() as $type => $autoloads) {
- if ($type === 'psr-0' || $type === 'psr-4') {
- $psr = [];
- foreach ($autoloads as $name => $path) {
- if (!$path) {
- $path = '.';
- }
- $psr[$name ?: '*'] = $path;
- }
- $autoload[$type] = $psr;
- } elseif ($type === 'classmap') {
- $autoload['classmap'] = $autoloads;
- }
- }
- $json['autoload'] = $autoload;
- }
- return $json;
- }
- private function appendLinks(array $json, CompletePackageInterface $package): array
- {
- foreach (Link::$TYPES as $linkType) {
- $json = $this->appendLink($json, $package, $linkType);
- }
- return $json;
- }
- private function appendLink(array $json, CompletePackageInterface $package, string $linkType): array
- {
- $links = $package->{'get' . ucfirst($linkType)}();
- if ($links) {
- $json[$linkType] = [];
- foreach ($links as $link) {
- $json[$linkType][$link->getTarget()] = $link->getPrettyConstraint();
- }
- }
- return $json;
- }
- protected function initStyles(OutputInterface $output): void
- {
- $this->colors = [
- 'green',
- 'yellow',
- 'cyan',
- 'magenta',
- 'blue',
- ];
- foreach ($this->colors as $color) {
- $style = new OutputFormatterStyle($color);
- $output->getFormatter()->setStyle($color, $style);
- }
- }
- protected function displayPackageTree(array $arrayTree): void
- {
- $io = $this->getIO();
- foreach ($arrayTree as $package) {
- $io->write(sprintf('<info>%s</info>', $package['name']), false);
- $io->write(' ' . $package['version'], false);
- if (isset($package['description'])) {
- $io->write(' ' . strtok($package['description'], "\r\n"));
- } else {
- $io->write('');
- }
- if (isset($package['requires'])) {
- $requires = $package['requires'];
- $treeBar = '├';
- $j = 0;
- $total = count($requires);
- foreach ($requires as $require) {
- $requireName = $require['name'];
- $j++;
- if ($j === $total) {
- $treeBar = 'â””';
- }
- $level = 1;
- $color = $this->colors[$level];
- $info = sprintf(
- '%s──<%s>%s</%s> %s',
- $treeBar,
- $color,
- $requireName,
- $color,
- $require['version']
- );
- $this->writeTreeLine($info);
- $treeBar = str_replace('â””', ' ', $treeBar);
- $packagesInTree = [$package['name'], $requireName];
- $this->displayTree($require, $packagesInTree, $treeBar, $level + 1);
- }
- }
- }
- }
- protected function generatePackageTree(
- PackageInterface $package,
- InstalledRepository $installedRepo,
- RepositoryInterface $remoteRepos
- ): array {
- $requires = $package->getRequires();
- ksort($requires);
- $children = [];
- foreach ($requires as $requireName => $require) {
- $packagesInTree = [$package->getName(), $requireName];
- $treeChildDesc = [
- 'name' => $requireName,
- 'version' => $require->getPrettyConstraint(),
- ];
- $deepChildren = $this->addTree($requireName, $require, $installedRepo, $remoteRepos, $packagesInTree);
- if ($deepChildren) {
- $treeChildDesc['requires'] = $deepChildren;
- }
- $children[] = $treeChildDesc;
- }
- $tree = [
- 'name' => $package->getPrettyName(),
- 'version' => $package->getPrettyVersion(),
- 'description' => $package instanceof CompletePackageInterface ? $package->getDescription() : '',
- ];
- if ($children) {
- $tree['requires'] = $children;
- }
- return $tree;
- }
- protected function displayTree(
- $package,
- array $packagesInTree,
- string $previousTreeBar = '├',
- int $level = 1
- ): void {
- $previousTreeBar = str_replace('├', '│', $previousTreeBar);
- if (is_array($package) && isset($package['requires'])) {
- $requires = $package['requires'];
- $treeBar = $previousTreeBar . ' ├';
- $i = 0;
- $total = count($requires);
- foreach ($requires as $require) {
- $currentTree = $packagesInTree;
- $i++;
- if ($i === $total) {
- $treeBar = $previousTreeBar . ' â””';
- }
- $colorIdent = $level % count($this->colors);
- $color = $this->colors[$colorIdent];
- $circularWarn = in_array(
- $require['name'],
- $currentTree,
- true
- ) ? '(circular dependency aborted here)' : '';
- $info = rtrim(sprintf(
- '%s──<%s>%s</%s> %s %s',
- $treeBar,
- $color,
- $require['name'],
- $color,
- $require['version'],
- $circularWarn
- ));
- $this->writeTreeLine($info);
- $treeBar = str_replace('â””', ' ', $treeBar);
- $currentTree[] = $require['name'];
- $this->displayTree($require, $currentTree, $treeBar, $level + 1);
- }
- }
- }
- protected function addTree(
- string $name,
- Link $link,
- InstalledRepository $installedRepo,
- RepositoryInterface $remoteRepos,
- array $packagesInTree
- ): array {
- $children = [];
- [$package] = $this->getPackage(
- $installedRepo,
- $remoteRepos,
- $name,
- $link->getPrettyConstraint() === 'self.version' ? $link->getConstraint() : $link->getPrettyConstraint()
- );
- if (is_object($package)) {
- $requires = $package->getRequires();
- ksort($requires);
- foreach ($requires as $requireName => $require) {
- $currentTree = $packagesInTree;
- $treeChildDesc = [
- 'name' => $requireName,
- 'version' => $require->getPrettyConstraint(),
- ];
- if (!in_array($requireName, $currentTree, true)) {
- $currentTree[] = $requireName;
- $deepChildren = $this->addTree($requireName, $require, $installedRepo, $remoteRepos, $currentTree);
- if ($deepChildren) {
- $treeChildDesc['requires'] = $deepChildren;
- }
- }
- $children[] = $treeChildDesc;
- }
- }
- return $children;
- }
- private function updateStatusToVersionStyle(string $updateStatus): string
- {
- return str_replace(['up-to-date', 'semver-safe-update', 'update-possible'], ['info', 'highlight', 'comment'], $updateStatus);
- }
- private function getUpdateStatus(PackageInterface $latestPackage, PackageInterface $package): string
- {
- if ($latestPackage->getFullPrettyVersion() === $package->getFullPrettyVersion()) {
- return 'up-to-date';
- }
- $constraint = $package->getVersion();
- if (0 !== strpos($constraint, 'dev-')) {
- $constraint = '^'.$constraint;
- }
- if ($latestPackage->getVersion() && Semver::satisfies($latestPackage->getVersion(), $constraint)) {
- return 'semver-safe-update';
- }
- return 'update-possible';
- }
- private function writeTreeLine(string $line): void
- {
- $io = $this->getIO();
- if (!$io->isDecorated()) {
- $line = str_replace(['└', '├', '──', '│'], ['`-', '|-', '-', '|'], $line);
- }
- $io->write($line);
- }
- private function findLatestPackage(PackageInterface $package, Composer $composer, PlatformRepository $platformRepo, bool $majorOnly, bool $minorOnly, bool $patchOnly, PlatformRequirementFilterInterface $platformReqFilter): ?PackageInterface
- {
- $name = $package->getName();
- $versionSelector = new VersionSelector($this->getRepositorySet($composer), $platformRepo);
- $stability = $composer->getPackage()->getMinimumStability();
- $flags = $composer->getPackage()->getStabilityFlags();
- if (isset($flags[$name])) {
- $stability = array_search($flags[$name], BasePackage::$stabilities, true);
- }
- $bestStability = $stability;
- if ($composer->getPackage()->getPreferStable()) {
- $bestStability = $package->getStability();
- }
- $targetVersion = null;
- if (0 === strpos($package->getVersion(), 'dev-')) {
- $targetVersion = $package->getVersion();
- if ($majorOnly) {
- return null;
- }
- }
- if ($targetVersion === null) {
- if ($majorOnly && Preg::isMatch('{^(\d+)\.}', $package->getVersion(), $match)) {
- $targetVersion = '>='.($match[1] + 1).',<9999999-dev';
- }
- if ($minorOnly) {
- $targetVersion = '^'.$package->getVersion();
- }
- if ($patchOnly) {
- $trimmedVersion = Preg::replace('{(\.0)+$}D', '', $package->getVersion());
- $partsNeeded = substr($trimmedVersion, 0, 1) === '0' ? 4 : 3;
- while (substr_count($trimmedVersion, '.') + 1 < $partsNeeded) {
- $trimmedVersion .= '.0';
- }
- $targetVersion = '~'.$trimmedVersion;
- }
- }
- $candidate = $versionSelector->findBestCandidate($name, $targetVersion, $bestStability, $platformReqFilter);
- while ($candidate instanceof AliasPackage) {
- $candidate = $candidate->getAliasOf();
- }
- return $candidate !== false ? $candidate : null;
- }
- private function getRepositorySet(Composer $composer): RepositorySet
- {
- if (!$this->repositorySet) {
- $this->repositorySet = new RepositorySet($composer->getPackage()->getMinimumStability(), $composer->getPackage()->getStabilityFlags());
- $this->repositorySet->addRepository(new CompositeRepository($composer->getRepositoryManager()->getRepositories()));
- }
- return $this->repositorySet;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Command;
- use Symfony\Component\Console\Input\InputInterface;
- use Composer\Console\Input\InputOption;
- use Symfony\Component\Console\Output\OutputInterface;
- use Composer\Downloader\ChangeReportInterface;
- use Composer\Downloader\DvcsDownloaderInterface;
- use Composer\Downloader\VcsCapableDownloaderInterface;
- use Composer\Package\Dumper\ArrayDumper;
- use Composer\Package\Version\VersionGuesser;
- use Composer\Package\Version\VersionParser;
- use Composer\Plugin\CommandEvent;
- use Composer\Plugin\PluginEvents;
- use Composer\Script\ScriptEvents;
- use Composer\Util\ProcessExecutor;
- class StatusCommand extends BaseCommand
- {
- private const EXIT_CODE_ERRORS = 1;
- private const EXIT_CODE_UNPUSHED_CHANGES = 2;
- private const EXIT_CODE_VERSION_CHANGES = 4;
- protected function configure(): void
- {
- $this
- ->setName('status')
- ->setDescription('Shows a list of locally modified packages')
- ->setDefinition([
- new InputOption('verbose', 'v|vv|vvv', InputOption::VALUE_NONE, 'Show modified files for each directory that contains changes.'),
- ])
- ->setHelp(
- <<<EOT
- The status command displays a list of dependencies that have
- been modified locally.
- Read more at https://getcomposer.org/doc/03-cli.md#status
- EOT
- )
- ;
- }
- protected function execute(InputInterface $input, OutputInterface $output): int
- {
- $composer = $this->requireComposer();
- $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'status', $input, $output);
- $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
- $composer->getEventDispatcher()->dispatchScript(ScriptEvents::PRE_STATUS_CMD, true);
- $exitCode = $this->doExecute($input);
- $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_STATUS_CMD, true);
- return $exitCode;
- }
- private function doExecute(InputInterface $input): int
- {
- $composer = $this->requireComposer();
- $installedRepo = $composer->getRepositoryManager()->getLocalRepository();
- $dm = $composer->getDownloadManager();
- $im = $composer->getInstallationManager();
- $errors = [];
- $io = $this->getIO();
- $unpushedChanges = [];
- $vcsVersionChanges = [];
- $parser = new VersionParser;
- $guesser = new VersionGuesser($composer->getConfig(), $composer->getLoop()->getProcessExecutor() ?? new ProcessExecutor($io), $parser);
- $dumper = new ArrayDumper;
- foreach ($installedRepo->getCanonicalPackages() as $package) {
- $downloader = $dm->getDownloaderForPackage($package);
- $targetDir = $im->getInstallPath($package);
- if ($downloader instanceof ChangeReportInterface) {
- if (is_link($targetDir)) {
- $errors[$targetDir] = $targetDir . ' is a symbolic link.';
- }
- if (null !== ($changes = $downloader->getLocalChanges($package, $targetDir))) {
- $errors[$targetDir] = $changes;
- }
- }
- if ($downloader instanceof VcsCapableDownloaderInterface) {
- if ($downloader->getVcsReference($package, $targetDir)) {
- switch ($package->getInstallationSource()) {
- case 'source':
- $previousRef = $package->getSourceReference();
- break;
- case 'dist':
- $previousRef = $package->getDistReference();
- break;
- default:
- $previousRef = null;
- }
- $currentVersion = $guesser->guessVersion($dumper->dump($package), $targetDir);
- if ($previousRef && $currentVersion && $currentVersion['commit'] !== $previousRef) {
- $vcsVersionChanges[$targetDir] = [
- 'previous' => [
- 'version' => $package->getPrettyVersion(),
- 'ref' => $previousRef,
- ],
- 'current' => [
- 'version' => $currentVersion['pretty_version'],
- 'ref' => $currentVersion['commit'],
- ],
- ];
- }
- }
- }
- if ($downloader instanceof DvcsDownloaderInterface) {
- if ($unpushed = $downloader->getUnpushedChanges($package, $targetDir)) {
- $unpushedChanges[$targetDir] = $unpushed;
- }
- }
- }
- if (!$errors && !$unpushedChanges && !$vcsVersionChanges) {
- $io->writeError('<info>No local changes</info>');
- return 0;
- }
- if ($errors) {
- $io->writeError('<error>You have changes in the following dependencies:</error>');
- foreach ($errors as $path => $changes) {
- if ($input->getOption('verbose')) {
- $indentedChanges = implode("\n", array_map(static function ($line): string {
- return ' ' . ltrim($line);
- }, explode("\n", $changes)));
- $io->write('<info>'.$path.'</info>:');
- $io->write($indentedChanges);
- } else {
- $io->write($path);
- }
- }
- }
- if ($unpushedChanges) {
- $io->writeError('<warning>You have unpushed changes on the current branch in the following dependencies:</warning>');
- foreach ($unpushedChanges as $path => $changes) {
- if ($input->getOption('verbose')) {
- $indentedChanges = implode("\n", array_map(static function ($line): string {
- return ' ' . ltrim($line);
- }, explode("\n", $changes)));
- $io->write('<info>'.$path.'</info>:');
- $io->write($indentedChanges);
- } else {
- $io->write($path);
- }
- }
- }
- if ($vcsVersionChanges) {
- $io->writeError('<warning>You have version variations in the following dependencies:</warning>');
- foreach ($vcsVersionChanges as $path => $changes) {
- if ($input->getOption('verbose')) {
- $currentVersion = $changes['current']['version'] ?: $changes['current']['ref'];
- $previousVersion = $changes['previous']['version'] ?: $changes['previous']['ref'];
- if ($io->isVeryVerbose()) {
- $currentVersion .= sprintf(' (%s)', $changes['current']['ref']);
- $previousVersion .= sprintf(' (%s)', $changes['previous']['ref']);
- }
- $io->write('<info>'.$path.'</info>:');
- $io->write(sprintf(' From <comment>%s</comment> to <comment>%s</comment>', $previousVersion, $currentVersion));
- } else {
- $io->write($path);
- }
- }
- }
- if (($errors || $unpushedChanges || $vcsVersionChanges) && !$input->getOption('verbose')) {
- $io->writeError('Use --verbose (-v) to see a list of files');
- }
- return ($errors ? self::EXIT_CODE_ERRORS : 0) + ($unpushedChanges ? self::EXIT_CODE_UNPUSHED_CHANGES : 0) + ($vcsVersionChanges ? self::EXIT_CODE_VERSION_CHANGES : 0);
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Command;
- use Composer\Repository\PlatformRepository;
- use Composer\Repository\RootPackageRepository;
- use Composer\Repository\InstalledRepository;
- use Composer\Installer\SuggestedPackagesReporter;
- use Composer\Console\Input\InputArgument;
- use Symfony\Component\Console\Input\InputInterface;
- use Composer\Console\Input\InputOption;
- use Symfony\Component\Console\Output\OutputInterface;
- class SuggestsCommand extends BaseCommand
- {
- use CompletionTrait;
- protected function configure(): void
- {
- $this
- ->setName('suggests')
- ->setDescription('Shows package suggestions')
- ->setDefinition([
- new InputOption('by-package', null, InputOption::VALUE_NONE, 'Groups output by suggesting package (default)'),
- new InputOption('by-suggestion', null, InputOption::VALUE_NONE, 'Groups output by suggested package'),
- new InputOption('all', 'a', InputOption::VALUE_NONE, 'Show suggestions from all dependencies, including transitive ones'),
- new InputOption('list', null, InputOption::VALUE_NONE, 'Show only list of suggested package names'),
- new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Exclude suggestions from require-dev packages'),
- new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Packages that you want to list suggestions from.', null, $this->suggestInstalledPackage()),
- ])
- ->setHelp(
- <<<EOT
- The <info>%command.name%</info> command shows a sorted list of suggested packages.
- Read more at https://getcomposer.org/doc/03-cli.md#suggests
- EOT
- )
- ;
- }
- protected function execute(InputInterface $input, OutputInterface $output): int
- {
- $composer = $this->requireComposer();
- $installedRepos = [
- new RootPackageRepository(clone $composer->getPackage()),
- ];
- $locker = $composer->getLocker();
- if ($locker->isLocked()) {
- $installedRepos[] = new PlatformRepository([], $locker->getPlatformOverrides());
- $installedRepos[] = $locker->getLockedRepository(!$input->getOption('no-dev'));
- } else {
- $installedRepos[] = new PlatformRepository([], $composer->getConfig()->get('platform'));
- $installedRepos[] = $composer->getRepositoryManager()->getLocalRepository();
- }
- $installedRepo = new InstalledRepository($installedRepos);
- $reporter = new SuggestedPackagesReporter($this->getIO());
- $filter = $input->getArgument('packages');
- $packages = $installedRepo->getPackages();
- $packages[] = $composer->getPackage();
- foreach ($packages as $package) {
- if (!empty($filter) && !in_array($package->getName(), $filter)) {
- continue;
- }
- $reporter->addSuggestionsFromPackage($package);
- }
- $mode = SuggestedPackagesReporter::MODE_BY_PACKAGE;
- if ($input->getOption('by-suggestion')) {
- $mode = SuggestedPackagesReporter::MODE_BY_SUGGESTION;
- }
- if ($input->getOption('by-package')) {
- $mode |= SuggestedPackagesReporter::MODE_BY_PACKAGE;
- }
- if ($input->getOption('list')) {
- $mode = SuggestedPackagesReporter::MODE_LIST;
- }
- $reporter->output($mode, $installedRepo, empty($filter) && !$input->getOption('all') ? $composer->getPackage() : null);
- return 0;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Command;
- use Composer\Composer;
- use Composer\DependencyResolver\Request;
- use Composer\Installer;
- use Composer\IO\IOInterface;
- use Composer\Package\Loader\RootPackageLoader;
- use Composer\Pcre\Preg;
- use Composer\Plugin\CommandEvent;
- use Composer\Plugin\PluginEvents;
- use Composer\Package\Version\VersionParser;
- use Composer\Util\HttpDownloader;
- use Composer\Advisory\Auditor;
- use Symfony\Component\Console\Helper\Table;
- use Symfony\Component\Console\Input\InputInterface;
- use Composer\Console\Input\InputOption;
- use Composer\Console\Input\InputArgument;
- use Symfony\Component\Console\Output\OutputInterface;
- use Symfony\Component\Console\Question\Question;
- class UpdateCommand extends BaseCommand
- {
- use CompletionTrait;
- protected function configure()
- {
- $this
- ->setName('update')
- ->setAliases(['u', 'upgrade'])
- ->setDescription('Updates your dependencies to the latest version according to composer.json, and updates the composer.lock file')
- ->setDefinition([
- new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Packages that should be updated, if not provided all packages are.', null, $this->suggestInstalledPackage(false)),
- 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'),
- new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
- new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist (default behavior).'),
- 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()),
- new InputOption('dry-run', null, InputOption::VALUE_NONE, 'Outputs the operations but will not execute anything (implicitly enables --verbose).'),
- new InputOption('dev', null, InputOption::VALUE_NONE, 'DEPRECATED: Enables installation of require-dev packages (enabled by default, only present for BC).'),
- new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables installation of require-dev packages.'),
- 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.'),
- new InputOption('no-install', null, InputOption::VALUE_NONE, 'Skip the install step after updating the composer.lock file.'),
- 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).'),
- new InputOption('audit-format', null, InputOption::VALUE_REQUIRED, 'Audit output format. Must be "table", "plain", "json", or "summary".', Auditor::FORMAT_SUMMARY, Auditor::FORMATS),
- new InputOption('no-autoloader', null, InputOption::VALUE_NONE, 'Skips autoloader generation'),
- new InputOption('no-suggest', null, InputOption::VALUE_NONE, 'DEPRECATED: This flag does not exist anymore.'),
- new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
- new InputOption('with-dependencies', 'w', InputOption::VALUE_NONE, 'Update also dependencies of packages in the argument list, except those which are root requirements.'),
- new InputOption('with-all-dependencies', 'W', InputOption::VALUE_NONE, 'Update also dependencies of packages in the argument list, including those which are root requirements.'),
- new InputOption('verbose', 'v|vv|vvv', InputOption::VALUE_NONE, 'Shows more details including new commits pulled in when updating packages.'),
- new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump.'),
- new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
- new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
- new InputOption('apcu-autoloader-prefix', null, InputOption::VALUE_REQUIRED, 'Use a custom prefix for the APCu autoloader cache. Implicitly enables --apcu-autoloader'),
- new InputOption('ignore-platform-req', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Ignore a specific platform requirement (php & ext- packages).'),
- new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore all platform requirements (php & ext- packages).'),
- 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).'),
- 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).'),
- new InputOption('interactive', 'i', InputOption::VALUE_NONE, 'Interactive interface with autocompletion to select the packages to update.'),
- new InputOption('root-reqs', null, InputOption::VALUE_NONE, 'Restricts the update to your first degree dependencies.'),
- ])
- ->setHelp(
- <<<EOT
- The <info>update</info> command reads the composer.json file from the
- current directory, processes it, and updates, removes or installs all the
- dependencies.
- <info>php composer.phar update</info>
- To limit the update operation to a few packages, you can list the package(s)
- you want to update as such:
- <info>php composer.phar update vendor/package1 foo/mypackage [...]</info>
- You may also use an asterisk (*) pattern to limit the update operation to package(s)
- from a specific vendor:
- <info>php composer.phar update vendor/package1 foo/* [...]</info>
- To run an update with more restrictive constraints you can use:
- <info>php composer.phar update --with vendor/package:1.0.*</info>
- To run a partial update with more restrictive constraints you can use the shorthand:
- <info>php composer.phar update vendor/package:1.0.*</info>
- To select packages names interactively with auto-completion use <info>-i</info>.
- Read more at https://getcomposer.org/doc/03-cli.md#update-u
- EOT
- )
- ;
- }
- protected function execute(InputInterface $input, OutputInterface $output)
- {
- $io = $this->getIO();
- if ($input->getOption('dev')) {
- $io->writeError('<warning>You are using the deprecated option "--dev". It has no effect and will break in Composer 3.</warning>');
- }
- if ($input->getOption('no-suggest')) {
- $io->writeError('<warning>You are using the deprecated option "--no-suggest". It has no effect and will break in Composer 3.</warning>');
- }
- $composer = $this->requireComposer();
- if (!HttpDownloader::isCurlEnabled()) {
- $io->writeError('<warning>Composer is operating significantly slower than normal because you do not have the PHP curl extension enabled.</warning>');
- }
- $packages = $input->getArgument('packages');
- $reqs = $this->formatRequirements($input->getOption('with'));
- if (count($packages) > 0) {
- $allowlistPackagesWithRequirements = array_filter($packages, static function ($pkg): bool {
- return Preg::isMatch('{\S+[ =:]\S+}', $pkg);
- });
- foreach ($this->formatRequirements($allowlistPackagesWithRequirements) as $package => $constraint) {
- $reqs[$package] = $constraint;
- }
- foreach ($allowlistPackagesWithRequirements as $package) {
- $packageName = Preg::replace('{^([^ =:]+)[ =:].*$}', '$1', $package);
- $index = array_search($package, $packages);
- $packages[$index] = $packageName;
- }
- }
- $parser = new VersionParser;
- $temporaryConstraints = [];
- foreach ($reqs as $package => $constraint) {
- $temporaryConstraints[strtolower($package)] = $parser->parseConstraints($constraint);
- }
- $rootPackage = $composer->getPackage();
- $rootPackage->setReferences(RootPackageLoader::extractReferences($reqs, $rootPackage->getReferences()));
- $rootPackage->setStabilityFlags(RootPackageLoader::extractStabilityFlags($reqs, $rootPackage->getMinimumStability(), $rootPackage->getStabilityFlags()));
- if ($input->getOption('interactive')) {
- $packages = $this->getPackagesInteractively($io, $input, $output, $composer, $packages);
- }
- if ($input->getOption('root-reqs')) {
- $requires = array_keys($rootPackage->getRequires());
- if (!$input->getOption('no-dev')) {
- $requires = array_merge($requires, array_keys($rootPackage->getDevRequires()));
- }
- if (!empty($packages)) {
- $packages = array_intersect($packages, $requires);
- } else {
- $packages = $requires;
- }
- }
- $filteredPackages = array_filter($packages, static function ($package): bool {
- return !in_array($package, ['lock', 'nothing', 'mirrors'], true);
- });
- $updateMirrors = $input->getOption('lock') || count($filteredPackages) !== count($packages);
- $packages = $filteredPackages;
- if ($updateMirrors && !empty($packages)) {
- $io->writeError('<error>You cannot simultaneously update only a selection of packages and regenerate the lock file metadata.</error>');
- return -1;
- }
- $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'update', $input, $output);
- $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
- $composer->getInstallationManager()->setOutputProgress(!$input->getOption('no-progress'));
- $install = Installer::create($io, $composer);
- $config = $composer->getConfig();
- [$preferSource, $preferDist] = $this->getPreferredInstallOptions($config, $input);
- $optimize = $input->getOption('optimize-autoloader') || $config->get('optimize-autoloader');
- $authoritative = $input->getOption('classmap-authoritative') || $config->get('classmap-authoritative');
- $apcuPrefix = $input->getOption('apcu-autoloader-prefix');
- $apcu = $apcuPrefix !== null || $input->getOption('apcu-autoloader') || $config->get('apcu-autoloader');
- $updateAllowTransitiveDependencies = Request::UPDATE_ONLY_LISTED;
- if ($input->getOption('with-all-dependencies')) {
- $updateAllowTransitiveDependencies = Request::UPDATE_LISTED_WITH_TRANSITIVE_DEPS;
- } elseif ($input->getOption('with-dependencies')) {
- $updateAllowTransitiveDependencies = Request::UPDATE_LISTED_WITH_TRANSITIVE_DEPS_NO_ROOT_REQUIRE;
- }
- $install
- ->setDryRun($input->getOption('dry-run'))
- ->setVerbose($input->getOption('verbose'))
- ->setPreferSource($preferSource)
- ->setPreferDist($preferDist)
- ->setDevMode(!$input->getOption('no-dev'))
- ->setDumpAutoloader(!$input->getOption('no-autoloader'))
- ->setOptimizeAutoloader($optimize)
- ->setClassMapAuthoritative($authoritative)
- ->setApcuAutoloader($apcu, $apcuPrefix)
- ->setUpdate(true)
- ->setInstall(!$input->getOption('no-install'))
- ->setUpdateMirrors($updateMirrors)
- ->setUpdateAllowList($packages)
- ->setUpdateAllowTransitiveDependencies($updateAllowTransitiveDependencies)
- ->setPlatformRequirementFilter($this->getPlatformRequirementFilter($input))
- ->setPreferStable($input->getOption('prefer-stable'))
- ->setPreferLowest($input->getOption('prefer-lowest'))
- ->setTemporaryConstraints($temporaryConstraints)
- ->setAudit(!$input->getOption('no-audit'))
- ->setAuditFormat($this->getAuditFormat($input))
- ;
- if ($input->getOption('no-plugins')) {
- $install->disablePlugins();
- }
- return $install->run();
- }
- private function getPackagesInteractively(IOInterface $io, InputInterface $input, OutputInterface $output, Composer $composer, array $packages): array
- {
- if (!$input->isInteractive()) {
- throw new \InvalidArgumentException('--interactive cannot be used in non-interactive terminals.');
- }
- $requires = array_merge(
- $composer->getPackage()->getRequires(),
- $composer->getPackage()->getDevRequires()
- );
- $autocompleterValues = [];
- foreach ($requires as $require) {
- $target = $require->getTarget();
- $autocompleterValues[strtolower($target)] = $target;
- }
- $installedPackages = $composer->getRepositoryManager()->getLocalRepository()->getPackages();
- foreach ($installedPackages as $package) {
- $autocompleterValues[$package->getName()] = $package->getPrettyName();
- }
- $helper = $this->getHelper('question');
- $question = new Question('<comment>Enter package name: </comment>', null);
- $io->writeError('<info>Press enter without value to end submission</info>');
- do {
- $autocompleterValues = array_diff($autocompleterValues, $packages);
- $question->setAutocompleterValues($autocompleterValues);
- $addedPackage = $helper->ask($input, $output, $question);
- if (!is_string($addedPackage) || empty($addedPackage)) {
- break;
- }
- $addedPackage = strtolower($addedPackage);
- if (!in_array($addedPackage, $packages)) {
- $packages[] = $addedPackage;
- }
- } while (true);
- $packages = array_filter($packages);
- if (!$packages) {
- throw new \InvalidArgumentException('You must enter minimum one package.');
- }
- $table = new Table($output);
- $table->setHeaders(['Selected packages']);
- foreach ($packages as $package) {
- $table->addRow([$package]);
- }
- $table->render();
- if ($io->askConfirmation(sprintf(
- 'Would you like to continue and update the above package%s [<comment>yes</comment>]? ',
- 1 === count($packages) ? '' : 's'
- ))) {
- return $packages;
- }
- throw new \RuntimeException('Installation aborted.');
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Command;
- use Composer\Factory;
- use Composer\IO\IOInterface;
- use Composer\Package\Loader\ValidatingArrayLoader;
- use Composer\Plugin\CommandEvent;
- use Composer\Plugin\PluginEvents;
- use Composer\Repository\InstalledRepository;
- use Composer\Repository\PlatformRepository;
- use Composer\Util\ConfigValidator;
- use Composer\Util\Filesystem;
- use Symfony\Component\Console\Input\InputArgument;
- use Symfony\Component\Console\Input\InputInterface;
- use Symfony\Component\Console\Input\InputOption;
- use Symfony\Component\Console\Output\OutputInterface;
- class ValidateCommand extends BaseCommand
- {
- protected function configure(): void
- {
- $this
- ->setName('validate')
- ->setDescription('Validates a composer.json and composer.lock')
- ->setDefinition([
- new InputOption('no-check-all', null, InputOption::VALUE_NONE, 'Do not validate requires for overly strict/loose constraints'),
- new InputOption('check-lock', null, InputOption::VALUE_NONE, 'Check if lock file is up to date (even when config.lock is false)'),
- new InputOption('no-check-lock', null, InputOption::VALUE_NONE, 'Do not check if lock file is up to date'),
- new InputOption('no-check-publish', null, InputOption::VALUE_NONE, 'Do not check for publish errors'),
- new InputOption('no-check-version', null, InputOption::VALUE_NONE, 'Do not report a warning if the version field is present'),
- new InputOption('with-dependencies', 'A', InputOption::VALUE_NONE, 'Also validate the composer.json of all installed dependencies'),
- new InputOption('strict', null, InputOption::VALUE_NONE, 'Return a non-zero exit code for warnings as well as errors'),
- new InputArgument('file', InputArgument::OPTIONAL, 'path to composer.json file'),
- ])
- ->setHelp(
- <<<EOT
- The validate command validates a given composer.json and composer.lock
- Exit codes in case of errors are:
- 1 validation warning(s), only when --strict is given
- 2 validation error(s)
- 3 file unreadable or missing
- Read more at https://getcomposer.org/doc/03-cli.md#validate
- EOT
- );
- }
- protected function execute(InputInterface $input, OutputInterface $output): int
- {
- $file = $input->getArgument('file') ?: Factory::getComposerFile();
- $io = $this->getIO();
- if (!file_exists($file)) {
- $io->writeError('<error>' . $file . ' not found.</error>');
- return 3;
- }
- if (!Filesystem::isReadable($file)) {
- $io->writeError('<error>' . $file . ' is not readable.</error>');
- return 3;
- }
- $validator = new ConfigValidator($io);
- $checkAll = $input->getOption('no-check-all') ? 0 : ValidatingArrayLoader::CHECK_ALL;
- $checkPublish = !$input->getOption('no-check-publish');
- $checkLock = !$input->getOption('no-check-lock');
- $checkVersion = $input->getOption('no-check-version') ? 0 : ConfigValidator::CHECK_VERSION;
- $isStrict = $input->getOption('strict');
- [$errors, $publishErrors, $warnings] = $validator->validate($file, $checkAll, $checkVersion);
- $lockErrors = [];
- $composer = Factory::create($io, $file, $input->hasParameterOption('--no-plugins'));
- $checkLock = ($checkLock && $composer->getConfig()->get('lock')) || $input->getOption('check-lock');
- $locker = $composer->getLocker();
- if ($locker->isLocked() && !$locker->isFresh()) {
- $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>`.';
- }
- if ($locker->isLocked()) {
- $missingRequirements = false;
- $sets = [
- ['repo' => $locker->getLockedRepository(false), 'method' => 'getRequires', 'description' => 'Required'],
- ['repo' => $locker->getLockedRepository(true), 'method' => 'getDevRequires', 'description' => 'Required (in require-dev)'],
- ];
- foreach ($sets as $set) {
- $installedRepo = new InstalledRepository([$set['repo']]);
- foreach (call_user_func([$composer->getPackage(), $set['method']]) as $link) {
- if (PlatformRepository::isPlatformPackage($link->getTarget())) {
- continue;
- }
- if (!$installedRepo->findPackagesWithReplacersAndProviders($link->getTarget(), $link->getConstraint())) {
- if ($results = $installedRepo->findPackagesWithReplacersAndProviders($link->getTarget())) {
- $provider = reset($results);
- $lockErrors[] = '- ' . $set['description'].' package "' . $link->getTarget() . '" is in the lock file as "'.$provider->getPrettyVersion().'" but that does not satisfy your constraint "'.$link->getPrettyConstraint().'".';
- } else {
- $lockErrors[] = '- ' . $set['description'].' package "' . $link->getTarget() . '" is not present in the lock file.';
- }
- $missingRequirements = true;
- }
- }
- }
- if ($missingRequirements) {
- $lockErrors[] = 'This usually happens when composer files are incorrectly merged or the composer.json file is manually edited.';
- $lockErrors[] = 'Read more about correctly resolving merge conflicts https://getcomposer.org/doc/articles/resolving-merge-conflicts.md';
- $lockErrors[] = 'and prefer using the "require" command over editing the composer.json file directly https://getcomposer.org/doc/03-cli.md#require';
- }
- }
- $this->outputResult($io, $file, $errors, $warnings, $checkPublish, $publishErrors, $checkLock, $lockErrors, true);
- $exitCode = $errors ? 2 : ($isStrict && $warnings ? 1 : 0);
- if ($input->getOption('with-dependencies')) {
- $localRepo = $composer->getRepositoryManager()->getLocalRepository();
- foreach ($localRepo->getPackages() as $package) {
- $path = $composer->getInstallationManager()->getInstallPath($package);
- $file = $path . '/composer.json';
- if (is_dir($path) && file_exists($file)) {
- [$errors, $publishErrors, $warnings] = $validator->validate($file, $checkAll, $checkVersion);
- $this->outputResult($io, $package->getPrettyName(), $errors, $warnings, $checkPublish, $publishErrors);
- $depCode = $errors ? 2 : ($isStrict && $warnings ? 1 : 0);
- $exitCode = max($depCode, $exitCode);
- }
- }
- }
- $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'validate', $input, $output);
- $eventCode = $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
- return max($eventCode, $exitCode);
- }
- 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
- {
- $doPrintSchemaUrl = false;
- if ($errors) {
- $io->writeError('<error>' . $name . ' is invalid, the following errors/warnings were found:</error>');
- } elseif ($publishErrors) {
- $io->writeError('<info>' . $name . ' is valid for simple usage with Composer but has</info>');
- $io->writeError('<info>strict errors that make it unable to be published as a package</info>');
- $doPrintSchemaUrl = $printSchemaUrl;
- } elseif ($warnings) {
- $io->writeError('<info>' . $name . ' is valid, but with a few warnings</info>');
- $doPrintSchemaUrl = $printSchemaUrl;
- } elseif ($lockErrors) {
- $io->write('<info>' . $name . ' is valid but your composer.lock has some '.($checkLock ? 'errors' : 'warnings').'</info>');
- } else {
- $io->write('<info>' . $name . ' is valid</info>');
- }
- if ($doPrintSchemaUrl) {
- $io->writeError('<warning>See https://getcomposer.org/doc/04-schema.md for details on the schema</warning>');
- }
- if ($errors) {
- $errors = array_map(static function ($err): string {
- return '- ' . $err;
- }, $errors);
- array_unshift($errors, '# General errors');
- }
- if ($warnings) {
- $warnings = array_map(static function ($err): string {
- return '- ' . $err;
- }, $warnings);
- array_unshift($warnings, '# General warnings');
- }
- $extraWarnings = [];
- if ($publishErrors) {
- $publishErrors = array_map(static function ($err): string {
- return '- ' . $err;
- }, $publishErrors);
- if ($checkPublish) {
- array_unshift($publishErrors, '# Publish errors');
- $errors = array_merge($errors, $publishErrors);
- } else {
- array_unshift($publishErrors, '# Publish warnings');
- $extraWarnings = array_merge($extraWarnings, $publishErrors);
- }
- }
- if ($lockErrors) {
- if ($checkLock) {
- array_unshift($lockErrors, '# Lock file errors');
- $errors = array_merge($errors, $lockErrors);
- } else {
- array_unshift($lockErrors, '# Lock file warnings');
- $extraWarnings = array_merge($extraWarnings, $lockErrors);
- }
- }
- $messages = [
- 'error' => $errors,
- 'warning' => array_merge($warnings, $extraWarnings),
- ];
- foreach ($messages as $style => $msgs) {
- foreach ($msgs as $msg) {
- if (strpos($msg, '#') === 0) {
- $io->writeError('<' . $style . '>' . $msg . '</' . $style . '>');
- } else {
- $io->writeError($msg);
- }
- }
- }
- }
- }
- <?php declare(strict_types=1);
- namespace Composer;
- use Composer\Package\Locker;
- use Composer\Pcre\Preg;
- use Composer\Plugin\PluginManager;
- use Composer\Downloader\DownloadManager;
- use Composer\Autoload\AutoloadGenerator;
- use Composer\Package\Archiver\ArchiveManager;
- class Composer extends PartialComposer
- {
- public const VERSION = '2.4.1';
- public const BRANCH_ALIAS_VERSION = '';
- public const RELEASE_DATE = '2022-08-20 11:44:50';
- public const SOURCE_VERSION = '';
- public const RUNTIME_API_VERSION = '2.2.2';
- public static function getVersion(): string
- {
- if (self::VERSION === '@package_version'.'@') {
- return self::SOURCE_VERSION;
- }
- if (self::BRANCH_ALIAS_VERSION !== '' && Preg::isMatch('{^[a-f0-9]{40}$}', self::VERSION)) {
- return self::BRANCH_ALIAS_VERSION.'+'.self::VERSION;
- }
- return self::VERSION;
- }
- private $locker;
- private $downloadManager;
- private $pluginManager;
- private $autoloadGenerator;
- private $archiveManager;
- public function setLocker(Locker $locker): void
- {
- $this->locker = $locker;
- }
- public function getLocker(): Locker
- {
- return $this->locker;
- }
- public function setDownloadManager(DownloadManager $manager): void
- {
- $this->downloadManager = $manager;
- }
- public function getDownloadManager(): DownloadManager
- {
- return $this->downloadManager;
- }
- public function setArchiveManager(ArchiveManager $manager): void
- {
- $this->archiveManager = $manager;
- }
- public function getArchiveManager(): ArchiveManager
- {
- return $this->archiveManager;
- }
- public function setPluginManager(PluginManager $manager): void
- {
- $this->pluginManager = $manager;
- }
- public function getPluginManager(): PluginManager
- {
- return $this->pluginManager;
- }
- public function setAutoloadGenerator(AutoloadGenerator $autoloadGenerator): void
- {
- $this->autoloadGenerator = $autoloadGenerator;
- }
- public function getAutoloadGenerator(): AutoloadGenerator
- {
- return $this->autoloadGenerator;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer;
- use Composer\Config\ConfigSourceInterface;
- use Composer\Downloader\TransportException;
- use Composer\IO\IOInterface;
- use Composer\Pcre\Preg;
- use Composer\Util\Platform;
- use Composer\Util\ProcessExecutor;
- class Config
- {
- public const SOURCE_DEFAULT = 'default';
- public const SOURCE_COMMAND = 'command';
- public const SOURCE_UNKNOWN = 'unknown';
- public const RELATIVE_PATHS = 1;
- public static $defaultConfig = [
- 'process-timeout' => 300,
- 'use-include-path' => false,
- 'allow-plugins' => [],
- 'use-parent-dir' => 'prompt',
- 'preferred-install' => 'dist',
- 'notify-on-install' => true,
- 'github-protocols' => ['https', 'ssh', 'git'],
- 'gitlab-protocol' => null,
- 'vendor-dir' => 'vendor',
- 'bin-dir' => '{$vendor-dir}/bin',
- 'cache-dir' => '{$home}/cache',
- 'data-dir' => '{$home}',
- 'cache-files-dir' => '{$cache-dir}/files',
- 'cache-repo-dir' => '{$cache-dir}/repo',
- 'cache-vcs-dir' => '{$cache-dir}/vcs',
- 'cache-ttl' => 15552000,
- 'cache-files-ttl' => null,
- 'cache-files-maxsize' => '300MiB',
- 'cache-read-only' => false,
- 'bin-compat' => 'auto',
- 'discard-changes' => false,
- 'autoloader-suffix' => null,
- 'sort-packages' => false,
- 'optimize-autoloader' => false,
- 'classmap-authoritative' => false,
- 'apcu-autoloader' => false,
- 'prepend-autoloader' => true,
- 'github-domains' => ['github.com'],
- 'bitbucket-expose-hostname' => true,
- 'disable-tls' => false,
- 'secure-http' => true,
- 'secure-svn-domains' => [],
- 'cafile' => null,
- 'capath' => null,
- 'github-expose-hostname' => true,
- 'gitlab-domains' => ['gitlab.com'],
- 'store-auths' => 'prompt',
- 'platform' => [],
- 'archive-format' => 'tar',
- 'archive-dir' => '.',
- 'htaccess-protect' => true,
- 'use-github-api' => true,
- 'lock' => true,
- 'platform-check' => 'php-only',
- 'bitbucket-oauth' => [],
- 'github-oauth' => [],
- 'gitlab-oauth' => [],
- 'gitlab-token' => [],
- 'http-basic' => [],
- 'bearer' => [],
- ];
- public static $defaultRepositories = [
- 'packagist.org' => [
- 'type' => 'composer',
- 'url' => 'https://repo.packagist.org',
- ],
- ];
- private $config;
- private $baseDir;
- private $repositories;
- private $configSource;
- private $authConfigSource;
- private $useEnvironment;
- private $warnedHosts = [];
- private $sslVerifyWarnedHosts = [];
- private $sourceOfConfigValue = [];
- public function __construct(bool $useEnvironment = true, ?string $baseDir = null)
- {
- $this->config = static::$defaultConfig;
- $this->repositories = static::$defaultRepositories;
- $this->useEnvironment = (bool) $useEnvironment;
- $this->baseDir = is_string($baseDir) && '' !== $baseDir ? $baseDir : null;
- foreach ($this->config as $configKey => $configValue) {
- $this->setSourceOfConfigValue($configValue, $configKey, self::SOURCE_DEFAULT);
- }
- foreach ($this->repositories as $configKey => $configValue) {
- $this->setSourceOfConfigValue($configValue, 'repositories.' . $configKey, self::SOURCE_DEFAULT);
- }
- }
- public function setConfigSource(ConfigSourceInterface $source): void
- {
- $this->configSource = $source;
- }
- public function getConfigSource(): ConfigSourceInterface
- {
- return $this->configSource;
- }
- public function setAuthConfigSource(ConfigSourceInterface $source): void
- {
- $this->authConfigSource = $source;
- }
- public function getAuthConfigSource(): ConfigSourceInterface
- {
- return $this->authConfigSource;
- }
- public function merge(array $config, string $source = self::SOURCE_UNKNOWN): void
- {
- if (!empty($config['config']) && is_array($config['config'])) {
- foreach ($config['config'] as $key => $val) {
- if (in_array($key, ['bitbucket-oauth', 'github-oauth', 'gitlab-oauth', 'gitlab-token', 'http-basic', 'bearer'], true) && isset($this->config[$key])) {
- $this->config[$key] = array_merge($this->config[$key], $val);
- $this->setSourceOfConfigValue($val, $key, $source);
- } elseif (in_array($key, ['allow-plugins'], true) && isset($this->config[$key]) && is_array($this->config[$key]) && is_array($val)) {
- $this->config[$key] = array_merge($val, $this->config[$key], $val);
- $this->setSourceOfConfigValue($val, $key, $source);
- } elseif (in_array($key, ['gitlab-domains', 'github-domains'], true) && isset($this->config[$key])) {
- $this->config[$key] = array_unique(array_merge($this->config[$key], $val));
- $this->setSourceOfConfigValue($val, $key, $source);
- } elseif ('preferred-install' === $key && isset($this->config[$key])) {
- if (is_array($val) || is_array($this->config[$key])) {
- if (is_string($val)) {
- $val = ['*' => $val];
- }
- if (is_string($this->config[$key])) {
- $this->config[$key] = ['*' => $this->config[$key]];
- $this->sourceOfConfigValue[$key . '*'] = $source;
- }
- $this->config[$key] = array_merge($this->config[$key], $val);
- $this->setSourceOfConfigValue($val, $key, $source);
- if (isset($this->config[$key]['*'])) {
- $wildcard = $this->config[$key]['*'];
- unset($this->config[$key]['*']);
- $this->config[$key]['*'] = $wildcard;
- }
- } else {
- $this->config[$key] = $val;
- $this->setSourceOfConfigValue($val, $key, $source);
- }
- } else {
- $this->config[$key] = $val;
- $this->setSourceOfConfigValue($val, $key, $source);
- }
- }
- }
- if (!empty($config['repositories']) && is_array($config['repositories'])) {
- $this->repositories = array_reverse($this->repositories, true);
- $newRepos = array_reverse($config['repositories'], true);
- foreach ($newRepos as $name => $repository) {
- if (false === $repository) {
- $this->disableRepoByName((string) $name);
- continue;
- }
- if (is_array($repository) && 1 === count($repository) && false === current($repository)) {
- $this->disableRepoByName((string) key($repository));
- continue;
- }
- if (isset($repository['type'], $repository['url']) && $repository['type'] === 'composer' && Preg::isMatch('{^https?://(?:[a-z0-9-.]+\.)?packagist.org(/|$)}', $repository['url'])) {
- $this->disableRepoByName('packagist.org');
- }
- if (is_int($name)) {
- $this->repositories[] = $repository;
- $this->setSourceOfConfigValue($repository, 'repositories.' . array_search($repository, $this->repositories, true), $source);
- } else {
- if ($name === 'packagist') {
- $this->repositories[$name . '.org'] = $repository;
- $this->setSourceOfConfigValue($repository, 'repositories.' . $name . '.org', $source);
- } else {
- $this->repositories[$name] = $repository;
- $this->setSourceOfConfigValue($repository, 'repositories.' . $name, $source);
- }
- }
- }
- $this->repositories = array_reverse($this->repositories, true);
- }
- }
- public function getRepositories(): array
- {
- return $this->repositories;
- }
- public function get(string $key, int $flags = 0)
- {
- switch ($key) {
- case 'vendor-dir':
- case 'bin-dir':
- case 'process-timeout':
- case 'data-dir':
- case 'cache-dir':
- case 'cache-files-dir':
- case 'cache-repo-dir':
- case 'cache-vcs-dir':
- case 'cafile':
- case 'capath':
- $env = 'COMPOSER_' . strtoupper(strtr($key, '-', '_'));
- $val = $this->getComposerEnv($env);
- if ($val !== false) {
- $this->setSourceOfConfigValue($val, $key, $env);
- }
- if ($key === 'process-timeout') {
- return max(0, false !== $val ? (int) $val : $this->config[$key]);
- }
- $val = rtrim((string) $this->process(false !== $val ? $val : $this->config[$key], $flags), '/\\');
- $val = Platform::expandPath($val);
- if (substr($key, -4) !== '-dir') {
- return $val;
- }
- return (($flags & self::RELATIVE_PATHS) === self::RELATIVE_PATHS) ? $val : $this->realpath($val);
- case 'cache-read-only':
- case 'htaccess-protect':
- $env = 'COMPOSER_' . strtoupper(strtr($key, '-', '_'));
- $val = $this->getComposerEnv($env);
- if (false === $val) {
- $val = $this->config[$key];
- } else {
- $this->setSourceOfConfigValue($val, $key, $env);
- }
- return $val !== 'false' && (bool) $val;
- case 'disable-tls':
- case 'secure-http':
- case 'use-github-api':
- case 'lock':
- if ($key === 'secure-http' && $this->get('disable-tls') === true) {
- return false;
- }
- return $this->config[$key] !== 'false' && (bool) $this->config[$key];
- case 'cache-ttl':
- return max(0, (int) $this->config[$key]);
- case 'cache-files-maxsize':
- if (!Preg::isMatch('/^\s*([0-9.]+)\s*(?:([kmg])(?:i?b)?)?\s*$/i', (string) $this->config[$key], $matches)) {
- throw new \RuntimeException(
- "Could not parse the value of '$key': {$this->config[$key]}"
- );
- }
- $size = (float) $matches[1];
- if (isset($matches[2])) {
- switch (strtolower($matches[2])) {
- case 'g':
- $size *= 1024;
- case 'm':
- $size *= 1024;
- case 'k':
- $size *= 1024;
- break;
- }
- }
- return max(0, (int) $size);
- case 'cache-files-ttl':
- if (isset($this->config[$key])) {
- return max(0, (int) $this->config[$key]);
- }
- return $this->get('cache-ttl');
- case 'home':
- return rtrim($this->process(Platform::expandPath($this->config[$key]), $flags), '/\\');
- case 'bin-compat':
- $value = $this->getComposerEnv('COMPOSER_BIN_COMPAT') ?: $this->config[$key];
- if (!in_array($value, ['auto', 'full', 'proxy', 'symlink'])) {
- throw new \RuntimeException(
- "Invalid value for 'bin-compat': {$value}. Expected auto, full or proxy"
- );
- }
- if ($value === 'symlink') {
- trigger_error('config.bin-compat "symlink" is deprecated since Composer 2.2, use auto, full (for Windows compatibility) or proxy instead.', E_USER_DEPRECATED);
- }
- return $value;
- case 'discard-changes':
- if ($env = $this->getComposerEnv('COMPOSER_DISCARD_CHANGES')) {
- if (!in_array($env, ['stash', 'true', 'false', '1', '0'], true)) {
- throw new \RuntimeException(
- "Invalid value for COMPOSER_DISCARD_CHANGES: {$env}. Expected 1, 0, true, false or stash"
- );
- }
- if ('stash' === $env) {
- return 'stash';
- }
- return $env !== 'false' && (bool) $env;
- }
- if (!in_array($this->config[$key], [true, false, 'stash'], true)) {
- throw new \RuntimeException(
- "Invalid value for 'discard-changes': {$this->config[$key]}. Expected true, false or stash"
- );
- }
- return $this->config[$key];
- case 'github-protocols':
- $protos = $this->config['github-protocols'];
- if ($this->config['secure-http'] && false !== ($index = array_search('git', $protos))) {
- unset($protos[$index]);
- }
- if (reset($protos) === 'http') {
- throw new \RuntimeException('The http protocol for github is not available anymore, update your config\'s github-protocols to use "https", "git" or "ssh"');
- }
- return $protos;
- case 'autoloader-suffix':
- if ($this->config[$key] === '') {
- return null;
- }
- return $this->process($this->config[$key], $flags);
- default:
- if (!isset($this->config[$key])) {
- return null;
- }
- return $this->process($this->config[$key], $flags);
- }
- }
- public function all(int $flags = 0): array
- {
- $all = [
- 'repositories' => $this->getRepositories(),
- ];
- foreach (array_keys($this->config) as $key) {
- $all['config'][$key] = $this->get($key, $flags);
- }
- return $all;
- }
- public function getSourceOfValue(string $key): string
- {
- $this->get($key);
- return $this->sourceOfConfigValue[$key] ?? self::SOURCE_UNKNOWN;
- }
- private function setSourceOfConfigValue($configValue, string $path, string $source): void
- {
- $this->sourceOfConfigValue[$path] = $source;
- if (is_array($configValue)) {
- foreach ($configValue as $key => $value) {
- $this->setSourceOfConfigValue($value, $path . '.' . $key, $source);
- }
- }
- }
- public function raw(): array
- {
- return [
- 'repositories' => $this->getRepositories(),
- 'config' => $this->config,
- ];
- }
- public function has(string $key): bool
- {
- return array_key_exists($key, $this->config);
- }
- private function process($value, int $flags)
- {
- if (!is_string($value)) {
- return $value;
- }
- return Preg::replaceCallback('#\{\$(.+)\}#', function ($match) use ($flags) {
- return $this->get($match[1], $flags);
- }, $value);
- }
- private function realpath(string $path): string
- {
- if (Preg::isMatch('{^(?:/|[a-z]:|[a-z0-9.]+://|\\\\\\\\)}i', $path)) {
- return $path;
- }
- return $this->baseDir ? $this->baseDir . '/' . $path : $path;
- }
- private function getComposerEnv(string $var)
- {
- if ($this->useEnvironment) {
- return Platform::getEnv($var);
- }
- return false;
- }
- private function disableRepoByName(string $name): void
- {
- if (isset($this->repositories[$name])) {
- unset($this->repositories[$name]);
- } elseif ($name === 'packagist') {
- unset($this->repositories['packagist.org']);
- }
- }
- public function prohibitUrlByConfig(string $url, ?IOInterface $io = null, array $repoOptions = []): void
- {
- if (false === filter_var($url, FILTER_VALIDATE_URL)) {
- return;
- }
- $scheme = parse_url($url, PHP_URL_SCHEME);
- $hostname = parse_url($url, PHP_URL_HOST);
- if (in_array($scheme, ['http', 'git', 'ftp', 'svn'])) {
- if ($this->get('secure-http')) {
- if ($scheme === 'svn') {
- if (in_array($hostname, $this->get('secure-svn-domains'), true)) {
- return;
- }
- throw new TransportException("Your configuration does not allow connections to $url. See https://getcomposer.org/doc/06-config.md#secure-svn-domains for details.");
- }
- throw new TransportException("Your configuration does not allow connections to $url. See https://getcomposer.org/doc/06-config.md#secure-http for details.");
- }
- if ($io !== null) {
- if (is_string($hostname)) {
- if (!isset($this->warnedHosts[$hostname])) {
- $io->writeError("<warning>Warning: Accessing $hostname over $scheme which is an insecure protocol.</warning>");
- }
- $this->warnedHosts[$hostname] = true;
- }
- }
- }
- if ($io !== null && is_string($hostname) && !isset($this->sslVerifyWarnedHosts[$hostname])) {
- $warning = null;
- if (isset($repoOptions['ssl']['verify_peer']) && !(bool) $repoOptions['ssl']['verify_peer']) {
- $warning = 'verify_peer';
- }
- if (isset($repoOptions['ssl']['verify_peer_name']) && !(bool) $repoOptions['ssl']['verify_peer_name']) {
- $warning = $warning === null ? 'verify_peer_name' : $warning . ' and verify_peer_name';
- }
- if ($warning !== null) {
- $io->writeError("<warning>Warning: Accessing $hostname with $warning disabled.</warning>");
- $this->sslVerifyWarnedHosts[$hostname] = true;
- }
- }
- }
- public static function disableProcessTimeout(): void
- {
- ProcessExecutor::setTimeout(0);
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Config;
- interface ConfigSourceInterface
- {
- public function addRepository(string $name, $config, bool $append = true): void;
- public function removeRepository(string $name): void;
- public function addConfigSetting(string $name, $value): void;
- public function removeConfigSetting(string $name): void;
- public function addProperty(string $name, $value): void;
- public function removeProperty(string $name): void;
- public function addLink(string $type, string $name, string $value): void;
- public function removeLink(string $type, string $name): void;
- public function getName(): string;
- }
- <?php declare(strict_types=1);
- namespace Composer\Config;
- use Composer\Json\JsonFile;
- use Composer\Json\JsonManipulator;
- use Composer\Json\JsonValidationException;
- use Composer\Pcre\Preg;
- use Composer\Util\Filesystem;
- use Composer\Util\Silencer;
- class JsonConfigSource implements ConfigSourceInterface
- {
- private $file;
- private $authConfig;
- public function __construct(JsonFile $file, bool $authConfig = false)
- {
- $this->file = $file;
- $this->authConfig = $authConfig;
- }
- public function getName(): string
- {
- return $this->file->getPath();
- }
- public function addRepository(string $name, $config, bool $append = true): void
- {
- $this->manipulateJson('addRepository', static function (&$config, $repo, $repoConfig) use ($append): void {
- if (isset($config['repositories'])) {
- foreach ($config['repositories'] as $index => $val) {
- if ($index === $repo) {
- continue;
- }
- if (is_numeric($index) && ($val === ['packagist' => false] || $val === ['packagist.org' => false])) {
- unset($config['repositories'][$index]);
- $config['repositories']['packagist.org'] = false;
- break;
- }
- }
- }
- if ($append) {
- $config['repositories'][$repo] = $repoConfig;
- } else {
- $config['repositories'] = [$repo => $repoConfig] + $config['repositories'];
- }
- }, $name, $config, $append);
- }
- public function removeRepository(string $name): void
- {
- $this->manipulateJson('removeRepository', static function (&$config, $repo): void {
- unset($config['repositories'][$repo]);
- }, $name);
- }
- public function addConfigSetting(string $name, $value): void
- {
- $authConfig = $this->authConfig;
- $this->manipulateJson('addConfigSetting', static function (&$config, $key, $val) use ($authConfig): void {
- if (Preg::isMatch('{^(bitbucket-oauth|github-oauth|gitlab-oauth|gitlab-token|bearer|http-basic|platform)\.}', $key)) {
- [$key, $host] = explode('.', $key, 2);
- if ($authConfig) {
- $config[$key][$host] = $val;
- } else {
- $config['config'][$key][$host] = $val;
- }
- } else {
- $config['config'][$key] = $val;
- }
- }, $name, $value);
- }
- public function removeConfigSetting(string $name): void
- {
- $authConfig = $this->authConfig;
- $this->manipulateJson('removeConfigSetting', static function (&$config, $key) use ($authConfig): void {
- if (Preg::isMatch('{^(bitbucket-oauth|github-oauth|gitlab-oauth|gitlab-token|bearer|http-basic|platform)\.}', $key)) {
- [$key, $host] = explode('.', $key, 2);
- if ($authConfig) {
- unset($config[$key][$host]);
- } else {
- unset($config['config'][$key][$host]);
- }
- } else {
- unset($config['config'][$key]);
- }
- }, $name);
- }
- public function addProperty(string $name, $value): void
- {
- $this->manipulateJson('addProperty', static function (&$config, $key, $val): void {
- if (strpos($key, 'extra.') === 0 || strpos($key, 'scripts.') === 0) {
- $bits = explode('.', $key);
- $last = array_pop($bits);
- $arr = &$config[reset($bits)];
- foreach ($bits as $bit) {
- if (!isset($arr[$bit])) {
- $arr[$bit] = [];
- }
- $arr = &$arr[$bit];
- }
- $arr[$last] = $val;
- } else {
- $config[$key] = $val;
- }
- }, $name, $value);
- }
- public function removeProperty(string $name): void
- {
- $this->manipulateJson('removeProperty', static function (&$config, $key): void {
- if (strpos($key, 'extra.') === 0 || strpos($key, 'scripts.') === 0) {
- $bits = explode('.', $key);
- $last = array_pop($bits);
- $arr = &$config[reset($bits)];
- foreach ($bits as $bit) {
- if (!isset($arr[$bit])) {
- return;
- }
- $arr = &$arr[$bit];
- }
- unset($arr[$last]);
- } else {
- unset($config[$key]);
- }
- }, $name);
- }
- public function addLink(string $type, string $name, string $value): void
- {
- $this->manipulateJson('addLink', static function (&$config, $type, $name, $value): void {
- $config[$type][$name] = $value;
- }, $type, $name, $value);
- }
- public function removeLink(string $type, string $name): void
- {
- $this->manipulateJson('removeSubNode', static function (&$config, $type, $name): void {
- unset($config[$type][$name]);
- }, $type, $name);
- $this->manipulateJson('removeMainKeyIfEmpty', static function (&$config, $type): void {
- if (0 === count($config[$type])) {
- unset($config[$type]);
- }
- }, $type);
- }
- private function manipulateJson(string $method, callable $fallback, ...$args): void
- {
- if ($this->file->exists()) {
- if (!is_writable($this->file->getPath())) {
- throw new \RuntimeException(sprintf('The file "%s" is not writable.', $this->file->getPath()));
- }
- if (!Filesystem::isReadable($this->file->getPath())) {
- throw new \RuntimeException(sprintf('The file "%s" is not readable.', $this->file->getPath()));
- }
- $contents = file_get_contents($this->file->getPath());
- } elseif ($this->authConfig) {
- $contents = "{\n}\n";
- } else {
- $contents = "{\n \"config\": {\n }\n}\n";
- }
- $manipulator = new JsonManipulator($contents);
- $newFile = !$this->file->exists();
- if ($this->authConfig && $method === 'addConfigSetting') {
- $method = 'addSubNode';
- [$mainNode, $name] = explode('.', $args[0], 2);
- $args = [$mainNode, $name, $args[1]];
- } elseif ($this->authConfig && $method === 'removeConfigSetting') {
- $method = 'removeSubNode';
- [$mainNode, $name] = explode('.', $args[0], 2);
- $args = [$mainNode, $name];
- }
- if (call_user_func_array([$manipulator, $method], $args)) {
- file_put_contents($this->file->getPath(), $manipulator->getContents());
- } else {
- $config = $this->file->read();
- $this->arrayUnshiftRef($args, $config);
- $fallback(...$args);
- foreach (['require', 'require-dev', 'conflict', 'provide', 'replace', 'suggest', 'config', 'autoload', 'autoload-dev', 'scripts', 'scripts-descriptions', 'support'] as $prop) {
- if (isset($config[$prop]) && $config[$prop] === []) {
- $config[$prop] = new \stdClass;
- }
- }
- foreach (['psr-0', 'psr-4'] as $prop) {
- if (isset($config['autoload'][$prop]) && $config['autoload'][$prop] === []) {
- $config['autoload'][$prop] = new \stdClass;
- }
- if (isset($config['autoload-dev'][$prop]) && $config['autoload-dev'][$prop] === []) {
- $config['autoload-dev'][$prop] = new \stdClass;
- }
- }
- foreach (['platform', 'http-basic', 'bearer', 'gitlab-token', 'gitlab-oauth', 'github-oauth', 'preferred-install'] as $prop) {
- if (isset($config['config'][$prop]) && $config['config'][$prop] === []) {
- $config['config'][$prop] = new \stdClass;
- }
- }
- $this->file->write($config);
- }
- try {
- $this->file->validateSchema(JsonFile::LAX_SCHEMA);
- } catch (JsonValidationException $e) {
- file_put_contents($this->file->getPath(), $contents);
- 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);
- }
- if ($newFile) {
- Silencer::call('chmod', $this->file->getPath(), 0600);
- }
- }
- private function arrayUnshiftRef(array &$array, &$value): int
- {
- $return = array_unshift($array, '');
- $array[0] = &$value;
- return $return;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Console;
- use Composer\IO\NullIO;
- use Composer\Util\Filesystem;
- use Composer\Util\Platform;
- use Composer\Util\Silencer;
- use LogicException;
- use Seld\Signal\SignalHandler;
- use Symfony\Component\Console\Application as BaseApplication;
- use Symfony\Component\Console\Exception\CommandNotFoundException;
- use Symfony\Component\Console\Helper\HelperSet;
- use Symfony\Component\Console\Helper\QuestionHelper;
- use Symfony\Component\Console\Input\InputDefinition;
- use Symfony\Component\Console\Input\InputInterface;
- use Symfony\Component\Console\Input\InputOption;
- use Symfony\Component\Console\Output\ConsoleOutputInterface;
- use Symfony\Component\Console\Output\OutputInterface;
- use Seld\JsonLint\ParsingException;
- use Composer\Command;
- use Composer\Composer;
- use Composer\Factory;
- use Composer\IO\IOInterface;
- use Composer\IO\ConsoleIO;
- use Composer\Json\JsonValidationException;
- use Composer\Util\ErrorHandler;
- use Composer\Util\HttpDownloader;
- use Composer\EventDispatcher\ScriptExecutionException;
- use Composer\Exception\NoSslException;
- use Composer\XdebugHandler\XdebugHandler;
- use Symfony\Component\Process\Exception\ProcessTimedOutException;
- class Application extends BaseApplication
- {
- protected $composer;
- protected $io;
- private static $logo = ' ______
- / ____/___ ____ ___ ____ ____ ________ _____
- / / / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
- / /___/ /_/ / / / / / / /_/ / /_/ (__ ) __/ /
- \____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
- /_/
- ';
- private $hasPluginCommands = false;
- private $disablePluginsByDefault = false;
- private $disableScriptsByDefault = false;
- private $initialWorkingDirectory;
- private $signalHandler;
- public function __construct()
- {
- static $shutdownRegistered = false;
- if (function_exists('ini_set') && extension_loaded('xdebug')) {
- ini_set('xdebug.show_exception_trace', '0');
- ini_set('xdebug.scream', '0');
- }
- if (function_exists('date_default_timezone_set') && function_exists('date_default_timezone_get')) {
- date_default_timezone_set(Silencer::call('date_default_timezone_get'));
- }
- $this->io = new NullIO();
- $this->signalHandler = SignalHandler::create([SignalHandler::SIGINT, SignalHandler::SIGTERM, SignalHandler::SIGHUP], function (string $signal, SignalHandler $handler) {
- $this->io->writeError('Received '.$signal.', aborting', true, IOInterface::DEBUG);
- $handler->exitWithLastSignal();
- });
- if (!$shutdownRegistered) {
- $shutdownRegistered = true;
- register_shutdown_function(static function (): void {
- $lastError = error_get_last();
- if ($lastError && $lastError['message'] &&
- (strpos($lastError['message'], 'Allowed memory') !== false ||
- strpos($lastError['message'], 'exceeded memory') !== false )) {
- echo "\n". 'Check https://getcomposer.org/doc/articles/troubleshooting.md#memory-limit-errors for more info on how to handle out of memory errors.';
- }
- });
- }
- $this->initialWorkingDirectory = getcwd();
- parent::__construct('Composer', Composer::getVersion());
- }
- public function __destruct()
- {
- $this->signalHandler->unregister();
- }
- public function run(?InputInterface $input = null, ?OutputInterface $output = null): int
- {
- if (null === $output) {
- $output = Factory::createOutput();
- }
- return parent::run($input, $output);
- }
- public function doRun(InputInterface $input, OutputInterface $output): int
- {
- $this->disablePluginsByDefault = $input->hasParameterOption('--no-plugins');
- $this->disableScriptsByDefault = $input->hasParameterOption('--no-scripts');
- $stdin = defined('STDIN') ? STDIN : fopen('php://stdin', 'r');
- if (Platform::getEnv('COMPOSER_NO_INTERACTION') || $stdin === false || !Platform::isTty($stdin)) {
- $input->setInteractive(false);
- }
- $io = $this->io = new ConsoleIO($input, $output, new HelperSet([
- new QuestionHelper(),
- ]));
- ErrorHandler::register($io);
- if ($input->hasParameterOption('--no-cache')) {
- $io->writeError('Disabling cache usage', true, IOInterface::DEBUG);
- Platform::putEnv('COMPOSER_CACHE_DIR', Platform::isWindows() ? 'nul' : '/dev/null');
- }
- $newWorkDir = $this->getNewWorkingDir($input);
- if (null !== $newWorkDir) {
- $oldWorkingDir = Platform::getCwd(true);
- chdir($newWorkDir);
- $this->initialWorkingDirectory = $newWorkDir;
- $cwd = Platform::getCwd(true);
- $io->writeError('Changed CWD to ' . ($cwd !== '' ? $cwd : $newWorkDir), true, IOInterface::DEBUG);
- }
- $commandName = '';
- if ($name = $this->getCommandName($input)) {
- try {
- $commandName = $this->find($name)->getName();
- } catch (CommandNotFoundException $e) {
- $commandName = false;
- } catch (\InvalidArgumentException $e) {
- }
- }
- if ($io->isInteractive() && null === $newWorkDir && !in_array($commandName, ['', 'list', 'init', 'about', 'help', 'diagnose', 'self-update', 'global', 'create-project', 'outdated'], true) && !file_exists(Factory::getComposerFile()) && ($useParentDirIfNoJsonAvailable = $this->getUseParentDirConfigValue()) !== false) {
- $dir = dirname(Platform::getCwd(true));
- $home = realpath(Platform::getEnv('HOME') ?: Platform::getEnv('USERPROFILE') ?: '/');
- while (dirname($dir) !== $dir && $dir !== $home) {
- if (file_exists($dir.'/'.Factory::getComposerFile())) {
- 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>]? ')) {
- if ($useParentDirIfNoJsonAvailable === true) {
- $io->writeError('<info>No composer.json in current directory, changing working directory to '.$dir.'</info>');
- } else {
- $io->writeError('<info>Always want to use the parent dir? Use "composer config --global use-parent-dir true" to change the default.</info>');
- }
- $oldWorkingDir = Platform::getCwd(true);
- chdir($dir);
- }
- break;
- }
- $dir = dirname($dir);
- }
- }
- $mayNeedPluginCommand = false === $input->hasParameterOption(['--version', '-V'])
- && (
- false === $commandName
- || in_array($commandName, ['', 'list', 'help'], true)
- );
- if ($mayNeedPluginCommand && !$this->disablePluginsByDefault && !$this->hasPluginCommands) {
- try {
- foreach ($this->getPluginCommands() as $command) {
- if ($this->has($command->getName())) {
- $io->writeError('<warning>Plugin command '.$command->getName().' ('.get_class($command).') would override a Composer command and has been skipped</warning>');
- } else {
- $this->add($command);
- }
- }
- } catch (NoSslException $e) {
- } catch (ParsingException $e) {
- $details = $e->getDetails();
- $file = realpath(Factory::getComposerFile());
- $line = null;
- if ($details && isset($details['line'])) {
- $line = $details['line'];
- }
- $ghe = new GithubActionError($this->io);
- $ghe->emit($e->getMessage(), $file, $line);
- throw $e;
- }
- $this->hasPluginCommands = true;
- }
- $isProxyCommand = false;
- if ($name = $this->getCommandName($input)) {
- try {
- $command = $this->find($name);
- $commandName = $command->getName();
- $isProxyCommand = ($command instanceof Command\BaseCommand && $command->isProxyCommand());
- } catch (\InvalidArgumentException $e) {
- }
- }
- if (!$isProxyCommand) {
- $io->writeError(sprintf(
- 'Running %s (%s) with %s on %s',
- Composer::getVersion(),
- Composer::RELEASE_DATE,
- defined('HHVM_VERSION') ? 'HHVM '.HHVM_VERSION : 'PHP '.PHP_VERSION,
- function_exists('php_uname') ? php_uname('s') . ' / ' . php_uname('r') : 'Unknown OS'
- ), true, IOInterface::DEBUG);
- if (PHP_VERSION_ID < 70205) {
- $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>');
- }
- if (XdebugHandler::isXdebugActive() && !Platform::getEnv('COMPOSER_DISABLE_XDEBUG_WARN')) {
- $io->writeError('<warning>Composer is operating slower than normal because you have Xdebug enabled. See https://getcomposer.org/xdebug</warning>');
- }
- if (defined('COMPOSER_DEV_WARNING_TIME') && $commandName !== 'self-update' && $commandName !== 'selfupdate' && time() > COMPOSER_DEV_WARNING_TIME) {
- $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']));
- }
- if (
- !Platform::isWindows()
- && function_exists('exec')
- && !Platform::getEnv('COMPOSER_ALLOW_SUPERUSER')
- && (ini_get('open_basedir') || !file_exists('/.dockerenv'))
- ) {
- if (function_exists('posix_getuid') && posix_getuid() === 0) {
- if ($commandName !== 'self-update' && $commandName !== 'selfupdate') {
- $io->writeError('<warning>Do not run Composer as root/super user! See https://getcomposer.org/root for details</warning>');
- if ($io->isInteractive()) {
- if (!$io->askConfirmation('<info>Continue as root/super user</info> [<comment>yes</comment>]? ')) {
- return 1;
- }
- }
- }
- if ($uid = (int) Platform::getEnv('SUDO_UID')) {
- Silencer::call('exec', "sudo -u \\#{$uid} sudo -K > /dev/null 2>&1");
- }
- }
- Silencer::call('exec', 'sudo -K > /dev/null 2>&1');
- }
- Silencer::call(static function () use ($io): void {
- $tempfile = sys_get_temp_dir() . '/temp-' . md5(microtime());
- if (!(file_put_contents($tempfile, __FILE__) && (file_get_contents($tempfile) === __FILE__) && unlink($tempfile) && !file_exists($tempfile))) {
- $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()));
- }
- });
- $file = Factory::getComposerFile();
- if (is_file($file) && Filesystem::isReadable($file) && is_array($composer = json_decode(file_get_contents($file), true))) {
- if (isset($composer['scripts']) && is_array($composer['scripts'])) {
- foreach ($composer['scripts'] as $script => $dummy) {
- if (!defined('Composer\Script\ScriptEvents::'.str_replace('-', '_', strtoupper($script)))) {
- if ($this->has($script)) {
- $io->writeError('<warning>A script named '.$script.' would override a Composer command and has been skipped</warning>');
- } else {
- $description = null;
- if (isset($composer['scripts-descriptions'][$script])) {
- $description = $composer['scripts-descriptions'][$script];
- }
- $this->add(new Command\ScriptAliasCommand($script, $description));
- }
- }
- }
- }
- }
- }
- try {
- if ($input->hasParameterOption('--profile')) {
- $startTime = microtime(true);
- $this->io->enableDebugging($startTime);
- }
- $result = parent::doRun($input, $output);
- if (isset($oldWorkingDir) && '' !== $oldWorkingDir) {
- Silencer::call('chdir', $oldWorkingDir);
- }
- if (isset($startTime)) {
- $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');
- }
- return $result;
- } catch (ScriptExecutionException $e) {
- return $e->getCode();
- } catch (\Throwable $e) {
- $ghe = new GithubActionError($this->io);
- $ghe->emit($e->getMessage());
- $this->hintCommonErrors($e, $output);
- if (!$e instanceof \Exception) {
- if ($output instanceof ConsoleOutputInterface) {
- $this->renderThrowable($e, $output->getErrorOutput());
- } else {
- $this->renderThrowable($e, $output);
- }
- $exitCode = $e->getCode();
- if (is_numeric($exitCode)) {
- $exitCode = (int) $exitCode;
- if (0 === $exitCode) {
- $exitCode = 1;
- }
- } else {
- $exitCode = 1;
- }
- return $exitCode;
- }
- throw $e;
- } finally {
- restore_error_handler();
- }
- }
- private function getNewWorkingDir(InputInterface $input): ?string
- {
- $workingDir = $input->getParameterOption(['--working-dir', '-d'], null, true);
- if (null !== $workingDir && !is_dir($workingDir)) {
- throw new \RuntimeException('Invalid working directory specified, '.$workingDir.' does not exist.');
- }
- return $workingDir;
- }
- private function hintCommonErrors(\Throwable $exception, OutputInterface $output): void
- {
- $io = $this->getIO();
- if ((get_class($exception) === LogicException::class || $exception instanceof \Error) && $output->getVerbosity() < OutputInterface::VERBOSITY_VERBOSE) {
- $output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE);
- }
- Silencer::suppress();
- try {
- $composer = $this->getComposer(false, true);
- if (null !== $composer && function_exists('disk_free_space')) {
- $config = $composer->getConfig();
- $minSpaceFree = 1024 * 1024;
- if ((($df = disk_free_space($dir = $config->get('home'))) !== false && $df < $minSpaceFree)
- || (($df = disk_free_space($dir = $config->get('vendor-dir'))) !== false && $df < $minSpaceFree)
- || (($df = disk_free_space($dir = sys_get_temp_dir())) !== false && $df < $minSpaceFree)
- ) {
- $io->writeError('<error>The disk hosting '.$dir.' is full, this may be the cause of the following exception</error>', true, IOInterface::QUIET);
- }
- }
- } catch (\Exception $e) {
- }
- Silencer::restore();
- if (Platform::isWindows() && false !== strpos($exception->getMessage(), 'The system cannot find the path specified')) {
- $io->writeError('<error>The following exception may be caused by a stale entry in your cmd.exe AutoRun</error>', true, IOInterface::QUIET);
- $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);
- }
- if (false !== strpos($exception->getMessage(), 'fork failed - Cannot allocate memory')) {
- $io->writeError('<error>The following exception is caused by a lack of memory or swap, or not having swap configured</error>', true, IOInterface::QUIET);
- $io->writeError('<error>Check https://getcomposer.org/doc/articles/troubleshooting.md#proc-open-fork-failed-errors for details</error>', true, IOInterface::QUIET);
- }
- if ($exception instanceof ProcessTimedOutException) {
- $io->writeError('<error>The following exception is caused by a process timeout</error>', true, IOInterface::QUIET);
- $io->writeError('<error>Check https://getcomposer.org/doc/06-config.md#process-timeout for details</error>', true, IOInterface::QUIET);
- }
- $hints = HttpDownloader::getExceptionHints($exception);
- if (null !== $hints && count($hints) > 0) {
- foreach ($hints as $hint) {
- $io->writeError($hint, true, IOInterface::QUIET);
- }
- }
- }
- public function getComposer(bool $required = true, ?bool $disablePlugins = null, ?bool $disableScripts = null): ?Composer
- {
- if (null === $disablePlugins) {
- $disablePlugins = $this->disablePluginsByDefault;
- }
- if (null === $disableScripts) {
- $disableScripts = $this->disableScriptsByDefault;
- }
- if (null === $this->composer) {
- try {
- $this->composer = Factory::create(Platform::isInputCompletionProcess() ? new NullIO() : $this->io, null, $disablePlugins, $disableScripts);
- } catch (\InvalidArgumentException $e) {
- if ($required) {
- $this->io->writeError($e->getMessage());
- if ($this->areExceptionsCaught()) {
- exit(1);
- }
- throw $e;
- }
- } catch (JsonValidationException $e) {
- if ($required) {
- throw $e;
- }
- }
- }
- return $this->composer;
- }
- public function resetComposer(): void
- {
- $this->composer = null;
- if (method_exists($this->getIO(), 'resetAuthentications')) {
- $this->getIO()->resetAuthentications();
- }
- }
- public function getIO(): IOInterface
- {
- return $this->io;
- }
- public function getHelp(): string
- {
- return self::$logo . parent::getHelp();
- }
- protected function getDefaultCommands(): array
- {
- $commands = array_merge(parent::getDefaultCommands(), [
- new Command\AboutCommand(),
- new Command\ConfigCommand(),
- new Command\DependsCommand(),
- new Command\ProhibitsCommand(),
- new Command\InitCommand(),
- new Command\InstallCommand(),
- new Command\CreateProjectCommand(),
- new Command\UpdateCommand(),
- new Command\SearchCommand(),
- new Command\ValidateCommand(),
- new Command\AuditCommand(),
- new Command\ShowCommand(),
- new Command\SuggestsCommand(),
- new Command\RequireCommand(),
- new Command\DumpAutoloadCommand(),
- new Command\StatusCommand(),
- new Command\ArchiveCommand(),
- new Command\DiagnoseCommand(),
- new Command\RunScriptCommand(),
- new Command\LicensesCommand(),
- new Command\GlobalCommand(),
- new Command\ClearCacheCommand(),
- new Command\RemoveCommand(),
- new Command\HomeCommand(),
- new Command\ExecCommand(),
- new Command\OutdatedCommand(),
- new Command\CheckPlatformReqsCommand(),
- new Command\FundCommand(),
- new Command\ReinstallCommand(),
- new Command\BumpCommand(),
- ]);
- if (strpos(__FILE__, 'phar:') === 0 || '1' === Platform::getEnv('COMPOSER_TESTS_ARE_RUNNING')) {
- $commands[] = new Command\SelfUpdateCommand();
- }
- return $commands;
- }
- public function getLongVersion(): string
- {
- $branchAliasString = '';
- if (Composer::BRANCH_ALIAS_VERSION && Composer::BRANCH_ALIAS_VERSION !== '@package_branch_alias_version'.'@') {
- $branchAliasString = sprintf(' (%s)', Composer::BRANCH_ALIAS_VERSION);
- }
- return sprintf(
- '<info>%s</info> version <comment>%s%s</comment> %s',
- $this->getName(),
- $this->getVersion(),
- $branchAliasString,
- Composer::RELEASE_DATE
- );
- }
- protected function getDefaultInputDefinition(): InputDefinition
- {
- $definition = parent::getDefaultInputDefinition();
- $definition->addOption(new InputOption('--profile', null, InputOption::VALUE_NONE, 'Display timing and memory usage information'));
- $definition->addOption(new InputOption('--no-plugins', null, InputOption::VALUE_NONE, 'Whether to disable plugins.'));
- $definition->addOption(new InputOption('--no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'));
- $definition->addOption(new InputOption('--working-dir', '-d', InputOption::VALUE_REQUIRED, 'If specified, use the given directory as working directory.'));
- $definition->addOption(new InputOption('--no-cache', null, InputOption::VALUE_NONE, 'Prevent use of the cache'));
- return $definition;
- }
- private function getPluginCommands(): array
- {
- $commands = [];
- $composer = $this->getComposer(false, false);
- if (null === $composer) {
- $composer = Factory::createGlobal($this->io, $this->disablePluginsByDefault, $this->disableScriptsByDefault);
- }
- if (null !== $composer) {
- $pm = $composer->getPluginManager();
- foreach ($pm->getPluginCapabilities('Composer\Plugin\Capability\CommandProvider', ['composer' => $composer, 'io' => $this->io]) as $capability) {
- $newCommands = $capability->getCommands();
- if (!is_array($newCommands)) {
- throw new \UnexpectedValueException('Plugin capability '.get_class($capability).' failed to return an array from getCommands');
- }
- foreach ($newCommands as $command) {
- if (!$command instanceof Command\BaseCommand) {
- throw new \UnexpectedValueException('Plugin capability '.get_class($capability).' returned an invalid value, we expected an array of Composer\Command\BaseCommand objects');
- }
- }
- $commands = array_merge($commands, $newCommands);
- }
- }
- return $commands;
- }
- public function getInitialWorkingDirectory()
- {
- return $this->initialWorkingDirectory;
- }
- private function getUseParentDirConfigValue()
- {
- $config = Factory::createConfig($this->io);
- return $config->get('use-parent-dir');
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Console;
- use Composer\IO\IOInterface;
- use Composer\Util\Platform;
- final class GithubActionError
- {
- protected $io;
- public function __construct(IOInterface $io)
- {
- $this->io = $io;
- }
- public function emit(string $message, ?string $file = null, ?int $line = null): void
- {
- if (Platform::getEnv('GITHUB_ACTIONS') && !Platform::getEnv('COMPOSER_TESTS_ARE_RUNNING')) {
- $message = $this->escapeData($message);
- if ($file && $line) {
- $file = $this->escapeProperty($file);
- $this->io->write("::error file=". $file .",line=". $line ."::". $message);
- } elseif ($file) {
- $file = $this->escapeProperty($file);
- $this->io->write("::error file=". $file ."::". $message);
- } else {
- $this->io->write("::error ::". $message);
- }
- }
- }
- private function escapeData(string $data): string
- {
- $data = str_replace("%", '%25', $data);
- $data = str_replace("\r", '%0D', $data);
- $data = str_replace("\n", '%0A', $data);
- return $data;
- }
- private function escapeProperty(string $property): string
- {
- $property = str_replace("%", '%25', $property);
- $property = str_replace("\r", '%0D', $property);
- $property = str_replace("\n", '%0A', $property);
- $property = str_replace(":", '%3A', $property);
- $property = str_replace(",", '%2C', $property);
- return $property;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Console;
- use Closure;
- use Composer\Pcre\Preg;
- use Symfony\Component\Console\Formatter\OutputFormatter;
- use Symfony\Component\Console\Formatter\OutputFormatterStyle;
- class HtmlOutputFormatter extends OutputFormatter
- {
- private static $availableForegroundColors = [
- 30 => 'black',
- 31 => 'red',
- 32 => 'green',
- 33 => 'yellow',
- 34 => 'blue',
- 35 => 'magenta',
- 36 => 'cyan',
- 37 => 'white',
- ];
- private static $availableBackgroundColors = [
- 40 => 'black',
- 41 => 'red',
- 42 => 'green',
- 43 => 'yellow',
- 44 => 'blue',
- 45 => 'magenta',
- 46 => 'cyan',
- 47 => 'white',
- ];
- private static $availableOptions = [
- 1 => 'bold',
- 4 => 'underscore',
- ];
- public function __construct(array $styles = [])
- {
- parent::__construct(true, $styles);
- }
- public function format(?string $message): ?string
- {
- $formatted = parent::format($message);
- if ($formatted === null) {
- return null;
- }
- $clearEscapeCodes = '(?:39|49|0|22|24|25|27|28)';
- return Preg::replaceCallback("{\033\[([0-9;]+)m(.*?)\033\[(?:".$clearEscapeCodes.";)*?".$clearEscapeCodes."m}s", Closure::fromCallable([$this, 'formatHtml']), $formatted);
- }
- private function formatHtml(array $matches): string
- {
- $out = '<span style="';
- foreach (explode(';', $matches[1]) as $code) {
- if (isset(self::$availableForegroundColors[(int) $code])) {
- $out .= 'color:'.self::$availableForegroundColors[(int) $code].';';
- } elseif (isset(self::$availableBackgroundColors[(int) $code])) {
- $out .= 'background-color:'.self::$availableBackgroundColors[(int) $code].';';
- } elseif (isset(self::$availableOptions[(int) $code])) {
- switch (self::$availableOptions[(int) $code]) {
- case 'bold':
- $out .= 'font-weight:bold;';
- break;
- case 'underscore':
- $out .= 'text-decoration:underline;';
- break;
- }
- }
- }
- return $out.'">'.$matches[2].'</span>';
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Console\Input;
- use Symfony\Component\Console\Completion\CompletionInput;
- use Symfony\Component\Console\Completion\CompletionSuggestions;
- use Symfony\Component\Console\Completion\Suggestion;
- use Symfony\Component\Console\Exception\InvalidArgumentException;
- use Symfony\Component\Console\Exception\LogicException;
- use Symfony\Component\Console\Input\InputArgument as BaseInputArgument;
- class InputArgument extends BaseInputArgument
- {
- private $suggestedValues;
- public function __construct(string $name, ?int $mode = null, string $description = '', $default = null, $suggestedValues = [])
- {
- parent::__construct($name, $mode, $description, $default);
- $this->suggestedValues = $suggestedValues;
- }
- public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void
- {
- $values = $this->suggestedValues;
- if ($values instanceof \Closure && !\is_array($values = $values($input, $suggestions))) {
- throw new LogicException(sprintf('Closure for option "%s" must return an array. Got "%s".', $this->getName(), get_debug_type($values)));
- }
- if ([] !== $values) {
- $suggestions->suggestValues($values);
- }
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Console\Input;
- use Symfony\Component\Console\Completion\CompletionInput;
- use Symfony\Component\Console\Completion\CompletionSuggestions;
- use Symfony\Component\Console\Completion\Suggestion;
- use Symfony\Component\Console\Exception\InvalidArgumentException;
- use Symfony\Component\Console\Exception\LogicException;
- use Symfony\Component\Console\Input\InputOption as BaseInputOption;
- class InputOption extends BaseInputOption
- {
- private $suggestedValues;
- public function __construct(string $name, $shortcut = null, ?int $mode = null, string $description = '', $default = null, $suggestedValues = [])
- {
- parent::__construct($name, $shortcut, $mode, $description, $default);
- $this->suggestedValues = $suggestedValues;
- if ([] !== $suggestedValues && !$this->acceptValue()) {
- throw new LogicException('Cannot set suggested values if the option does not accept a value.');
- }
- }
- public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void
- {
- $values = $this->suggestedValues;
- if ($values instanceof \Closure && !\is_array($values = $values($input, $suggestions))) {
- throw new LogicException(sprintf('Closure for argument "%s" must return an array. Got "%s".', $this->getName(), get_debug_type($values)));
- }
- if ([] !== $values) {
- $suggestions->suggestValues($values);
- }
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\DependencyResolver;
- class Decisions implements \Iterator, \Countable
- {
- public const DECISION_LITERAL = 0;
- public const DECISION_REASON = 1;
- protected $pool;
- protected $decisionMap;
- protected $decisionQueue = [];
- public function __construct(Pool $pool)
- {
- $this->pool = $pool;
- $this->decisionMap = [];
- }
- public function decide(int $literal, int $level, Rule $why): void
- {
- $this->addDecision($literal, $level);
- $this->decisionQueue[] = [
- self::DECISION_LITERAL => $literal,
- self::DECISION_REASON => $why,
- ];
- }
- public function satisfy(int $literal): bool
- {
- $packageId = abs($literal);
- return (
- $literal > 0 && isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] > 0 ||
- $literal < 0 && isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] < 0
- );
- }
- public function conflict(int $literal): bool
- {
- $packageId = abs($literal);
- return (
- (isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] > 0 && $literal < 0) ||
- (isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] < 0 && $literal > 0)
- );
- }
- public function decided(int $literalOrPackageId): bool
- {
- return !empty($this->decisionMap[abs($literalOrPackageId)]);
- }
- public function undecided(int $literalOrPackageId): bool
- {
- return empty($this->decisionMap[abs($literalOrPackageId)]);
- }
- public function decidedInstall(int $literalOrPackageId): bool
- {
- $packageId = abs($literalOrPackageId);
- return isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] > 0;
- }
- public function decisionLevel(int $literalOrPackageId): int
- {
- $packageId = abs($literalOrPackageId);
- if (isset($this->decisionMap[$packageId])) {
- return abs($this->decisionMap[$packageId]);
- }
- return 0;
- }
- public function decisionRule(int $literalOrPackageId): ?Rule
- {
- $packageId = abs($literalOrPackageId);
- foreach ($this->decisionQueue as $decision) {
- if ($packageId === abs($decision[self::DECISION_LITERAL])) {
- return $decision[self::DECISION_REASON];
- }
- }
- return null;
- }
- public function atOffset(int $queueOffset): array
- {
- return $this->decisionQueue[$queueOffset];
- }
- public function validOffset(int $queueOffset): bool
- {
- return $queueOffset >= 0 && $queueOffset < \count($this->decisionQueue);
- }
- public function lastReason(): Rule
- {
- return $this->decisionQueue[\count($this->decisionQueue) - 1][self::DECISION_REASON];
- }
- public function lastLiteral(): int
- {
- return $this->decisionQueue[\count($this->decisionQueue) - 1][self::DECISION_LITERAL];
- }
- public function reset(): void
- {
- while ($decision = array_pop($this->decisionQueue)) {
- $this->decisionMap[abs($decision[self::DECISION_LITERAL])] = 0;
- }
- }
- public function resetToOffset(int $offset): void
- {
- while (\count($this->decisionQueue) > $offset + 1) {
- $decision = array_pop($this->decisionQueue);
- $this->decisionMap[abs($decision[self::DECISION_LITERAL])] = 0;
- }
- }
- public function revertLast(): void
- {
- $this->decisionMap[abs($this->lastLiteral())] = 0;
- array_pop($this->decisionQueue);
- }
- public function count(): int
- {
- return \count($this->decisionQueue);
- }
- public function rewind(): void
- {
- end($this->decisionQueue);
- }
- #[\ReturnTypeWillChange]
- public function current()
- {
- return current($this->decisionQueue);
- }
- public function key(): ?int
- {
- return key($this->decisionQueue);
- }
- public function next(): void
- {
- prev($this->decisionQueue);
- }
- public function valid(): bool
- {
- return false !== current($this->decisionQueue);
- }
- public function isEmpty(): bool
- {
- return \count($this->decisionQueue) === 0;
- }
- protected function addDecision(int $literal, int $level): void
- {
- $packageId = abs($literal);
- $previousDecision = $this->decisionMap[$packageId] ?? 0;
- if ($previousDecision !== 0) {
- $literalString = $this->pool->literalToPrettyString($literal, []);
- $package = $this->pool->literalToPackage($literal);
- throw new SolverBugException(
- "Trying to decide $literalString on level $level, even though $package was previously decided as ".$previousDecision."."
- );
- }
- if ($literal > 0) {
- $this->decisionMap[$packageId] = $level;
- } else {
- $this->decisionMap[$packageId] = -$level;
- }
- }
- public function toString(?Pool $pool = null): string
- {
- $decisionMap = $this->decisionMap;
- ksort($decisionMap);
- $str = '[';
- foreach ($decisionMap as $packageId => $level) {
- $str .= (($pool) ? $pool->literalToPackage($packageId) : $packageId).':'.$level.',';
- }
- $str .= ']';
- return $str;
- }
- public function __toString(): string
- {
- return $this->toString();
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\DependencyResolver;
- use Composer\Package\AliasPackage;
- use Composer\Package\BasePackage;
- use Composer\Package\PackageInterface;
- use Composer\Semver\Constraint\Constraint;
- class DefaultPolicy implements PolicyInterface
- {
- private $preferStable;
- private $preferLowest;
- private $preferredPackageResultCachePerPool;
- private $sortingCachePerPool;
- public function __construct(bool $preferStable = false, bool $preferLowest = false)
- {
- $this->preferStable = $preferStable;
- $this->preferLowest = $preferLowest;
- }
- public function versionCompare(PackageInterface $a, PackageInterface $b, string $operator): bool
- {
- if ($this->preferStable && ($stabA = $a->getStability()) !== ($stabB = $b->getStability())) {
- return BasePackage::$stabilities[$stabA] < BasePackage::$stabilities[$stabB];
- }
- $constraint = new Constraint($operator, $b->getVersion());
- $version = new Constraint('==', $a->getVersion());
- return $constraint->matchSpecific($version, true);
- }
- public function selectPreferredPackages(Pool $pool, array $literals, ?string $requiredPackage = null): array
- {
- sort($literals);
- $resultCacheKey = implode(',', $literals).$requiredPackage;
- $poolId = spl_object_id($pool);
- if (isset($this->preferredPackageResultCachePerPool[$poolId][$resultCacheKey])) {
- return $this->preferredPackageResultCachePerPool[$poolId][$resultCacheKey];
- }
- $packages = $this->groupLiteralsByName($pool, $literals);
- foreach ($packages as &$nameLiterals) {
- usort($nameLiterals, function ($a, $b) use ($pool, $requiredPackage, $poolId): int {
- $cacheKey = 'i'.$a.'.'.$b.$requiredPackage;
- if (isset($this->sortingCachePerPool[$poolId][$cacheKey])) {
- return $this->sortingCachePerPool[$poolId][$cacheKey];
- }
- return $this->sortingCachePerPool[$poolId][$cacheKey] = $this->compareByPriority($pool, $pool->literalToPackage($a), $pool->literalToPackage($b), $requiredPackage, true);
- });
- }
- foreach ($packages as &$sortedLiterals) {
- $sortedLiterals = $this->pruneToBestVersion($pool, $sortedLiterals);
- $sortedLiterals = $this->pruneRemoteAliases($pool, $sortedLiterals);
- }
- $selected = array_merge(...array_values($packages));
- usort($selected, function ($a, $b) use ($pool, $requiredPackage, $poolId): int {
- $cacheKey = $a.'.'.$b.$requiredPackage;
- if (isset($this->sortingCachePerPool[$poolId][$cacheKey])) {
- return $this->sortingCachePerPool[$poolId][$cacheKey];
- }
- return $this->sortingCachePerPool[$poolId][$cacheKey] = $this->compareByPriority($pool, $pool->literalToPackage($a), $pool->literalToPackage($b), $requiredPackage);
- });
- return $this->preferredPackageResultCachePerPool[$poolId][$resultCacheKey] = $selected;
- }
- protected function groupLiteralsByName(Pool $pool, array $literals): array
- {
- $packages = [];
- foreach ($literals as $literal) {
- $packageName = $pool->literalToPackage($literal)->getName();
- if (!isset($packages[$packageName])) {
- $packages[$packageName] = [];
- }
- $packages[$packageName][] = $literal;
- }
- return $packages;
- }
- public function compareByPriority(Pool $pool, BasePackage $a, BasePackage $b, ?string $requiredPackage = null, bool $ignoreReplace = false): int
- {
- if ($a->getName() === $b->getName()) {
- $aAliased = $a instanceof AliasPackage;
- $bAliased = $b instanceof AliasPackage;
- if ($aAliased && !$bAliased) {
- return -1;
- }
- if (!$aAliased && $bAliased) {
- return 1;
- }
- }
- if (!$ignoreReplace) {
- if ($this->replaces($a, $b)) {
- return 1;
- }
- if ($this->replaces($b, $a)) {
- return -1;
- }
- if ($requiredPackage && false !== ($pos = strpos($requiredPackage, '/'))) {
- $requiredVendor = substr($requiredPackage, 0, $pos);
- $aIsSameVendor = strpos($a->getName(), $requiredVendor) === 0;
- $bIsSameVendor = strpos($b->getName(), $requiredVendor) === 0;
- if ($bIsSameVendor !== $aIsSameVendor) {
- return $aIsSameVendor ? -1 : 1;
- }
- }
- }
- if ($a->id === $b->id) {
- return 0;
- }
- return ($a->id < $b->id) ? -1 : 1;
- }
- protected function replaces(BasePackage $source, BasePackage $target): bool
- {
- foreach ($source->getReplaces() as $link) {
- if ($link->getTarget() === $target->getName()
- ) {
- return true;
- }
- }
- return false;
- }
- protected function pruneToBestVersion(Pool $pool, array $literals): array
- {
- $operator = $this->preferLowest ? '<' : '>';
- $bestLiterals = [$literals[0]];
- $bestPackage = $pool->literalToPackage($literals[0]);
- foreach ($literals as $i => $literal) {
- if (0 === $i) {
- continue;
- }
- $package = $pool->literalToPackage($literal);
- if ($this->versionCompare($package, $bestPackage, $operator)) {
- $bestPackage = $package;
- $bestLiterals = [$literal];
- } elseif ($this->versionCompare($package, $bestPackage, '==')) {
- $bestLiterals[] = $literal;
- }
- }
- return $bestLiterals;
- }
- protected function pruneRemoteAliases(Pool $pool, array $literals): array
- {
- $hasLocalAlias = false;
- foreach ($literals as $literal) {
- $package = $pool->literalToPackage($literal);
- if ($package instanceof AliasPackage && $package->isRootPackageAlias()) {
- $hasLocalAlias = true;
- break;
- }
- }
- if (!$hasLocalAlias) {
- return $literals;
- }
- $selected = [];
- foreach ($literals as $literal) {
- $package = $pool->literalToPackage($literal);
- if ($package instanceof AliasPackage && $package->isRootPackageAlias()) {
- $selected[] = $literal;
- }
- }
- return $selected;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\DependencyResolver;
- class GenericRule extends Rule
- {
- protected $literals;
- public function __construct(array $literals, $reason, $reasonData)
- {
- parent::__construct($reason, $reasonData);
- sort($literals);
- $this->literals = $literals;
- }
- public function getLiterals(): array
- {
- return $this->literals;
- }
- public function getHash()
- {
- $data = unpack('ihash', md5(implode(',', $this->literals), true));
- return $data['hash'];
- }
- public function equals(Rule $rule): bool
- {
- return $this->literals === $rule->getLiterals();
- }
- public function isAssertion(): bool
- {
- return 1 === \count($this->literals);
- }
- public function __toString(): string
- {
- $result = $this->isDisabled() ? 'disabled(' : '(';
- foreach ($this->literals as $i => $literal) {
- if ($i !== 0) {
- $result .= '|';
- }
- $result .= $literal;
- }
- $result .= ')';
- return $result;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\DependencyResolver;
- use Composer\Repository\InstalledRepositoryInterface;
- use Composer\Repository\RepositoryInterface;
- class LocalRepoTransaction extends Transaction
- {
- public function __construct(RepositoryInterface $lockedRepository, InstalledRepositoryInterface $localRepository)
- {
- parent::__construct(
- $localRepository->getPackages(),
- $lockedRepository->getPackages()
- );
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\DependencyResolver;
- use Composer\Package\AliasPackage;
- use Composer\Package\BasePackage;
- use Composer\Package\Package;
- class LockTransaction extends Transaction
- {
- protected $presentMap;
- protected $unlockableMap;
- protected $resultPackages;
- public function __construct(Pool $pool, array $presentMap, array $unlockableMap, Decisions $decisions)
- {
- $this->presentMap = $presentMap;
- $this->unlockableMap = $unlockableMap;
- $this->setResultPackages($pool, $decisions);
- parent::__construct($this->presentMap, $this->resultPackages['all']);
- }
- public function setResultPackages(Pool $pool, Decisions $decisions): void
- {
- $this->resultPackages = ['all' => [], 'non-dev' => [], 'dev' => []];
- foreach ($decisions as $i => $decision) {
- $literal = $decision[Decisions::DECISION_LITERAL];
- if ($literal > 0) {
- $package = $pool->literalToPackage($literal);
- $this->resultPackages['all'][] = $package;
- if (!isset($this->unlockableMap[$package->id])) {
- $this->resultPackages['non-dev'][] = $package;
- }
- }
- }
- }
- public function setNonDevPackages(LockTransaction $extractionResult): void
- {
- $packages = $extractionResult->getNewLockPackages(false);
- $this->resultPackages['dev'] = $this->resultPackages['non-dev'];
- $this->resultPackages['non-dev'] = [];
- foreach ($packages as $package) {
- foreach ($this->resultPackages['dev'] as $i => $resultPackage) {
- if ($package->getName() === $resultPackage->getName()) {
- $this->resultPackages['non-dev'][] = $resultPackage;
- unset($this->resultPackages['dev'][$i]);
- }
- }
- }
- }
- public function getNewLockPackages(bool $devMode, bool $updateMirrors = false): array
- {
- $packages = [];
- foreach ($this->resultPackages[$devMode ? 'dev' : 'non-dev'] as $package) {
- if (!$package instanceof AliasPackage) {
- if ($updateMirrors && !isset($this->presentMap[spl_object_hash($package)])) {
- foreach ($this->presentMap as $presentPackage) {
- if ($package->getName() === $presentPackage->getName() && $package->getVersion() === $presentPackage->getVersion()) {
- if ($presentPackage->getSourceReference() && $presentPackage->getSourceType() === $package->getSourceType()) {
- $package->setSourceDistReferences($presentPackage->getSourceReference());
- }
- if ($presentPackage->getReleaseDate() !== null && $package instanceof Package) {
- $package->setReleaseDate($presentPackage->getReleaseDate());
- }
- }
- }
- }
- $packages[] = $package;
- }
- }
- return $packages;
- }
- public function getAliases(array $aliases): array
- {
- $usedAliases = [];
- foreach ($this->resultPackages['all'] as $package) {
- if ($package instanceof AliasPackage) {
- foreach ($aliases as $index => $alias) {
- if ($alias['package'] === $package->getName()) {
- $usedAliases[] = $alias;
- unset($aliases[$index]);
- }
- }
- }
- }
- usort($usedAliases, static function ($a, $b): int {
- return strcmp($a['package'], $b['package']);
- });
- return $usedAliases;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\DependencyResolver;
- class MultiConflictRule extends Rule
- {
- protected $literals;
- public function __construct(array $literals, $reason, $reasonData)
- {
- parent::__construct($reason, $reasonData);
- if (\count($literals) < 3) {
- throw new \RuntimeException("multi conflict rule requires at least 3 literals");
- }
- sort($literals);
- $this->literals = $literals;
- }
- public function getLiterals(): array
- {
- return $this->literals;
- }
- public function getHash()
- {
- $data = unpack('ihash', md5('c:'.implode(',', $this->literals), true));
- return $data['hash'];
- }
- public function equals(Rule $rule): bool
- {
- if ($rule instanceof MultiConflictRule) {
- return $this->literals === $rule->getLiterals();
- }
- return false;
- }
- public function isAssertion(): bool
- {
- return false;
- }
- public function disable(): void
- {
- 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.");
- }
- public function __toString(): string
- {
- $result = $this->isDisabled() ? 'disabled(multi(' : '(multi(';
- foreach ($this->literals as $i => $literal) {
- if ($i !== 0) {
- $result .= '|';
- }
- $result .= $literal;
- }
- $result .= '))';
- return $result;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\DependencyResolver\Operation;
- use Composer\Package\PackageInterface;
- class InstallOperation extends SolverOperation implements OperationInterface
- {
- protected const TYPE = 'install';
- protected $package;
- public function __construct(PackageInterface $package)
- {
- $this->package = $package;
- }
- public function getPackage(): PackageInterface
- {
- return $this->package;
- }
- public function show($lock): string
- {
- return self::format($this->package, $lock);
- }
- public static function format(PackageInterface $package, bool $lock = false): string
- {
- return ($lock ? 'Locking ' : 'Installing ').'<info>'.$package->getPrettyName().'</info> (<comment>'.$package->getFullPrettyVersion().'</comment>)';
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\DependencyResolver\Operation;
- use Composer\Package\AliasPackage;
- class MarkAliasInstalledOperation extends SolverOperation implements OperationInterface
- {
- protected const TYPE = 'markAliasInstalled';
- protected $package;
- public function __construct(AliasPackage $package)
- {
- $this->package = $package;
- }
- public function getPackage(): AliasPackage
- {
- return $this->package;
- }
- public function show($lock): string
- {
- 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>)';
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\DependencyResolver\Operation;
- use Composer\Package\AliasPackage;
- class MarkAliasUninstalledOperation extends SolverOperation implements OperationInterface
- {
- protected const TYPE = 'markAliasUninstalled';
- protected $package;
- public function __construct(AliasPackage $package)
- {
- $this->package = $package;
- }
- public function getPackage(): AliasPackage
- {
- return $this->package;
- }
- public function show($lock): string
- {
- 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>)';
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\DependencyResolver\Operation;
- interface OperationInterface
- {
- public function getOperationType();
- public function show(bool $lock);
- public function __toString();
- }
- <?php declare(strict_types=1);
- namespace Composer\DependencyResolver\Operation;
- abstract class SolverOperation implements OperationInterface
- {
- protected const TYPE = '';
- public function getOperationType(): string
- {
- return static::TYPE;
- }
- public function __toString()
- {
- return $this->show(false);
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\DependencyResolver\Operation;
- use Composer\Package\PackageInterface;
- class UninstallOperation extends SolverOperation implements OperationInterface
- {
- protected const TYPE = 'uninstall';
- protected $package;
- public function __construct(PackageInterface $package)
- {
- $this->package = $package;
- }
- public function getPackage(): PackageInterface
- {
- return $this->package;
- }
- public function show($lock): string
- {
- return self::format($this->package, $lock);
- }
- public static function format(PackageInterface $package, bool $lock = false): string
- {
- return 'Removing <info>'.$package->getPrettyName().'</info> (<comment>'.$package->getFullPrettyVersion().'</comment>)';
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\DependencyResolver\Operation;
- use Composer\Package\PackageInterface;
- use Composer\Package\Version\VersionParser;
- class UpdateOperation extends SolverOperation implements OperationInterface
- {
- protected const TYPE = 'update';
- protected $initialPackage;
- protected $targetPackage;
- public function __construct(PackageInterface $initial, PackageInterface $target)
- {
- $this->initialPackage = $initial;
- $this->targetPackage = $target;
- }
- public function getInitialPackage(): PackageInterface
- {
- return $this->initialPackage;
- }
- public function getTargetPackage(): PackageInterface
- {
- return $this->targetPackage;
- }
- public function show($lock): string
- {
- return self::format($this->initialPackage, $this->targetPackage, $lock);
- }
- public static function format(PackageInterface $initialPackage, PackageInterface $targetPackage, bool $lock = false): string
- {
- $fromVersion = $initialPackage->getFullPrettyVersion();
- $toVersion = $targetPackage->getFullPrettyVersion();
- if ($fromVersion === $toVersion && $initialPackage->getSourceReference() !== $targetPackage->getSourceReference()) {
- $fromVersion = $initialPackage->getFullPrettyVersion(true, PackageInterface::DISPLAY_SOURCE_REF);
- $toVersion = $targetPackage->getFullPrettyVersion(true, PackageInterface::DISPLAY_SOURCE_REF);
- } elseif ($fromVersion === $toVersion && $initialPackage->getDistReference() !== $targetPackage->getDistReference()) {
- $fromVersion = $initialPackage->getFullPrettyVersion(true, PackageInterface::DISPLAY_DIST_REF);
- $toVersion = $targetPackage->getFullPrettyVersion(true, PackageInterface::DISPLAY_DIST_REF);
- }
- $actionName = VersionParser::isUpgrade($initialPackage->getVersion(), $targetPackage->getVersion()) ? 'Upgrading' : 'Downgrading';
- return $actionName.' <info>'.$initialPackage->getPrettyName().'</info> (<comment>'.$fromVersion.'</comment> => <comment>'.$toVersion.'</comment>)';
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\DependencyResolver;
- use Composer\Package\PackageInterface;
- use Composer\Semver\Constraint\Constraint;
- interface PolicyInterface
- {
- public function versionCompare(PackageInterface $a, PackageInterface $b, string $operator): bool;
- public function selectPreferredPackages(Pool $pool, array $literals, ?string $requiredPackage = null): array;
- }
- <?php declare(strict_types=1);
- namespace Composer\DependencyResolver;
- use Composer\Package\BasePackage;
- use Composer\Package\Version\VersionParser;
- use Composer\Semver\CompilingMatcher;
- use Composer\Semver\Constraint\ConstraintInterface;
- use Composer\Semver\Constraint\Constraint;
- class Pool implements \Countable
- {
- protected $packages = [];
- protected $packageByName = [];
- protected $versionParser;
- protected $providerCache = [];
- protected $unacceptableFixedOrLockedPackages;
- protected $removedVersions = [];
- protected $removedVersionsByPackage = [];
- public function __construct(array $packages = [], array $unacceptableFixedOrLockedPackages = [], array $removedVersions = [], array $removedVersionsByPackage = [])
- {
- $this->versionParser = new VersionParser;
- $this->setPackages($packages);
- $this->unacceptableFixedOrLockedPackages = $unacceptableFixedOrLockedPackages;
- $this->removedVersions = $removedVersions;
- $this->removedVersionsByPackage = $removedVersionsByPackage;
- }
- public function getRemovedVersions(string $name, ConstraintInterface $constraint): array
- {
- if (!isset($this->removedVersions[$name])) {
- return [];
- }
- $result = [];
- foreach ($this->removedVersions[$name] as $version => $prettyVersion) {
- if ($constraint->matches(new Constraint('==', $version))) {
- $result[$version] = $prettyVersion;
- }
- }
- return $result;
- }
- public function getRemovedVersionsByPackage(string $objectHash): array
- {
- if (!isset($this->removedVersionsByPackage[$objectHash])) {
- return [];
- }
- return $this->removedVersionsByPackage[$objectHash];
- }
- private function setPackages(array $packages): void
- {
- $id = 1;
- foreach ($packages as $package) {
- $this->packages[] = $package;
- $package->id = $id++;
- foreach ($package->getNames() as $provided) {
- $this->packageByName[$provided][] = $package;
- }
- }
- }
- public function getPackages(): array
- {
- return $this->packages;
- }
- public function packageById(int $id): BasePackage
- {
- return $this->packages[$id - 1];
- }
- public function count(): int
- {
- return \count($this->packages);
- }
- public function whatProvides(string $name, ?ConstraintInterface $constraint = null): array
- {
- $key = (string) $constraint;
- if (isset($this->providerCache[$name][$key])) {
- return $this->providerCache[$name][$key];
- }
- return $this->providerCache[$name][$key] = $this->computeWhatProvides($name, $constraint);
- }
- private function computeWhatProvides(string $name, ?ConstraintInterface $constraint = null): array
- {
- if (!isset($this->packageByName[$name])) {
- return [];
- }
- $matches = [];
- foreach ($this->packageByName[$name] as $candidate) {
- if ($this->match($candidate, $name, $constraint)) {
- $matches[] = $candidate;
- }
- }
- return $matches;
- }
- public function literalToPackage(int $literal): BasePackage
- {
- $packageId = abs($literal);
- return $this->packageById($packageId);
- }
- public function literalToPrettyString(int $literal, array $installedMap): string
- {
- $package = $this->literalToPackage($literal);
- if (isset($installedMap[$package->id])) {
- $prefix = ($literal > 0 ? 'keep' : 'remove');
- } else {
- $prefix = ($literal > 0 ? 'install' : 'don\'t install');
- }
- return $prefix.' '.$package->getPrettyString();
- }
- public function match(BasePackage $candidate, string $name, ?ConstraintInterface $constraint = null): bool
- {
- $candidateName = $candidate->getName();
- $candidateVersion = $candidate->getVersion();
- if ($candidateName === $name) {
- return $constraint === null || CompilingMatcher::match($constraint, Constraint::OP_EQ, $candidateVersion);
- }
- $provides = $candidate->getProvides();
- $replaces = $candidate->getReplaces();
- if (isset($replaces[0]) || isset($provides[0])) {
- foreach ($provides as $link) {
- if ($link->getTarget() === $name && ($constraint === null || $constraint->matches($link->getConstraint()))) {
- return true;
- }
- }
- foreach ($replaces as $link) {
- if ($link->getTarget() === $name && ($constraint === null || $constraint->matches($link->getConstraint()))) {
- return true;
- }
- }
- return false;
- }
- if (isset($provides[$name]) && ($constraint === null || $constraint->matches($provides[$name]->getConstraint()))) {
- return true;
- }
- if (isset($replaces[$name]) && ($constraint === null || $constraint->matches($replaces[$name]->getConstraint()))) {
- return true;
- }
- return false;
- }
- public function isUnacceptableFixedOrLockedPackage(BasePackage $package): bool
- {
- return \in_array($package, $this->unacceptableFixedOrLockedPackages, true);
- }
- public function getUnacceptableFixedOrLockedPackages(): array
- {
- return $this->unacceptableFixedOrLockedPackages;
- }
- public function __toString(): string
- {
- $str = "Pool:\n";
- foreach ($this->packages as $package) {
- $str .= '- '.str_pad((string) $package->id, 6, ' ', STR_PAD_LEFT).': '.$package->getName()."\n";
- }
- return $str;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\DependencyResolver;
- use Composer\EventDispatcher\EventDispatcher;
- use Composer\IO\IOInterface;
- use Composer\Package\AliasPackage;
- use Composer\Package\BasePackage;
- use Composer\Package\CompleteAliasPackage;
- use Composer\Package\CompletePackage;
- use Composer\Package\PackageInterface;
- use Composer\Package\Version\StabilityFilter;
- use Composer\Pcre\Preg;
- use Composer\Plugin\PluginEvents;
- use Composer\Plugin\PrePoolCreateEvent;
- use Composer\Repository\PlatformRepository;
- use Composer\Repository\RepositoryInterface;
- use Composer\Repository\RootPackageRepository;
- use Composer\Semver\CompilingMatcher;
- use Composer\Semver\Constraint\Constraint;
- use Composer\Semver\Constraint\ConstraintInterface;
- use Composer\Semver\Constraint\MatchAllConstraint;
- use Composer\Semver\Constraint\MultiConstraint;
- use Composer\Semver\Intervals;
- class PoolBuilder
- {
- private $acceptableStabilities;
- private $stabilityFlags;
- private $rootAliases;
- private $rootReferences;
- private $temporaryConstraints;
- private $eventDispatcher;
- private $poolOptimizer;
- private $io;
- private $aliasMap = [];
- private $packagesToLoad = [];
- private $loadedPackages = [];
- private $loadedPerRepo = [];
- private $packages = [];
- private $unacceptableFixedOrLockedPackages = [];
- private $updateAllowList = [];
- private $skippedLoad = [];
- private $pathRepoUnlocked = [];
- private $maxExtendedReqs = [];
- private $updateAllowWarned = [];
- private $indexCounter = 0;
- public function __construct(array $acceptableStabilities, array $stabilityFlags, array $rootAliases, array $rootReferences, IOInterface $io, ?EventDispatcher $eventDispatcher = null, ?PoolOptimizer $poolOptimizer = null, array $temporaryConstraints = [])
- {
- $this->acceptableStabilities = $acceptableStabilities;
- $this->stabilityFlags = $stabilityFlags;
- $this->rootAliases = $rootAliases;
- $this->rootReferences = $rootReferences;
- $this->eventDispatcher = $eventDispatcher;
- $this->poolOptimizer = $poolOptimizer;
- $this->io = $io;
- $this->temporaryConstraints = $temporaryConstraints;
- }
- public function buildPool(array $repositories, Request $request): Pool
- {
- if ($request->getUpdateAllowList()) {
- $this->updateAllowList = $request->getUpdateAllowList();
- $this->warnAboutNonMatchingUpdateAllowList($request);
- foreach ($request->getLockedRepository()->getPackages() as $lockedPackage) {
- if (!$this->isUpdateAllowed($lockedPackage)) {
- $this->skippedLoad[$lockedPackage->getName()][] = $lockedPackage;
- foreach ($lockedPackage->getReplaces() as $link) {
- $this->skippedLoad[$link->getTarget()][] = $lockedPackage;
- }
- if ($lockedPackage->getDistType() === 'path') {
- $transportOptions = $lockedPackage->getTransportOptions();
- if (!isset($transportOptions['symlink']) || $transportOptions['symlink'] !== false) {
- $this->pathRepoUnlocked[$lockedPackage->getName()] = true;
- continue;
- }
- }
- $request->lockPackage($lockedPackage);
- }
- }
- }
- foreach ($request->getFixedOrLockedPackages() as $package) {
- $this->loadedPackages[$package->getName()] = new MatchAllConstraint();
- foreach ($package->getReplaces() as $link) {
- $this->loadedPackages[$link->getTarget()] = new MatchAllConstraint();
- }
- if (
- $package->getRepository() instanceof RootPackageRepository
- || $package->getRepository() instanceof PlatformRepository
- || StabilityFilter::isPackageAcceptable($this->acceptableStabilities, $this->stabilityFlags, $package->getNames(), $package->getStability())
- ) {
- $this->loadPackage($request, $repositories, $package, false);
- } else {
- $this->unacceptableFixedOrLockedPackages[] = $package;
- }
- }
- foreach ($request->getRequires() as $packageName => $constraint) {
- if (isset($this->loadedPackages[$packageName])) {
- continue;
- }
- $this->packagesToLoad[$packageName] = $constraint;
- $this->maxExtendedReqs[$packageName] = true;
- }
- foreach ($this->packagesToLoad as $name => $constraint) {
- if (isset($this->loadedPackages[$name])) {
- unset($this->packagesToLoad[$name]);
- }
- }
- while (!empty($this->packagesToLoad)) {
- $this->loadPackagesMarkedForLoading($request, $repositories);
- }
- if (\count($this->temporaryConstraints) > 0) {
- foreach ($this->packages as $i => $package) {
- if (!isset($this->temporaryConstraints[$package->getName()]) || $package instanceof AliasPackage) {
- continue;
- }
- $constraint = $this->temporaryConstraints[$package->getName()];
- $packageAndAliases = [$i => $package];
- if (isset($this->aliasMap[spl_object_hash($package)])) {
- $packageAndAliases += $this->aliasMap[spl_object_hash($package)];
- }
- $found = false;
- foreach ($packageAndAliases as $packageOrAlias) {
- if (CompilingMatcher::match($constraint, Constraint::OP_EQ, $packageOrAlias->getVersion())) {
- $found = true;
- }
- }
- if (!$found) {
- foreach ($packageAndAliases as $index => $packageOrAlias) {
- unset($this->packages[$index]);
- }
- }
- }
- }
- if ($this->eventDispatcher) {
- $prePoolCreateEvent = new PrePoolCreateEvent(
- PluginEvents::PRE_POOL_CREATE,
- $repositories,
- $request,
- $this->acceptableStabilities,
- $this->stabilityFlags,
- $this->rootAliases,
- $this->rootReferences,
- $this->packages,
- $this->unacceptableFixedOrLockedPackages
- );
- $this->eventDispatcher->dispatch($prePoolCreateEvent->getName(), $prePoolCreateEvent);
- $this->packages = $prePoolCreateEvent->getPackages();
- $this->unacceptableFixedOrLockedPackages = $prePoolCreateEvent->getUnacceptableFixedPackages();
- }
- $pool = new Pool($this->packages, $this->unacceptableFixedOrLockedPackages);
- $this->aliasMap = [];
- $this->packagesToLoad = [];
- $this->loadedPackages = [];
- $this->loadedPerRepo = [];
- $this->packages = [];
- $this->unacceptableFixedOrLockedPackages = [];
- $this->maxExtendedReqs = [];
- $this->skippedLoad = [];
- $this->indexCounter = 0;
- $this->io->debug('Built pool.');
- $pool = $this->runOptimizer($request, $pool);
- Intervals::clear();
- return $pool;
- }
- private function markPackageNameForLoading(Request $request, string $name, ConstraintInterface $constraint): void
- {
- if (PlatformRepository::isPlatformPackage($name)) {
- return;
- }
- if (isset($this->maxExtendedReqs[$name])) {
- return;
- }
- $rootRequires = $request->getRequires();
- if (isset($rootRequires[$name]) && !Intervals::isSubsetOf($constraint, $rootRequires[$name])) {
- $constraint = $rootRequires[$name];
- }
- if (!isset($this->loadedPackages[$name])) {
- if (isset($this->packagesToLoad[$name])) {
- if (Intervals::isSubsetOf($constraint, $this->packagesToLoad[$name])) {
- return;
- }
- $constraint = Intervals::compactConstraint(MultiConstraint::create([$this->packagesToLoad[$name], $constraint], false));
- }
- $this->packagesToLoad[$name] = $constraint;
- return;
- }
- if (Intervals::isSubsetOf($constraint, $this->loadedPackages[$name])) {
- return;
- }
- $this->packagesToLoad[$name] = Intervals::compactConstraint(MultiConstraint::create([$this->loadedPackages[$name], $constraint], false));
- unset($this->loadedPackages[$name]);
- }
- private function loadPackagesMarkedForLoading(Request $request, array $repositories): void
- {
- foreach ($this->packagesToLoad as $name => $constraint) {
- $this->loadedPackages[$name] = $constraint;
- }
- $packageBatch = $this->packagesToLoad;
- $this->packagesToLoad = [];
- foreach ($repositories as $repoIndex => $repository) {
- if (empty($packageBatch)) {
- break;
- }
- if ($repository instanceof PlatformRepository || $repository === $request->getLockedRepository()) {
- continue;
- }
- $result = $repository->loadPackages($packageBatch, $this->acceptableStabilities, $this->stabilityFlags, $this->loadedPerRepo[$repoIndex] ?? []);
- foreach ($result['namesFound'] as $name) {
- unset($packageBatch[$name]);
- }
- foreach ($result['packages'] as $package) {
- $this->loadedPerRepo[$repoIndex][$package->getName()][$package->getVersion()] = $package;
- $this->loadPackage($request, $repositories, $package, !isset($this->pathRepoUnlocked[$package->getName()]));
- }
- }
- }
- private function loadPackage(Request $request, array $repositories, BasePackage $package, bool $propagateUpdate): void
- {
- $index = $this->indexCounter++;
- $this->packages[$index] = $package;
- if ($package instanceof AliasPackage) {
- $this->aliasMap[spl_object_hash($package->getAliasOf())][$index] = $package;
- }
- $name = $package->getName();
- if (isset($this->rootReferences[$name])) {
- if (!$request->isLockedPackage($package) && !$request->isFixedPackage($package)) {
- $package->setSourceDistReferences($this->rootReferences[$name]);
- }
- }
- if ($propagateUpdate && isset($this->rootAliases[$name][$package->getVersion()])) {
- $alias = $this->rootAliases[$name][$package->getVersion()];
- if ($package instanceof AliasPackage) {
- $basePackage = $package->getAliasOf();
- } else {
- $basePackage = $package;
- }
- if ($basePackage instanceof CompletePackage) {
- $aliasPackage = new CompleteAliasPackage($basePackage, $alias['alias_normalized'], $alias['alias']);
- } else {
- $aliasPackage = new AliasPackage($basePackage, $alias['alias_normalized'], $alias['alias']);
- }
- $aliasPackage->setRootPackageAlias(true);
- $newIndex = $this->indexCounter++;
- $this->packages[$newIndex] = $aliasPackage;
- $this->aliasMap[spl_object_hash($aliasPackage->getAliasOf())][$newIndex] = $aliasPackage;
- }
- foreach ($package->getRequires() as $link) {
- $require = $link->getTarget();
- $linkConstraint = $link->getConstraint();
- if (isset($this->skippedLoad[$require])) {
- if ($propagateUpdate && $request->getUpdateAllowTransitiveDependencies()) {
- $skippedRootRequires = $this->getSkippedRootRequires($request, $require);
- if ($request->getUpdateAllowTransitiveRootDependencies() || !$skippedRootRequires) {
- $this->unlockPackage($request, $repositories, $require);
- $this->markPackageNameForLoading($request, $require, $linkConstraint);
- } else {
- foreach ($skippedRootRequires as $rootRequire) {
- if (!isset($this->updateAllowWarned[$rootRequire])) {
- $this->updateAllowWarned[$rootRequire] = true;
- $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>');
- }
- }
- }
- } elseif (isset($this->pathRepoUnlocked[$require]) && !isset($this->loadedPackages[$require])) {
- $this->markPackageNameForLoading($request, $require, $linkConstraint);
- }
- } else {
- $this->markPackageNameForLoading($request, $require, $linkConstraint);
- }
- }
- if ($propagateUpdate && $request->getUpdateAllowTransitiveDependencies()) {
- foreach ($package->getReplaces() as $link) {
- $replace = $link->getTarget();
- if (isset($this->loadedPackages[$replace], $this->skippedLoad[$replace])) {
- $skippedRootRequires = $this->getSkippedRootRequires($request, $replace);
- if ($request->getUpdateAllowTransitiveRootDependencies() || !$skippedRootRequires) {
- $this->unlockPackage($request, $repositories, $replace);
- $this->markPackageNameForLoading($request, $replace, $link->getConstraint());
- } else {
- foreach ($skippedRootRequires as $rootRequire) {
- if (!isset($this->updateAllowWarned[$rootRequire])) {
- $this->updateAllowWarned[$rootRequire] = true;
- $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>');
- }
- }
- }
- }
- }
- }
- }
- private function isRootRequire(Request $request, string $name): bool
- {
- $rootRequires = $request->getRequires();
- return isset($rootRequires[$name]);
- }
- private function getSkippedRootRequires(Request $request, string $name): array
- {
- if (!isset($this->skippedLoad[$name])) {
- return [];
- }
- $rootRequires = $request->getRequires();
- $matches = [];
- if (isset($rootRequires[$name])) {
- return array_map(static function (PackageInterface $package) use ($name): string {
- if ($name !== $package->getName()) {
- return $package->getName() .' (via replace of '.$name.')';
- }
- return $package->getName();
- }, $this->skippedLoad[$name]);
- }
- foreach ($this->skippedLoad[$name] as $packageOrReplacer) {
- if (isset($rootRequires[$packageOrReplacer->getName()])) {
- $matches[] = $packageOrReplacer->getName();
- }
- foreach ($packageOrReplacer->getReplaces() as $link) {
- if (isset($rootRequires[$link->getTarget()])) {
- if ($name !== $packageOrReplacer->getName()) {
- $matches[] = $packageOrReplacer->getName() .' (via replace of '.$name.')';
- } else {
- $matches[] = $packageOrReplacer->getName();
- }
- break;
- }
- }
- }
- return $matches;
- }
- private function isUpdateAllowed(BasePackage $package): bool
- {
- foreach ($this->updateAllowList as $pattern => $void) {
- $patternRegexp = BasePackage::packageNameToRegexp($pattern);
- if (Preg::isMatch($patternRegexp, $package->getName())) {
- return true;
- }
- }
- return false;
- }
- private function warnAboutNonMatchingUpdateAllowList(Request $request): void
- {
- foreach ($this->updateAllowList as $pattern => $void) {
- $patternRegexp = BasePackage::packageNameToRegexp($pattern);
- foreach ($request->getLockedRepository()->getPackages() as $package) {
- if (Preg::isMatch($patternRegexp, $package->getName())) {
- continue 2;
- }
- }
- foreach ($request->getRequires() as $packageName => $constraint) {
- if (Preg::isMatch($patternRegexp, $packageName)) {
- continue 2;
- }
- }
- if (strpos($pattern, '*') !== false) {
- $this->io->writeError('<warning>Pattern "' . $pattern . '" listed for update does not match any locked packages.</warning>');
- } else {
- $this->io->writeError('<warning>Package "' . $pattern . '" listed for update is not locked.</warning>');
- }
- }
- }
- private function unlockPackage(Request $request, array $repositories, string $name): void
- {
- foreach ($this->skippedLoad[$name] as $packageOrReplacer) {
- if ($packageOrReplacer->getName() !== $name && isset($this->skippedLoad[$packageOrReplacer->getName()])) {
- $replacerName = $packageOrReplacer->getName();
- if ($request->getUpdateAllowTransitiveRootDependencies() || (!$this->isRootRequire($request, $name) && !$this->isRootRequire($request, $replacerName))) {
- $this->unlockPackage($request, $repositories, $replacerName);
- if ($this->isRootRequire($request, $replacerName)) {
- $this->markPackageNameForLoading($request, $replacerName, new MatchAllConstraint);
- } else {
- foreach ($this->packages as $loadedPackage) {
- $requires = $loadedPackage->getRequires();
- if (isset($requires[$replacerName])) {
- $this->markPackageNameForLoading($request, $replacerName, $requires[$replacerName]->getConstraint());
- }
- }
- }
- }
- }
- }
- if (isset($this->pathRepoUnlocked[$name])) {
- foreach ($this->packages as $index => $package) {
- if ($package->getName() === $name) {
- $this->removeLoadedPackage($request, $repositories, $package, $index);
- }
- }
- }
- unset($this->skippedLoad[$name], $this->loadedPackages[$name], $this->maxExtendedReqs[$name], $this->pathRepoUnlocked[$name]);
- foreach ($request->getLockedPackages() as $lockedPackage) {
- if (!($lockedPackage instanceof AliasPackage) && $lockedPackage->getName() === $name) {
- if (false !== $index = array_search($lockedPackage, $this->packages, true)) {
- $request->unlockPackage($lockedPackage);
- $this->removeLoadedPackage($request, $repositories, $lockedPackage, $index);
- foreach ($request->getFixedOrLockedPackages() as $fixedOrLockedPackage) {
- if ($fixedOrLockedPackage === $lockedPackage) {
- continue;
- }
- if (isset($this->skippedLoad[$fixedOrLockedPackage->getName()])) {
- $requires = $fixedOrLockedPackage->getRequires();
- if (isset($requires[$lockedPackage->getName()])) {
- $this->markPackageNameForLoading($request, $lockedPackage->getName(), $requires[$lockedPackage->getName()]->getConstraint());
- }
- }
- }
- }
- }
- }
- }
- private function removeLoadedPackage(Request $request, array $repositories, BasePackage $package, int $index): void
- {
- $repoIndex = array_search($package->getRepository(), $repositories, true);
- unset($this->loadedPerRepo[$repoIndex][$package->getName()][$package->getVersion()]);
- unset($this->packages[$index]);
- if (isset($this->aliasMap[spl_object_hash($package)])) {
- foreach ($this->aliasMap[spl_object_hash($package)] as $aliasIndex => $aliasPackage) {
- unset($this->loadedPerRepo[$repoIndex][$aliasPackage->getName()][$aliasPackage->getVersion()]);
- unset($this->packages[$aliasIndex]);
- }
- unset($this->aliasMap[spl_object_hash($package)]);
- }
- }
- private function runOptimizer(Request $request, Pool $pool): Pool
- {
- if (null === $this->poolOptimizer) {
- return $pool;
- }
- $this->io->debug('Running pool optimizer.');
- $before = microtime(true);
- $total = \count($pool->getPackages());
- $pool = $this->poolOptimizer->optimize($request, $pool);
- $filtered = $total - \count($pool->getPackages());
- if (0 === $filtered) {
- return $pool;
- }
- $this->io->write(sprintf('Pool optimizer completed in %.3f seconds', microtime(true) - $before), true, IOInterface::VERY_VERBOSE);
- $this->io->write(sprintf(
- '<info>Found %s package versions referenced in your dependency graph. %s (%d%%) were optimized away.</info>',
- number_format($total),
- number_format($filtered),
- round(100 / $total * $filtered)
- ), true, IOInterface::VERY_VERBOSE);
- return $pool;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\DependencyResolver;
- use Composer\Package\AliasPackage;
- use Composer\Package\BasePackage;
- use Composer\Package\Version\VersionParser;
- use Composer\Semver\CompilingMatcher;
- use Composer\Semver\Constraint\ConstraintInterface;
- use Composer\Semver\Constraint\Constraint;
- use Composer\Semver\Constraint\MultiConstraint;
- use Composer\Semver\Intervals;
- class PoolOptimizer
- {
- private $policy;
- private $irremovablePackages = [];
- private $requireConstraintsPerPackage = [];
- private $conflictConstraintsPerPackage = [];
- private $packagesToRemove = [];
- private $aliasesPerPackage = [];
- private $removedVersionsByPackage = [];
- public function __construct(PolicyInterface $policy)
- {
- $this->policy = $policy;
- }
- public function optimize(Request $request, Pool $pool): Pool
- {
- $this->prepare($request, $pool);
- $this->optimizeByIdenticalDependencies($request, $pool);
- $this->optimizeImpossiblePackagesAway($request, $pool);
- $optimizedPool = $this->applyRemovalsToPool($pool);
- $this->irremovablePackages = [];
- $this->requireConstraintsPerPackage = [];
- $this->conflictConstraintsPerPackage = [];
- $this->packagesToRemove = [];
- $this->aliasesPerPackage = [];
- $this->removedVersionsByPackage = [];
- return $optimizedPool;
- }
- private function prepare(Request $request, Pool $pool): void
- {
- $irremovablePackageConstraintGroups = [];
- foreach ($request->getFixedOrLockedPackages() as $package) {
- $irremovablePackageConstraintGroups[$package->getName()][] = new Constraint('==', $package->getVersion());
- }
- foreach ($request->getRequires() as $require => $constraint) {
- $this->extractRequireConstraintsPerPackage($require, $constraint);
- }
- foreach ($pool->getPackages() as $package) {
- foreach ($package->getRequires() as $link) {
- $this->extractRequireConstraintsPerPackage($link->getTarget(), $link->getConstraint());
- }
- foreach ($package->getConflicts() as $link) {
- $this->extractConflictConstraintsPerPackage($link->getTarget(), $link->getConstraint());
- }
- if ($package instanceof AliasPackage) {
- $this->aliasesPerPackage[$package->getAliasOf()->id][] = $package;
- }
- }
- $irremovablePackageConstraints = [];
- foreach ($irremovablePackageConstraintGroups as $packageName => $constraints) {
- $irremovablePackageConstraints[$packageName] = 1 === \count($constraints) ? $constraints[0] : new MultiConstraint($constraints, false);
- }
- unset($irremovablePackageConstraintGroups);
- foreach ($pool->getPackages() as $package) {
- if (!isset($irremovablePackageConstraints[$package->getName()])) {
- continue;
- }
- if (CompilingMatcher::match($irremovablePackageConstraints[$package->getName()], Constraint::OP_EQ, $package->getVersion())) {
- $this->markPackageIrremovable($package);
- }
- }
- }
- private function markPackageIrremovable(BasePackage $package): void
- {
- $this->irremovablePackages[$package->id] = true;
- if ($package instanceof AliasPackage) {
- $this->markPackageIrremovable($package->getAliasOf());
- }
- if (isset($this->aliasesPerPackage[$package->id])) {
- foreach ($this->aliasesPerPackage[$package->id] as $aliasPackage) {
- $this->irremovablePackages[$aliasPackage->id] = true;
- }
- }
- }
- private function applyRemovalsToPool(Pool $pool): Pool
- {
- $packages = [];
- $removedVersions = [];
- foreach ($pool->getPackages() as $package) {
- if (!isset($this->packagesToRemove[$package->id])) {
- $packages[] = $package;
- } else {
- $removedVersions[$package->getName()][$package->getVersion()] = $package->getPrettyVersion();
- }
- }
- $optimizedPool = new Pool($packages, $pool->getUnacceptableFixedOrLockedPackages(), $removedVersions, $this->removedVersionsByPackage);
- return $optimizedPool;
- }
- private function optimizeByIdenticalDependencies(Request $request, Pool $pool): void
- {
- $identicalDefinitionsPerPackage = [];
- $packageIdenticalDefinitionLookup = [];
- foreach ($pool->getPackages() as $package) {
- if (isset($this->irremovablePackages[$package->id])) {
- continue;
- }
- $this->markPackageForRemoval($package->id);
- $dependencyHash = $this->calculateDependencyHash($package);
- foreach ($package->getNames(false) as $packageName) {
- if (!isset($this->requireConstraintsPerPackage[$packageName])) {
- continue;
- }
- foreach ($this->requireConstraintsPerPackage[$packageName] as $requireConstraint) {
- $groupHashParts = [];
- if (CompilingMatcher::match($requireConstraint, Constraint::OP_EQ, $package->getVersion())) {
- $groupHashParts[] = 'require:' . (string) $requireConstraint;
- }
- if ($package->getReplaces()) {
- foreach ($package->getReplaces() as $link) {
- if (CompilingMatcher::match($link->getConstraint(), Constraint::OP_EQ, $package->getVersion())) {
- $groupHashParts[] = 'require:' . (string) $link->getConstraint();
- }
- }
- }
- if (isset($this->conflictConstraintsPerPackage[$packageName])) {
- foreach ($this->conflictConstraintsPerPackage[$packageName] as $conflictConstraint) {
- if (CompilingMatcher::match($conflictConstraint, Constraint::OP_EQ, $package->getVersion())) {
- $groupHashParts[] = 'conflict:' . (string) $conflictConstraint;
- }
- }
- }
- if (!$groupHashParts) {
- continue;
- }
- $groupHash = implode('', $groupHashParts);
- $identicalDefinitionsPerPackage[$packageName][$groupHash][$dependencyHash][] = $package;
- $packageIdenticalDefinitionLookup[$package->id][$packageName] = ['groupHash' => $groupHash, 'dependencyHash' => $dependencyHash];
- }
- }
- }
- foreach ($identicalDefinitionsPerPackage as $constraintGroups) {
- foreach ($constraintGroups as $constraintGroup) {
- foreach ($constraintGroup as $packages) {
- if (1 === \count($packages)) {
- $this->keepPackage($packages[0], $identicalDefinitionsPerPackage, $packageIdenticalDefinitionLookup);
- continue;
- }
- $literals = [];
- foreach ($packages as $package) {
- $literals[] = $package->id;
- }
- foreach ($this->policy->selectPreferredPackages($pool, $literals) as $preferredLiteral) {
- $this->keepPackage($pool->literalToPackage($preferredLiteral), $identicalDefinitionsPerPackage, $packageIdenticalDefinitionLookup);
- }
- }
- }
- }
- }
- private function calculateDependencyHash(BasePackage $package): string
- {
- $hash = '';
- $hashRelevantLinks = [
- 'requires' => $package->getRequires(),
- 'conflicts' => $package->getConflicts(),
- 'replaces' => $package->getReplaces(),
- 'provides' => $package->getProvides(),
- ];
- foreach ($hashRelevantLinks as $key => $links) {
- if (0 === \count($links)) {
- continue;
- }
- $hash .= $key . ':';
- $subhash = [];
- foreach ($links as $link) {
- $subhash[$link->getTarget()] = (string) $link->getConstraint();
- }
- ksort($subhash);
- foreach ($subhash as $target => $constraint) {
- $hash .= $target . '@' . $constraint;
- }
- }
- return $hash;
- }
- private function markPackageForRemoval(int $id): void
- {
- if (isset($this->irremovablePackages[$id])) {
- throw new \LogicException('Attempted removing a package which was previously marked irremovable');
- }
- $this->packagesToRemove[$id] = true;
- }
- private function keepPackage(BasePackage $package, array $identicalDefinitionsPerPackage, array $packageIdenticalDefinitionLookup): void
- {
- if (!isset($this->packagesToRemove[$package->id])) {
- return;
- }
- unset($this->packagesToRemove[$package->id]);
- if ($package instanceof AliasPackage) {
- $this->keepPackage($package->getAliasOf(), $identicalDefinitionsPerPackage, $packageIdenticalDefinitionLookup);
- }
- foreach ($package->getNames(false) as $name) {
- if (isset($packageIdenticalDefinitionLookup[$package->id][$name])) {
- $packageGroupPointers = $packageIdenticalDefinitionLookup[$package->id][$name];
- $packageGroup = $identicalDefinitionsPerPackage[$name][$packageGroupPointers['groupHash']][$packageGroupPointers['dependencyHash']];
- foreach ($packageGroup as $pkg) {
- if ($pkg instanceof AliasPackage && $pkg->getPrettyVersion() === VersionParser::DEFAULT_BRANCH_ALIAS) {
- $pkg = $pkg->getAliasOf();
- }
- $this->removedVersionsByPackage[spl_object_hash($package)][$pkg->getVersion()] = $pkg->getPrettyVersion();
- }
- }
- }
- if (isset($this->aliasesPerPackage[$package->id])) {
- foreach ($this->aliasesPerPackage[$package->id] as $aliasPackage) {
- unset($this->packagesToRemove[$aliasPackage->id]);
- foreach ($aliasPackage->getNames(false) as $name) {
- if (isset($packageIdenticalDefinitionLookup[$aliasPackage->id][$name])) {
- $packageGroupPointers = $packageIdenticalDefinitionLookup[$aliasPackage->id][$name];
- $packageGroup = $identicalDefinitionsPerPackage[$name][$packageGroupPointers['groupHash']][$packageGroupPointers['dependencyHash']];
- foreach ($packageGroup as $pkg) {
- if ($pkg instanceof AliasPackage && $pkg->getPrettyVersion() === VersionParser::DEFAULT_BRANCH_ALIAS) {
- $pkg = $pkg->getAliasOf();
- }
- $this->removedVersionsByPackage[spl_object_hash($aliasPackage)][$pkg->getVersion()] = $pkg->getPrettyVersion();
- }
- }
- }
- }
- }
- }
- private function optimizeImpossiblePackagesAway(Request $request, Pool $pool): void
- {
- if (count($request->getLockedPackages()) === 0) {
- return;
- }
- $packageIndex = [];
- foreach ($pool->getPackages() as $package) {
- $id = $package->id;
- if (isset($this->irremovablePackages[$id])) {
- continue;
- }
- if (isset($this->aliasesPerPackage[$id]) || $package instanceof AliasPackage) {
- continue;
- }
- if ($request->isFixedPackage($package) || $request->isLockedPackage($package)) {
- continue;
- }
- $packageIndex[$package->getName()][$package->id] = $package;
- }
- foreach ($request->getLockedPackages() as $package) {
- $isUnusedPackage = true;
- foreach ($package->getNames(false) as $packageName) {
- if (isset($this->requireConstraintsPerPackage[$packageName])) {
- $isUnusedPackage = false;
- break;
- }
- }
- if ($isUnusedPackage) {
- continue;
- }
- foreach ($package->getRequires() as $link) {
- $require = $link->getTarget();
- if (!isset($packageIndex[$require])) {
- continue;
- }
- $linkConstraint = $link->getConstraint();
- foreach ($packageIndex[$require] as $id => $requiredPkg) {
- if (false === CompilingMatcher::match($linkConstraint, Constraint::OP_EQ, $requiredPkg->getVersion())) {
- $this->markPackageForRemoval($id);
- unset($packageIndex[$require][$id]);
- }
- }
- }
- }
- }
- private function extractRequireConstraintsPerPackage(string $package, ConstraintInterface $constraint)
- {
- foreach ($this->expandDisjunctiveMultiConstraints($constraint) as $expanded) {
- $this->requireConstraintsPerPackage[$package][(string) $expanded] = $expanded;
- }
- }
- private function extractConflictConstraintsPerPackage(string $package, ConstraintInterface $constraint)
- {
- foreach ($this->expandDisjunctiveMultiConstraints($constraint) as $expanded) {
- $this->conflictConstraintsPerPackage[$package][(string) $expanded] = $expanded;
- }
- }
- private function expandDisjunctiveMultiConstraints(ConstraintInterface $constraint)
- {
- $constraint = Intervals::compactConstraint($constraint);
- if ($constraint instanceof MultiConstraint && $constraint->isDisjunctive()) {
- return $constraint->getConstraints();
- }
- return [$constraint];
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\DependencyResolver;
- use Composer\Package\CompletePackageInterface;
- use Composer\Package\AliasPackage;
- use Composer\Package\BasePackage;
- use Composer\Package\Link;
- use Composer\Package\PackageInterface;
- use Composer\Package\RootPackageInterface;
- use Composer\Pcre\Preg;
- use Composer\Repository\RepositorySet;
- use Composer\Repository\LockArrayRepository;
- use Composer\Semver\Constraint\Constraint;
- use Composer\Semver\Constraint\ConstraintInterface;
- use Composer\Package\Version\VersionParser;
- use Composer\Repository\PlatformRepository;
- class Problem
- {
- protected $reasonSeen;
- protected $reasons = [];
- protected $section = 0;
- public function addRule(Rule $rule): void
- {
- $this->addReason(spl_object_hash($rule), $rule);
- }
- public function getReasons(): array
- {
- return $this->reasons;
- }
- public function getPrettyString(RepositorySet $repositorySet, Request $request, Pool $pool, bool $isVerbose, array $installedMap = [], array $learnedPool = []): string
- {
- $reasons = array_merge(...array_reverse($this->reasons));
- if (count($reasons) === 1) {
- reset($reasons);
- $rule = current($reasons);
- if ($rule->getReason() !== Rule::RULE_ROOT_REQUIRE) {
- throw new \LogicException("Single reason problems must contain a root require rule.");
- }
- $reasonData = $rule->getReasonData();
- $packageName = $reasonData['packageName'];
- $constraint = $reasonData['constraint'];
- $packages = $pool->whatProvides($packageName, $constraint);
- if (count($packages) === 0) {
- return "\n ".implode(self::getMissingPackageReason($repositorySet, $request, $pool, $isVerbose, $packageName, $constraint));
- }
- }
- return self::formatDeduplicatedRules($reasons, ' ', $repositorySet, $request, $pool, $isVerbose, $installedMap, $learnedPool);
- }
- public static function formatDeduplicatedRules(array $rules, string $indent, RepositorySet $repositorySet, Request $request, Pool $pool, bool $isVerbose, array $installedMap = [], array $learnedPool = []): string
- {
- $messages = [];
- $templates = [];
- $parser = new VersionParser;
- $deduplicatableRuleTypes = [Rule::RULE_PACKAGE_REQUIRES, Rule::RULE_PACKAGE_CONFLICT];
- foreach ($rules as $rule) {
- $message = $rule->getPrettyString($repositorySet, $request, $pool, $isVerbose, $installedMap, $learnedPool);
- if (in_array($rule->getReason(), $deduplicatableRuleTypes, true) && Preg::isMatch('{^(?P<package>\S+) (?P<version>\S+) (?P<type>requires|conflicts)}', $message, $m)) {
- $template = Preg::replace('{^\S+ \S+ }', '%s%s ', $message);
- $messages[] = $template;
- $templates[$template][$m[1]][$parser->normalize($m[2])] = $m[2];
- $sourcePackage = $rule->getSourcePackage($pool);
- foreach ($pool->getRemovedVersionsByPackage(spl_object_hash($sourcePackage)) as $version => $prettyVersion) {
- $templates[$template][$m[1]][$version] = $prettyVersion;
- }
- } elseif ($message !== '') {
- $messages[] = $message;
- }
- }
- $result = [];
- foreach (array_unique($messages) as $message) {
- if (isset($templates[$message])) {
- foreach ($templates[$message] as $package => $versions) {
- uksort($versions, 'version_compare');
- if (!$isVerbose) {
- $versions = self::condenseVersionList($versions, 1);
- }
- if (count($versions) > 1) {
- $message = Preg::replace('{^(%s%s (?:require|conflict))s}', '$1', $message);
- $result[] = sprintf($message, $package, '['.implode(', ', $versions).']');
- } else {
- $result[] = sprintf($message, $package, ' '.reset($versions));
- }
- }
- } else {
- $result[] = $message;
- }
- }
- return "\n$indent- ".implode("\n$indent- ", $result);
- }
- public function isCausedByLock(RepositorySet $repositorySet, Request $request, Pool $pool): bool
- {
- foreach ($this->reasons as $sectionRules) {
- foreach ($sectionRules as $rule) {
- if ($rule->isCausedByLock($repositorySet, $request, $pool)) {
- return true;
- }
- }
- }
- return false;
- }
- protected function addReason(string $id, Rule $reason): void
- {
- if (!isset($this->reasonSeen[$id])) {
- $this->reasonSeen[$id] = true;
- $this->reasons[$this->section][] = $reason;
- }
- }
- public function nextSection(): void
- {
- $this->section++;
- }
- public static function getMissingPackageReason(RepositorySet $repositorySet, Request $request, Pool $pool, bool $isVerbose, string $packageName, ?ConstraintInterface $constraint = null): array
- {
- if (PlatformRepository::isPlatformPackage($packageName)) {
- if (0 === stripos($packageName, 'php') || $packageName === 'hhvm') {
- $version = self::getPlatformPackageVersion($pool, $packageName, phpversion());
- $msg = "- Root composer.json requires ".$packageName.self::constraintToText($constraint).' but ';
- if (defined('HHVM_VERSION') || ($packageName === 'hhvm' && count($pool->whatProvides($packageName)) > 0)) {
- return [$msg, 'your HHVM version does not satisfy that requirement.'];
- }
- if ($packageName === 'hhvm') {
- return [$msg, 'HHVM was not detected on this machine, make sure it is in your PATH.'];
- }
- if (null === $version) {
- return [$msg, 'the '.$packageName.' package is disabled by your platform config. Enable it again with "composer config platform.'.$packageName.' --unset".'];
- }
- return [$msg, 'your '.$packageName.' version ('. $version .') does not satisfy that requirement.'];
- }
- if (0 === stripos($packageName, 'ext-')) {
- if (false !== strpos($packageName, ' ')) {
- return ['- ', "PHP extension ".$packageName.' should be required as '.str_replace(' ', '-', $packageName).'.'];
- }
- $ext = substr($packageName, 4);
- $msg = "- Root composer.json requires PHP extension ".$packageName.self::constraintToText($constraint).' but ';
- $version = self::getPlatformPackageVersion($pool, $packageName, phpversion($ext) ?: '0');
- if (null === $version) {
- if (extension_loaded($ext)) {
- return [
- $msg,
- 'the '.$packageName.' package is disabled by your platform config. Enable it again with "composer config platform.'.$packageName.' --unset".',
- ];
- }
- return [$msg, 'it is missing from your system. Install or enable PHP\'s '.$ext.' extension.'];
- }
- return [$msg, 'it has the wrong version installed ('.$version.').'];
- }
- if (0 === stripos($packageName, 'lib-')) {
- if (strtolower($packageName) === 'lib-icu') {
- $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.';
- return ["- Root composer.json requires linked library ".$packageName.self::constraintToText($constraint).' but ', $error];
- }
- 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.'];
- }
- }
- $lockedPackage = null;
- foreach ($request->getLockedPackages() as $package) {
- if ($package->getName() === $packageName) {
- $lockedPackage = $package;
- if ($pool->isUnacceptableFixedOrLockedPackage($package)) {
- 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.'];
- }
- break;
- }
- }
- if ($packages = $repositorySet->findPackages($packageName, $constraint)) {
- $rootReqs = $repositorySet->getRootRequires();
- if (isset($rootReqs[$packageName])) {
- $filtered = array_filter($packages, static function ($p) use ($rootReqs, $packageName): bool {
- return $rootReqs[$packageName]->matches(new Constraint('==', $p->getVersion()));
- });
- if (0 === count($filtered)) {
- 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().').'];
- }
- }
- $tempReqs = $repositorySet->getTemporaryConstraints();
- if (isset($tempReqs[$packageName])) {
- $filtered = array_filter($packages, static function ($p) use ($tempReqs, $packageName): bool {
- return $tempReqs[$packageName]->matches(new Constraint('==', $p->getVersion()));
- });
- if (0 === count($filtered)) {
- 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().').'];
- }
- }
- if ($lockedPackage) {
- $fixedConstraint = new Constraint('==', $lockedPackage->getVersion());
- $filtered = array_filter($packages, static function ($p) use ($fixedConstraint): bool {
- return $fixedConstraint->matches(new Constraint('==', $p->getVersion()));
- });
- if (0 === count($filtered)) {
- 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.'];
- }
- }
- $nonLockedPackages = array_filter($packages, static function ($p): bool {
- return !$p->getRepository() instanceof LockArrayRepository;
- });
- if (!$nonLockedPackages) {
- 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.'];
- }
- 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.'];
- }
- if ($packages = $repositorySet->findPackages($packageName, $constraint, RepositorySet::ALLOW_UNACCEPTABLE_STABILITIES)) {
- if ($allReposPackages = $repositorySet->findPackages($packageName, $constraint, RepositorySet::ALLOW_SHADOWED_REPOSITORIES)) {
- return self::computeCheckForLowerPrioRepo($pool, $isVerbose, $packageName, $packages, $allReposPackages, 'minimum-stability', $constraint);
- }
- 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.'];
- }
- if ($packages = $repositorySet->findPackages($packageName, null, RepositorySet::ALLOW_UNACCEPTABLE_STABILITIES)) {
- if ($allReposPackages = $repositorySet->findPackages($packageName, $constraint, RepositorySet::ALLOW_SHADOWED_REPOSITORIES)) {
- return self::computeCheckForLowerPrioRepo($pool, $isVerbose, $packageName, $packages, $allReposPackages, 'constraint', $constraint);
- }
- $suffix = '';
- if ($constraint instanceof Constraint && $constraint->getVersion() === 'dev-master') {
- foreach ($packages as $candidate) {
- if (in_array($candidate->getVersion(), ['dev-default', 'dev-main'], true)) {
- $suffix = ' Perhaps dev-master was renamed to '.$candidate->getPrettyVersion().'?';
- break;
- }
- }
- }
- $allReposPackages = $packages;
- $topPackage = reset($allReposPackages);
- if ($topPackage instanceof RootPackageInterface) {
- $suffix = ' See https://getcomposer.org/dep-on-root for details and assistance.';
- }
- 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];
- }
- if (!Preg::isMatch('{^[A-Za-z0-9_./-]+$}', $packageName)) {
- $illegalChars = Preg::replace('{[A-Za-z0-9_./-]+}', '', $packageName);
- 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.'];
- }
- if ($providers = $repositorySet->getProviders($packageName)) {
- $maxProviders = 20;
- $providersStr = implode(array_map(static function ($p): string {
- $description = $p['description'] ? ' '.substr($p['description'], 0, 100) : '';
- return ' - '.$p['name'].$description."\n";
- }, count($providers) > $maxProviders + 1 ? array_slice($providers, 0, $maxProviders) : $providers));
- if (count($providers) > $maxProviders + 1) {
- $providersStr .= ' ... and '.(count($providers) - $maxProviders).' more.'."\n";
- }
- 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."];
- }
- return ["- Root composer.json requires $packageName, it ", "could not be found in any version, there may be a typo in the package name."];
- }
- public static function getPackageList(array $packages, bool $isVerbose, ?Pool $pool = null, ?ConstraintInterface $constraint = null, bool $useRemovedVersionGroup = false): string
- {
- $prepared = [];
- $hasDefaultBranch = [];
- foreach ($packages as $package) {
- $prepared[$package->getName()]['name'] = $package->getPrettyName();
- $prepared[$package->getName()]['versions'][$package->getVersion()] = $package->getPrettyVersion().($package instanceof AliasPackage ? ' (alias of '.$package->getAliasOf()->getPrettyVersion().')' : '');
- if ($pool && $constraint) {
- foreach ($pool->getRemovedVersions($package->getName(), $constraint) as $version => $prettyVersion) {
- $prepared[$package->getName()]['versions'][$version] = $prettyVersion;
- }
- }
- if ($pool && $useRemovedVersionGroup) {
- foreach ($pool->getRemovedVersionsByPackage(spl_object_hash($package)) as $version => $prettyVersion) {
- $prepared[$package->getName()]['versions'][$version] = $prettyVersion;
- }
- }
- if ($package->isDefaultBranch()) {
- $hasDefaultBranch[$package->getName()] = true;
- }
- }
- $preparedStrings = [];
- foreach ($prepared as $name => $package) {
- if (isset($package['versions'][VersionParser::DEFAULT_BRANCH_ALIAS], $hasDefaultBranch[$name])) {
- unset($package['versions'][VersionParser::DEFAULT_BRANCH_ALIAS]);
- }
- uksort($package['versions'], 'version_compare');
- if (!$isVerbose) {
- $package['versions'] = self::condenseVersionList($package['versions'], 4);
- }
- $preparedStrings[] = $package['name'].'['.implode(', ', $package['versions']).']';
- }
- return implode(', ', $preparedStrings);
- }
- private static function getPlatformPackageVersion(Pool $pool, string $packageName, string $version): ?string
- {
- $available = $pool->whatProvides($packageName);
- if (count($available)) {
- $selected = null;
- foreach ($available as $pkg) {
- if ($pkg->getRepository() instanceof PlatformRepository) {
- $selected = $pkg;
- break;
- }
- }
- if ($selected === null) {
- $selected = reset($available);
- }
- if ($selected->getName() !== $packageName) {
- foreach (array_merge(array_values($selected->getProvides()), array_values($selected->getReplaces())) as $link) {
- if ($link->getTarget() === $packageName) {
- return $link->getPrettyConstraint().' '.substr($link->getDescription(), 0, -1).'d by '.$selected->getPrettyString();
- }
- }
- }
- $version = $selected->getPrettyVersion();
- $extra = $selected->getExtra();
- if ($selected instanceof CompletePackageInterface && isset($extra['config.platform']) && $extra['config.platform'] === true) {
- $version .= '; ' . str_replace('Package ', '', $selected->getDescription());
- }
- } else {
- return null;
- }
- return $version;
- }
- private static function condenseVersionList(array $versions, int $max, int $maxDev = 16): array
- {
- if (count($versions) <= $max) {
- return $versions;
- }
- $filtered = [];
- $byMajor = [];
- foreach ($versions as $version => $pretty) {
- if (0 === stripos($version, 'dev-')) {
- $byMajor['dev'][] = $pretty;
- } else {
- $byMajor[Preg::replace('{^(\d+)\..*}', '$1', $version)][] = $pretty;
- }
- }
- foreach ($byMajor as $majorVersion => $versionsForMajor) {
- $maxVersions = $majorVersion === 'dev' ? $maxDev : $max;
- if (count($versionsForMajor) > $maxVersions) {
- $filtered[] = $versionsForMajor[0];
- $filtered[] = '...';
- $filtered[] = $versionsForMajor[count($versionsForMajor) - 1];
- } else {
- $filtered = array_merge($filtered, $versionsForMajor);
- }
- }
- return $filtered;
- }
- private static function hasMultipleNames(array $packages): bool
- {
- $name = null;
- foreach ($packages as $package) {
- if ($name === null || $name === $package->getName()) {
- $name = $package->getName();
- } else {
- return true;
- }
- }
- return false;
- }
- private static function computeCheckForLowerPrioRepo(Pool $pool, bool $isVerbose, string $packageName, array $higherRepoPackages, array $allReposPackages, string $reason, ?ConstraintInterface $constraint = null): array
- {
- $nextRepoPackages = [];
- $nextRepo = null;
- foreach ($allReposPackages as $package) {
- if ($nextRepo === null || $nextRepo === $package->getRepository()) {
- $nextRepoPackages[] = $package;
- $nextRepo = $package->getRepository();
- } else {
- break;
- }
- }
- if ($higherRepoPackages) {
- $topPackage = reset($higherRepoPackages);
- if ($topPackage instanceof RootPackageInterface) {
- return [
- "- Root composer.json requires $packageName".self::constraintToText($constraint).', it is ',
- 'satisfiable by '.self::getPackageList($nextRepoPackages, $isVerbose, $pool, $constraint).' from '.$nextRepo->getRepoName().' but '.$topPackage->getPrettyName().' is the root package and cannot be modified. See https://getcomposer.org/dep-on-root for details and assistance.',
- ];
- }
- }
- if ($nextRepo instanceof LockArrayRepository) {
- $singular = count($higherRepoPackages) === 1;
- $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).').';
- if ($nextRepoPackages[0]->getDistType() === 'path') {
- $transportOptions = $nextRepoPackages[0]->getTransportOptions();
- if (!isset($transportOptions['symlink']) || $transportOptions['symlink'] !== false) {
- $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.';
- }
- }
- return ["- Root composer.json requires $packageName".self::constraintToText($constraint) . ', ',
- '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,
- ];
- }
- 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.'];
- }
- protected static function constraintToText(?ConstraintInterface $constraint = null): string
- {
- return $constraint ? ' '.$constraint->getPrettyString() : '';
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\DependencyResolver;
- use Composer\Package\BasePackage;
- use Composer\Package\PackageInterface;
- use Composer\Repository\LockArrayRepository;
- use Composer\Semver\Constraint\ConstraintInterface;
- use Composer\Semver\Constraint\MatchAllConstraint;
- class Request
- {
- public const UPDATE_ONLY_LISTED = 0;
- public const UPDATE_LISTED_WITH_TRANSITIVE_DEPS_NO_ROOT_REQUIRE = 1;
- public const UPDATE_LISTED_WITH_TRANSITIVE_DEPS = 2;
- protected $lockedRepository;
- protected $requires = [];
- protected $fixedPackages = [];
- protected $lockedPackages = [];
- protected $fixedLockedPackages = [];
- protected $updateAllowList = [];
- protected $updateAllowTransitiveDependencies = false;
- public function __construct(?LockArrayRepository $lockedRepository = null)
- {
- $this->lockedRepository = $lockedRepository;
- }
- public function requireName(string $packageName, ?ConstraintInterface $constraint = null): void
- {
- $packageName = strtolower($packageName);
- if ($constraint === null) {
- $constraint = new MatchAllConstraint();
- }
- if (isset($this->requires[$packageName])) {
- 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');
- }
- $this->requires[$packageName] = $constraint;
- }
- public function fixPackage(BasePackage $package): void
- {
- $this->fixedPackages[spl_object_hash($package)] = $package;
- }
- public function lockPackage(BasePackage $package): void
- {
- $this->lockedPackages[spl_object_hash($package)] = $package;
- }
- public function fixLockedPackage(BasePackage $package): void
- {
- $this->fixedPackages[spl_object_hash($package)] = $package;
- $this->fixedLockedPackages[spl_object_hash($package)] = $package;
- }
- public function unlockPackage(BasePackage $package): void
- {
- unset($this->lockedPackages[spl_object_hash($package)]);
- }
- public function setUpdateAllowList(array $updateAllowList, $updateAllowTransitiveDependencies): void
- {
- $this->updateAllowList = $updateAllowList;
- $this->updateAllowTransitiveDependencies = $updateAllowTransitiveDependencies;
- }
- public function getUpdateAllowList(): array
- {
- return $this->updateAllowList;
- }
- public function getUpdateAllowTransitiveDependencies(): bool
- {
- return $this->updateAllowTransitiveDependencies !== self::UPDATE_ONLY_LISTED;
- }
- public function getUpdateAllowTransitiveRootDependencies(): bool
- {
- return $this->updateAllowTransitiveDependencies === self::UPDATE_LISTED_WITH_TRANSITIVE_DEPS;
- }
- public function getRequires(): array
- {
- return $this->requires;
- }
- public function getFixedPackages(): array
- {
- return $this->fixedPackages;
- }
- public function isFixedPackage(BasePackage $package): bool
- {
- return isset($this->fixedPackages[spl_object_hash($package)]);
- }
- public function getLockedPackages(): array
- {
- return $this->lockedPackages;
- }
- public function isLockedPackage(PackageInterface $package): bool
- {
- return isset($this->lockedPackages[spl_object_hash($package)]) || isset($this->fixedLockedPackages[spl_object_hash($package)]);
- }
- public function getFixedOrLockedPackages(): array
- {
- return array_merge($this->fixedPackages, $this->lockedPackages);
- }
- public function getPresentMap(bool $packageIds = false): array
- {
- $presentMap = [];
- if ($this->lockedRepository) {
- foreach ($this->lockedRepository->getPackages() as $package) {
- $presentMap[$packageIds ? $package->getId() : spl_object_hash($package)] = $package;
- }
- }
- foreach ($this->fixedPackages as $package) {
- $presentMap[$packageIds ? $package->getId() : spl_object_hash($package)] = $package;
- }
- return $presentMap;
- }
- public function getFixedPackagesMap(): array
- {
- $fixedPackagesMap = [];
- foreach ($this->fixedPackages as $package) {
- $fixedPackagesMap[$package->getId()] = $package;
- }
- return $fixedPackagesMap;
- }
- public function getLockedRepository(): ?LockArrayRepository
- {
- return $this->lockedRepository;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\DependencyResolver;
- use Composer\Package\AliasPackage;
- use Composer\Package\BasePackage;
- use Composer\Package\Link;
- use Composer\Repository\PlatformRepository;
- use Composer\Repository\RepositorySet;
- use Composer\Package\Version\VersionParser;
- use Composer\Semver\Constraint\Constraint;
- use Composer\Semver\Constraint\ConstraintInterface;
- abstract class Rule
- {
- public const RULE_ROOT_REQUIRE = 2;
- public const RULE_FIXED = 3;
- public const RULE_PACKAGE_CONFLICT = 6;
- public const RULE_PACKAGE_REQUIRES = 7;
- public const RULE_PACKAGE_SAME_NAME = 10;
- public const RULE_LEARNED = 12;
- public const RULE_PACKAGE_ALIAS = 13;
- public const RULE_PACKAGE_INVERSE_ALIAS = 14;
- private const BITFIELD_TYPE = 0;
- private const BITFIELD_REASON = 8;
- private const BITFIELD_DISABLED = 16;
- protected $bitfield;
- protected $request;
- protected $reasonData;
- public function __construct($reason, $reasonData)
- {
- $this->reasonData = $reasonData;
- $this->bitfield = (0 << self::BITFIELD_DISABLED) |
- ($reason << self::BITFIELD_REASON) |
- (255 << self::BITFIELD_TYPE);
- }
- abstract public function getLiterals(): array;
- abstract public function getHash();
- abstract public function __toString(): string;
- abstract public function equals(Rule $rule): bool;
- public function getReason(): int
- {
- return ($this->bitfield & (255 << self::BITFIELD_REASON)) >> self::BITFIELD_REASON;
- }
- public function getReasonData()
- {
- return $this->reasonData;
- }
- public function getRequiredPackage(): ?string
- {
- switch ($this->getReason()) {
- case self::RULE_ROOT_REQUIRE:
- return $this->getReasonData()['packageName'];
- case self::RULE_FIXED:
- return $this->getReasonData()['package']->getName();
- case self::RULE_PACKAGE_REQUIRES:
- return $this->getReasonData()->getTarget();
- }
- return null;
- }
- public function setType($type): void
- {
- $this->bitfield = ($this->bitfield & ~(255 << self::BITFIELD_TYPE)) | ((255 & $type) << self::BITFIELD_TYPE);
- }
- public function getType(): int
- {
- return ($this->bitfield & (255 << self::BITFIELD_TYPE)) >> self::BITFIELD_TYPE;
- }
- public function disable(): void
- {
- $this->bitfield = ($this->bitfield & ~(255 << self::BITFIELD_DISABLED)) | (1 << self::BITFIELD_DISABLED);
- }
- public function enable(): void
- {
- $this->bitfield &= ~(255 << self::BITFIELD_DISABLED);
- }
- public function isDisabled(): bool
- {
- return (bool) (($this->bitfield & (255 << self::BITFIELD_DISABLED)) >> self::BITFIELD_DISABLED);
- }
- public function isEnabled(): bool
- {
- return !(($this->bitfield & (255 << self::BITFIELD_DISABLED)) >> self::BITFIELD_DISABLED);
- }
- abstract public function isAssertion(): bool;
- public function isCausedByLock(RepositorySet $repositorySet, Request $request, Pool $pool): bool
- {
- if ($this->getReason() === self::RULE_PACKAGE_REQUIRES) {
- if (PlatformRepository::isPlatformPackage($this->getReasonData()->getTarget())) {
- return false;
- }
- if ($request->getLockedRepository()) {
- foreach ($request->getLockedRepository()->getPackages() as $package) {
- if ($package->getName() === $this->getReasonData()->getTarget()) {
- if ($pool->isUnacceptableFixedOrLockedPackage($package)) {
- return true;
- }
- if (!$this->getReasonData()->getConstraint()->matches(new Constraint('=', $package->getVersion()))) {
- return true;
- }
- if (!$request->isLockedPackage($package)) {
- return true;
- }
- break;
- }
- }
- }
- }
- if ($this->getReason() === self::RULE_ROOT_REQUIRE) {
- if (PlatformRepository::isPlatformPackage($this->getReasonData()['packageName'])) {
- return false;
- }
- if ($request->getLockedRepository()) {
- foreach ($request->getLockedRepository()->getPackages() as $package) {
- if ($package->getName() === $this->getReasonData()['packageName']) {
- if ($pool->isUnacceptableFixedOrLockedPackage($package)) {
- return true;
- }
- if (!$this->getReasonData()['constraint']->matches(new Constraint('=', $package->getVersion()))) {
- return true;
- }
- break;
- }
- }
- }
- }
- return false;
- }
- public function getSourcePackage(Pool $pool): BasePackage
- {
- $literals = $this->getLiterals();
- switch ($this->getReason()) {
- case self::RULE_PACKAGE_CONFLICT:
- $package1 = $this->deduplicateDefaultBranchAlias($pool->literalToPackage($literals[0]));
- $package2 = $this->deduplicateDefaultBranchAlias($pool->literalToPackage($literals[1]));
- $reasonData = $this->getReasonData();
- if ($reasonData->getSource() === $package1->getName()) {
- [$package2, $package1] = [$package1, $package2];
- }
- return $package2;
- case self::RULE_PACKAGE_REQUIRES:
- $sourceLiteral = array_shift($literals);
- $sourcePackage = $this->deduplicateDefaultBranchAlias($pool->literalToPackage($sourceLiteral));
- return $sourcePackage;
- default:
- throw new \LogicException('Not implemented');
- }
- }
- public function getPrettyString(RepositorySet $repositorySet, Request $request, Pool $pool, bool $isVerbose, array $installedMap = [], array $learnedPool = []): string
- {
- $literals = $this->getLiterals();
- switch ($this->getReason()) {
- case self::RULE_ROOT_REQUIRE:
- $reasonData = $this->getReasonData();
- $packageName = $reasonData['packageName'];
- $constraint = $reasonData['constraint'];
- $packages = $pool->whatProvides($packageName, $constraint);
- if (!$packages) {
- return 'No package found to satisfy root composer.json require '.$packageName.' '.$constraint->getPrettyString();
- }
- $packagesNonAlias = array_values(array_filter($packages, static function ($p): bool {
- return !($p instanceof AliasPackage);
- }));
- if (count($packagesNonAlias) === 1) {
- $package = $packagesNonAlias[0];
- if ($request->isLockedPackage($package)) {
- return $package->getPrettyName().' is locked to version '.$package->getPrettyVersion()." and an update of this package was not requested.";
- }
- }
- return 'Root composer.json requires '.$packageName.' '.$constraint->getPrettyString().' -> satisfiable by '.$this->formatPackagesUnique($pool, $packages, $isVerbose, $constraint).'.';
- case self::RULE_FIXED:
- $package = $this->deduplicateDefaultBranchAlias($this->getReasonData()['package']);
- if ($request->isLockedPackage($package)) {
- return $package->getPrettyName().' is locked to version '.$package->getPrettyVersion().' and an update of this package was not requested.';
- }
- return $package->getPrettyName().' is present at version '.$package->getPrettyVersion() . ' and cannot be modified by Composer';
- case self::RULE_PACKAGE_CONFLICT:
- $package1 = $this->deduplicateDefaultBranchAlias($pool->literalToPackage($literals[0]));
- $package2 = $this->deduplicateDefaultBranchAlias($pool->literalToPackage($literals[1]));
- $conflictTarget = $package1->getPrettyString();
- $reasonData = $this->getReasonData();
- if ($reasonData->getSource() === $package1->getName()) {
- [$package2, $package1] = [$package1, $package2];
- $conflictTarget = $package1->getPrettyName().' '.$reasonData->getPrettyConstraint();
- }
- if ($reasonData->getTarget() !== $package1->getName()) {
- $provideType = null;
- $provided = null;
- foreach ($package1->getProvides() as $provide) {
- if ($provide->getTarget() === $reasonData->getTarget()) {
- $provideType = 'provides';
- $provided = $provide->getPrettyConstraint();
- break;
- }
- }
- foreach ($package1->getReplaces() as $replace) {
- if ($replace->getTarget() === $reasonData->getTarget()) {
- $provideType = 'replaces';
- $provided = $replace->getPrettyConstraint();
- break;
- }
- }
- if (null !== $provideType) {
- $conflictTarget = $reasonData->getTarget().' '.$reasonData->getPrettyConstraint().' ('.$package1->getPrettyString().' '.$provideType.' '.$reasonData->getTarget().' '.$provided.')';
- }
- }
- return $package2->getPrettyString().' conflicts with '.$conflictTarget.'.';
- case self::RULE_PACKAGE_REQUIRES:
- $sourceLiteral = array_shift($literals);
- $sourcePackage = $this->deduplicateDefaultBranchAlias($pool->literalToPackage($sourceLiteral));
- $reasonData = $this->getReasonData();
- $requires = [];
- foreach ($literals as $literal) {
- $requires[] = $pool->literalToPackage($literal);
- }
- $text = $reasonData->getPrettyString($sourcePackage);
- if ($requires) {
- $text .= ' -> satisfiable by ' . $this->formatPackagesUnique($pool, $requires, $isVerbose, $reasonData->getConstraint()) . '.';
- } else {
- $targetName = $reasonData->getTarget();
- $reason = Problem::getMissingPackageReason($repositorySet, $request, $pool, $isVerbose, $targetName, $reasonData->getConstraint());
- return $text . ' -> ' . $reason[1];
- }
- return $text;
- case self::RULE_PACKAGE_SAME_NAME:
- $packageNames = [];
- foreach ($literals as $literal) {
- $package = $pool->literalToPackage($literal);
- $packageNames[$package->getName()] = true;
- }
- $replacedName = $this->getReasonData();
- if (count($packageNames) > 1) {
- $reason = null;
- if (!isset($packageNames[$replacedName])) {
- $reason = 'They '.(count($literals) === 2 ? 'both' : 'all').' replace '.$replacedName.' and thus cannot coexist.';
- } else {
- $replacerNames = $packageNames;
- unset($replacerNames[$replacedName]);
- $replacerNames = array_keys($replacerNames);
- if (count($replacerNames) === 1) {
- $reason = $replacerNames[0] . ' replaces ';
- } else {
- $reason = '['.implode(', ', $replacerNames).'] replace ';
- }
- $reason .= $replacedName.' and thus cannot coexist with it.';
- }
- $installedPackages = [];
- $removablePackages = [];
- foreach ($literals as $literal) {
- if (isset($installedMap[abs($literal)])) {
- $installedPackages[] = $pool->literalToPackage($literal);
- } else {
- $removablePackages[] = $pool->literalToPackage($literal);
- }
- }
- if ($installedPackages && $removablePackages) {
- return $this->formatPackagesUnique($pool, $removablePackages, $isVerbose, null, true).' cannot be installed as that would require removing '.$this->formatPackagesUnique($pool, $installedPackages, $isVerbose, null, true).'. '.$reason;
- }
- return 'Only one of these can be installed: '.$this->formatPackagesUnique($pool, $literals, $isVerbose, null, true).'. '.$reason;
- }
- 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) . '.';
- case self::RULE_LEARNED:
- $learnedString = ' (conflict analysis result)';
- if (count($literals) === 1) {
- $ruleText = $pool->literalToPrettyString($literals[0], $installedMap);
- } else {
- $groups = [];
- foreach ($literals as $literal) {
- $package = $pool->literalToPackage($literal);
- if (isset($installedMap[$package->id])) {
- $group = $literal > 0 ? 'keep' : 'remove';
- } else {
- $group = $literal > 0 ? 'install' : 'don\'t install';
- }
- $groups[$group][] = $this->deduplicateDefaultBranchAlias($package);
- }
- $ruleTexts = [];
- foreach ($groups as $group => $packages) {
- $ruleTexts[] = $group . (count($packages) > 1 ? ' one of' : '').' ' . $this->formatPackagesUnique($pool, $packages, $isVerbose);
- }
- $ruleText = implode(' | ', $ruleTexts);
- }
- return 'Conclusion: '.$ruleText.$learnedString;
- case self::RULE_PACKAGE_ALIAS:
- $aliasPackage = $pool->literalToPackage($literals[0]);
- if ($aliasPackage->getVersion() === VersionParser::DEFAULT_BRANCH_ALIAS) {
- return '';
- }
- $package = $this->deduplicateDefaultBranchAlias($pool->literalToPackage($literals[1]));
- return $aliasPackage->getPrettyString() .' is an alias of '.$package->getPrettyString().' and thus requires it to be installed too.';
- case self::RULE_PACKAGE_INVERSE_ALIAS:
- $aliasPackage = $pool->literalToPackage($literals[1]);
- if ($aliasPackage->getVersion() === VersionParser::DEFAULT_BRANCH_ALIAS) {
- return '';
- }
- $package = $this->deduplicateDefaultBranchAlias($pool->literalToPackage($literals[0]));
- return $aliasPackage->getPrettyString() .' is an alias of '.$package->getPrettyString().' and must be installed with it.';
- default:
- $ruleText = '';
- foreach ($literals as $i => $literal) {
- if ($i !== 0) {
- $ruleText .= '|';
- }
- $ruleText .= $pool->literalToPrettyString($literal, $installedMap);
- }
- return '('.$ruleText.')';
- }
- }
- protected function formatPackagesUnique(Pool $pool, array $packages, bool $isVerbose, ?ConstraintInterface $constraint = null, bool $useRemovedVersionGroup = false): string
- {
- foreach ($packages as $index => $package) {
- if (!\is_object($package)) {
- $packages[$index] = $pool->literalToPackage($package);
- }
- }
- return Problem::getPackageList($packages, $isVerbose, $pool, $constraint, $useRemovedVersionGroup);
- }
- private function deduplicateDefaultBranchAlias(BasePackage $package): BasePackage
- {
- if ($package instanceof AliasPackage && $package->getPrettyVersion() === VersionParser::DEFAULT_BRANCH_ALIAS) {
- $package = $package->getAliasOf();
- }
- return $package;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\DependencyResolver;
- class Rule2Literals extends Rule
- {
- protected $literal1;
- protected $literal2;
- public function __construct(int $literal1, int $literal2, $reason, $reasonData)
- {
- parent::__construct($reason, $reasonData);
- if ($literal1 < $literal2) {
- $this->literal1 = $literal1;
- $this->literal2 = $literal2;
- } else {
- $this->literal1 = $literal2;
- $this->literal2 = $literal1;
- }
- }
- public function getLiterals(): array
- {
- return [$this->literal1, $this->literal2];
- }
- public function getHash()
- {
- return $this->literal1.','.$this->literal2;
- }
- public function equals(Rule $rule): bool
- {
- if ($rule instanceof self) {
- if ($this->literal1 !== $rule->literal1) {
- return false;
- }
- if ($this->literal2 !== $rule->literal2) {
- return false;
- }
- return true;
- }
- $literals = $rule->getLiterals();
- if (2 !== \count($literals)) {
- return false;
- }
- if ($this->literal1 !== $literals[0]) {
- return false;
- }
- if ($this->literal2 !== $literals[1]) {
- return false;
- }
- return true;
- }
- public function isAssertion(): bool
- {
- return false;
- }
- public function __toString(): string
- {
- $result = $this->isDisabled() ? 'disabled(' : '(';
- $result .= $this->literal1 . '|' . $this->literal2 . ')';
- return $result;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\DependencyResolver;
- use Composer\Repository\RepositorySet;
- class RuleSet implements \IteratorAggregate, \Countable
- {
- public const TYPE_PACKAGE = 0;
- public const TYPE_REQUEST = 1;
- public const TYPE_LEARNED = 4;
- public $ruleById = [];
- protected static $types = [
- self::TYPE_PACKAGE => 'PACKAGE',
- self::TYPE_REQUEST => 'REQUEST',
- self::TYPE_LEARNED => 'LEARNED',
- ];
- protected $rules;
- protected $nextRuleId = 0;
- protected $rulesByHash = [];
- public function __construct()
- {
- foreach ($this->getTypes() as $type) {
- $this->rules[$type] = [];
- }
- }
- public function add(Rule $rule, $type): void
- {
- if (!isset(self::$types[$type])) {
- throw new \OutOfBoundsException('Unknown rule type: ' . $type);
- }
- $hash = $rule->getHash();
- if (isset($this->rulesByHash[$hash])) {
- $potentialDuplicates = $this->rulesByHash[$hash];
- if (\is_array($potentialDuplicates)) {
- foreach ($potentialDuplicates as $potentialDuplicate) {
- if ($rule->equals($potentialDuplicate)) {
- return;
- }
- }
- } else {
- if ($rule->equals($potentialDuplicates)) {
- return;
- }
- }
- }
- if (!isset($this->rules[$type])) {
- $this->rules[$type] = [];
- }
- $this->rules[$type][] = $rule;
- $this->ruleById[$this->nextRuleId] = $rule;
- $rule->setType($type);
- $this->nextRuleId++;
- if (!isset($this->rulesByHash[$hash])) {
- $this->rulesByHash[$hash] = $rule;
- } elseif (\is_array($this->rulesByHash[$hash])) {
- $this->rulesByHash[$hash][] = $rule;
- } else {
- $originalRule = $this->rulesByHash[$hash];
- $this->rulesByHash[$hash] = [$originalRule, $rule];
- }
- }
- public function count(): int
- {
- return $this->nextRuleId;
- }
- public function ruleById(int $id): Rule
- {
- return $this->ruleById[$id];
- }
- public function getRules(): array
- {
- return $this->rules;
- }
- public function getIterator(): RuleSetIterator
- {
- return new RuleSetIterator($this->getRules());
- }
- public function getIteratorFor($types): RuleSetIterator
- {
- if (!\is_array($types)) {
- $types = [$types];
- }
- $allRules = $this->getRules();
- $rules = [];
- foreach ($types as $type) {
- $rules[$type] = $allRules[$type];
- }
- return new RuleSetIterator($rules);
- }
- public function getIteratorWithout($types): RuleSetIterator
- {
- if (!\is_array($types)) {
- $types = [$types];
- }
- $rules = $this->getRules();
- foreach ($types as $type) {
- unset($rules[$type]);
- }
- return new RuleSetIterator($rules);
- }
- public function getTypes(): array
- {
- $types = self::$types;
- return array_keys($types);
- }
- public function getPrettyString(?RepositorySet $repositorySet = null, ?Request $request = null, ?Pool $pool = null, bool $isVerbose = false): string
- {
- $string = "\n";
- foreach ($this->rules as $type => $rules) {
- $string .= str_pad(self::$types[$type], 8, ' ') . ": ";
- foreach ($rules as $rule) {
- $string .= ($repositorySet && $request && $pool ? $rule->getPrettyString($repositorySet, $request, $pool, $isVerbose) : $rule)."\n";
- }
- $string .= "\n\n";
- }
- return $string;
- }
- public function __toString(): string
- {
- return $this->getPrettyString();
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\DependencyResolver;
- use Composer\Filter\PlatformRequirementFilter\IgnoreListPlatformRequirementFilter;
- use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterFactory;
- use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterInterface;
- use Composer\Package\BasePackage;
- use Composer\Package\AliasPackage;
- class RuleSetGenerator
- {
- protected $policy;
- protected $pool;
- protected $rules;
- protected $addedMap = [];
- protected $addedPackagesByNames = [];
- public function __construct(PolicyInterface $policy, Pool $pool)
- {
- $this->policy = $policy;
- $this->pool = $pool;
- $this->rules = new RuleSet;
- }
- protected function createRequireRule(BasePackage $package, array $providers, $reason, $reasonData = null): ?Rule
- {
- $literals = [-$package->id];
- foreach ($providers as $provider) {
- if ($provider === $package) {
- return null;
- }
- $literals[] = $provider->id;
- }
- return new GenericRule($literals, $reason, $reasonData);
- }
- protected function createInstallOneOfRule(array $packages, $reason, $reasonData): Rule
- {
- $literals = [];
- foreach ($packages as $package) {
- $literals[] = $package->id;
- }
- return new GenericRule($literals, $reason, $reasonData);
- }
- protected function createRule2Literals(BasePackage $issuer, BasePackage $provider, $reason, $reasonData = null): ?Rule
- {
- if ($issuer === $provider) {
- return null;
- }
- return new Rule2Literals(-$issuer->id, -$provider->id, $reason, $reasonData);
- }
- protected function createMultiConflictRule(array $packages, $reason, $reasonData): Rule
- {
- $literals = [];
- foreach ($packages as $package) {
- $literals[] = -$package->id;
- }
- if (\count($literals) === 2) {
- return new Rule2Literals($literals[0], $literals[1], $reason, $reasonData);
- }
- return new MultiConflictRule($literals, $reason, $reasonData);
- }
- private function addRule($type, ?Rule $newRule = null): void
- {
- if (!$newRule) {
- return;
- }
- $this->rules->add($newRule, $type);
- }
- protected function addRulesForPackage(BasePackage $package, PlatformRequirementFilterInterface $platformRequirementFilter): void
- {
- $workQueue = new \SplQueue;
- $workQueue->enqueue($package);
- while (!$workQueue->isEmpty()) {
- $package = $workQueue->dequeue();
- if (isset($this->addedMap[$package->id])) {
- continue;
- }
- $this->addedMap[$package->id] = $package;
- if (!$package instanceof AliasPackage) {
- foreach ($package->getNames(false) as $name) {
- $this->addedPackagesByNames[$name][] = $package;
- }
- } else {
- $workQueue->enqueue($package->getAliasOf());
- $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRequireRule($package, [$package->getAliasOf()], Rule::RULE_PACKAGE_ALIAS, $package));
- $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRequireRule($package->getAliasOf(), [$package], Rule::RULE_PACKAGE_INVERSE_ALIAS, $package->getAliasOf()));
- if (!$package->hasSelfVersionRequires()) {
- continue;
- }
- }
- foreach ($package->getRequires() as $link) {
- $constraint = $link->getConstraint();
- if ($platformRequirementFilter->isIgnored($link->getTarget())) {
- continue;
- } elseif ($platformRequirementFilter instanceof IgnoreListPlatformRequirementFilter) {
- $constraint = $platformRequirementFilter->filterConstraint($link->getTarget(), $constraint);
- }
- $possibleRequires = $this->pool->whatProvides($link->getTarget(), $constraint);
- $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRequireRule($package, $possibleRequires, Rule::RULE_PACKAGE_REQUIRES, $link));
- foreach ($possibleRequires as $require) {
- $workQueue->enqueue($require);
- }
- }
- }
- }
- protected function addConflictRules(PlatformRequirementFilterInterface $platformRequirementFilter): void
- {
- foreach ($this->addedMap as $package) {
- foreach ($package->getConflicts() as $link) {
- if (!isset($this->addedPackagesByNames[$link->getTarget()])) {
- continue;
- }
- $constraint = $link->getConstraint();
- if ($platformRequirementFilter->isIgnored($link->getTarget())) {
- continue;
- } elseif ($platformRequirementFilter instanceof IgnoreListPlatformRequirementFilter) {
- $constraint = $platformRequirementFilter->filterConstraint($link->getTarget(), $constraint);
- }
- $conflicts = $this->pool->whatProvides($link->getTarget(), $constraint);
- foreach ($conflicts as $conflict) {
- if (!$conflict instanceof AliasPackage || $conflict->getName() === $link->getTarget()) {
- $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRule2Literals($package, $conflict, Rule::RULE_PACKAGE_CONFLICT, $link));
- }
- }
- }
- }
- foreach ($this->addedPackagesByNames as $name => $packages) {
- if (\count($packages) > 1) {
- $reason = Rule::RULE_PACKAGE_SAME_NAME;
- $this->addRule(RuleSet::TYPE_PACKAGE, $this->createMultiConflictRule($packages, $reason, $name));
- }
- }
- }
- protected function addRulesForRequest(Request $request, PlatformRequirementFilterInterface $platformRequirementFilter): void
- {
- foreach ($request->getFixedPackages() as $package) {
- if ($package->id === -1) {
- if ($this->pool->isUnacceptableFixedOrLockedPackage($package)) {
- continue;
- }
- throw new \LogicException("Fixed package ".$package->getPrettyString()." was not added to solver pool.");
- }
- $this->addRulesForPackage($package, $platformRequirementFilter);
- $rule = $this->createInstallOneOfRule([$package], Rule::RULE_FIXED, [
- 'package' => $package,
- ]);
- $this->addRule(RuleSet::TYPE_REQUEST, $rule);
- }
- foreach ($request->getRequires() as $packageName => $constraint) {
- if ($platformRequirementFilter->isIgnored($packageName)) {
- continue;
- } elseif ($platformRequirementFilter instanceof IgnoreListPlatformRequirementFilter) {
- $constraint = $platformRequirementFilter->filterConstraint($packageName, $constraint);
- }
- $packages = $this->pool->whatProvides($packageName, $constraint);
- if ($packages) {
- foreach ($packages as $package) {
- $this->addRulesForPackage($package, $platformRequirementFilter);
- }
- $rule = $this->createInstallOneOfRule($packages, Rule::RULE_ROOT_REQUIRE, [
- 'packageName' => $packageName,
- 'constraint' => $constraint,
- ]);
- $this->addRule(RuleSet::TYPE_REQUEST, $rule);
- }
- }
- }
- protected function addRulesForRootAliases(PlatformRequirementFilterInterface $platformRequirementFilter): void
- {
- foreach ($this->pool->getPackages() as $package) {
- if (!isset($this->addedMap[$package->id]) &&
- $package instanceof AliasPackage &&
- ($package->isRootPackageAlias() || isset($this->addedMap[$package->getAliasOf()->id]))
- ) {
- $this->addRulesForPackage($package, $platformRequirementFilter);
- }
- }
- }
- public function getRulesFor(Request $request, ?PlatformRequirementFilterInterface $platformRequirementFilter = null): RuleSet
- {
- $platformRequirementFilter = $platformRequirementFilter ?: PlatformRequirementFilterFactory::ignoreNothing();
- $this->addRulesForRequest($request, $platformRequirementFilter);
- $this->addRulesForRootAliases($platformRequirementFilter);
- $this->addConflictRules($platformRequirementFilter);
- $this->addedMap = $this->addedPackagesByNames = [];
- $rules = $this->rules;
- $this->rules = new RuleSet;
- return $rules;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\DependencyResolver;
- class RuleSetIterator implements \Iterator
- {
- protected $rules;
- protected $types;
- protected $currentOffset;
- protected $currentType;
- protected $currentTypeOffset;
- public function __construct(array $rules)
- {
- $this->rules = $rules;
- $this->types = array_keys($rules);
- sort($this->types);
- $this->rewind();
- }
- public function current(): Rule
- {
- return $this->rules[$this->currentType][$this->currentOffset];
- }
- public function key(): int
- {
- return $this->currentType;
- }
- public function next(): void
- {
- $this->currentOffset++;
- if (!isset($this->rules[$this->currentType])) {
- return;
- }
- if ($this->currentOffset >= \count($this->rules[$this->currentType])) {
- $this->currentOffset = 0;
- do {
- $this->currentTypeOffset++;
- if (!isset($this->types[$this->currentTypeOffset])) {
- $this->currentType = -1;
- break;
- }
- $this->currentType = $this->types[$this->currentTypeOffset];
- } while (0 === \count($this->rules[$this->currentType]));
- }
- }
- public function rewind(): void
- {
- $this->currentOffset = 0;
- $this->currentTypeOffset = -1;
- $this->currentType = -1;
- do {
- $this->currentTypeOffset++;
- if (!isset($this->types[$this->currentTypeOffset])) {
- $this->currentType = -1;
- break;
- }
- $this->currentType = $this->types[$this->currentTypeOffset];
- } while (0 === \count($this->rules[$this->currentType]));
- }
- public function valid(): bool
- {
- return isset($this->rules[$this->currentType], $this->rules[$this->currentType][$this->currentOffset]);
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\DependencyResolver;
- class RuleWatchChain extends \SplDoublyLinkedList
- {
- public function seek(int $offset): void
- {
- $this->rewind();
- for ($i = 0; $i < $offset; $i++, $this->next());
- }
- public function remove(): void
- {
- $offset = $this->key();
- $this->offsetUnset($offset);
- $this->seek($offset);
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\DependencyResolver;
- class RuleWatchGraph
- {
- protected $watchChains = [];
- public function insert(RuleWatchNode $node): void
- {
- if ($node->getRule()->isAssertion()) {
- return;
- }
- if (!$node->getRule() instanceof MultiConflictRule) {
- foreach ([$node->watch1, $node->watch2] as $literal) {
- if (!isset($this->watchChains[$literal])) {
- $this->watchChains[$literal] = new RuleWatchChain;
- }
- $this->watchChains[$literal]->unshift($node);
- }
- } else {
- foreach ($node->getRule()->getLiterals() as $literal) {
- if (!isset($this->watchChains[$literal])) {
- $this->watchChains[$literal] = new RuleWatchChain;
- }
- $this->watchChains[$literal]->unshift($node);
- }
- }
- }
- public function propagateLiteral(int $decidedLiteral, int $level, Decisions $decisions): ?Rule
- {
- $literal = -$decidedLiteral;
- if (!isset($this->watchChains[$literal])) {
- return null;
- }
- $chain = $this->watchChains[$literal];
- $chain->rewind();
- while ($chain->valid()) {
- $node = $chain->current();
- if (!$node->getRule() instanceof MultiConflictRule) {
- $otherWatch = $node->getOtherWatch($literal);
- if (!$node->getRule()->isDisabled() && !$decisions->satisfy($otherWatch)) {
- $ruleLiterals = $node->getRule()->getLiterals();
- $alternativeLiterals = array_filter($ruleLiterals, static function ($ruleLiteral) use ($literal, $otherWatch, $decisions): bool {
- return $literal !== $ruleLiteral &&
- $otherWatch !== $ruleLiteral &&
- !$decisions->conflict($ruleLiteral);
- });
- if (\count($alternativeLiterals) > 0) {
- reset($alternativeLiterals);
- $this->moveWatch($literal, current($alternativeLiterals), $node);
- continue;
- }
- if ($decisions->conflict($otherWatch)) {
- return $node->getRule();
- }
- $decisions->decide($otherWatch, $level, $node->getRule());
- }
- } else {
- foreach ($node->getRule()->getLiterals() as $otherLiteral) {
- if ($literal !== $otherLiteral && !$decisions->satisfy($otherLiteral)) {
- if ($decisions->conflict($otherLiteral)) {
- return $node->getRule();
- }
- $decisions->decide($otherLiteral, $level, $node->getRule());
- }
- }
- }
- $chain->next();
- }
- return null;
- }
- protected function moveWatch(int $fromLiteral, int $toLiteral, RuleWatchNode $node): void
- {
- if (!isset($this->watchChains[$toLiteral])) {
- $this->watchChains[$toLiteral] = new RuleWatchChain;
- }
- $node->moveWatch($fromLiteral, $toLiteral);
- $this->watchChains[$fromLiteral]->remove();
- $this->watchChains[$toLiteral]->unshift($node);
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\DependencyResolver;
- class RuleWatchNode
- {
- public $watch1;
- public $watch2;
- protected $rule;
- public function __construct(Rule $rule)
- {
- $this->rule = $rule;
- $literals = $rule->getLiterals();
- $literalCount = \count($literals);
- $this->watch1 = $literalCount > 0 ? $literals[0] : 0;
- $this->watch2 = $literalCount > 1 ? $literals[1] : 0;
- }
- public function watch2OnHighest(Decisions $decisions): void
- {
- $literals = $this->rule->getLiterals();
- if (\count($literals) < 3 || $this->rule instanceof MultiConflictRule) {
- return;
- }
- $watchLevel = 0;
- foreach ($literals as $literal) {
- $level = $decisions->decisionLevel($literal);
- if ($level > $watchLevel) {
- $this->watch2 = $literal;
- $watchLevel = $level;
- }
- }
- }
- public function getRule(): Rule
- {
- return $this->rule;
- }
- public function getOtherWatch(int $literal): int
- {
- if ($this->watch1 === $literal) {
- return $this->watch2;
- }
- return $this->watch1;
- }
- public function moveWatch(int $from, int $to): void
- {
- if ($this->watch1 === $from) {
- $this->watch1 = $to;
- } else {
- $this->watch2 = $to;
- }
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\DependencyResolver;
- use Composer\Filter\PlatformRequirementFilter\IgnoreListPlatformRequirementFilter;
- use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterFactory;
- use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterInterface;
- use Composer\IO\IOInterface;
- use Composer\Package\BasePackage;
- class Solver
- {
- private const BRANCH_LITERALS = 0;
- private const BRANCH_LEVEL = 1;
- protected $policy;
- protected $pool;
- protected $rules;
- protected $watchGraph;
- protected $decisions;
- protected $fixedMap;
- protected $propagateIndex;
- protected $branches = [];
- protected $problems = [];
- protected $learnedPool = [];
- protected $learnedWhy = [];
- public $testFlagLearnedPositiveLiteral = false;
- protected $io;
- public function __construct(PolicyInterface $policy, Pool $pool, IOInterface $io)
- {
- $this->io = $io;
- $this->policy = $policy;
- $this->pool = $pool;
- }
- public function getRuleSetSize(): int
- {
- return \count($this->rules);
- }
- public function getPool(): Pool
- {
- return $this->pool;
- }
- private function makeAssertionRuleDecisions(): void
- {
- $decisionStart = \count($this->decisions) - 1;
- $rulesCount = \count($this->rules);
- for ($ruleIndex = 0; $ruleIndex < $rulesCount; $ruleIndex++) {
- $rule = $this->rules->ruleById[$ruleIndex];
- if (!$rule->isAssertion() || $rule->isDisabled()) {
- continue;
- }
- $literals = $rule->getLiterals();
- $literal = $literals[0];
- if (!$this->decisions->decided($literal)) {
- $this->decisions->decide($literal, 1, $rule);
- continue;
- }
- if ($this->decisions->satisfy($literal)) {
- continue;
- }
- if (RuleSet::TYPE_LEARNED === $rule->getType()) {
- $rule->disable();
- continue;
- }
- $conflict = $this->decisions->decisionRule($literal);
- if ($conflict && RuleSet::TYPE_PACKAGE === $conflict->getType()) {
- $problem = new Problem();
- $problem->addRule($rule);
- $problem->addRule($conflict);
- $rule->disable();
- $this->problems[] = $problem;
- continue;
- }
- $problem = new Problem();
- $problem->addRule($rule);
- $problem->addRule($conflict);
- foreach ($this->rules->getIteratorFor(RuleSet::TYPE_REQUEST) as $assertRule) {
- if ($assertRule->isDisabled() || !$assertRule->isAssertion()) {
- continue;
- }
- $assertRuleLiterals = $assertRule->getLiterals();
- $assertRuleLiteral = $assertRuleLiterals[0];
- if (abs($literal) !== abs($assertRuleLiteral)) {
- continue;
- }
- $problem->addRule($assertRule);
- $assertRule->disable();
- }
- $this->problems[] = $problem;
- $this->decisions->resetToOffset($decisionStart);
- $ruleIndex = -1;
- }
- }
- protected function setupFixedMap(Request $request): void
- {
- $this->fixedMap = [];
- foreach ($request->getFixedPackages() as $package) {
- $this->fixedMap[$package->id] = $package;
- }
- }
- protected function checkForRootRequireProblems(Request $request, PlatformRequirementFilterInterface $platformRequirementFilter): void
- {
- foreach ($request->getRequires() as $packageName => $constraint) {
- if ($platformRequirementFilter->isIgnored($packageName)) {
- continue;
- } elseif ($platformRequirementFilter instanceof IgnoreListPlatformRequirementFilter) {
- $constraint = $platformRequirementFilter->filterConstraint($packageName, $constraint);
- }
- if (!$this->pool->whatProvides($packageName, $constraint)) {
- $problem = new Problem();
- $problem->addRule(new GenericRule([], Rule::RULE_ROOT_REQUIRE, ['packageName' => $packageName, 'constraint' => $constraint]));
- $this->problems[] = $problem;
- }
- }
- }
- public function solve(Request $request, ?PlatformRequirementFilterInterface $platformRequirementFilter = null): LockTransaction
- {
- $platformRequirementFilter = $platformRequirementFilter ?: PlatformRequirementFilterFactory::ignoreNothing();
- $this->setupFixedMap($request);
- $this->io->writeError('Generating rules', true, IOInterface::DEBUG);
- $ruleSetGenerator = new RuleSetGenerator($this->policy, $this->pool);
- $this->rules = $ruleSetGenerator->getRulesFor($request, $platformRequirementFilter);
- unset($ruleSetGenerator);
- $this->checkForRootRequireProblems($request, $platformRequirementFilter);
- $this->decisions = new Decisions($this->pool);
- $this->watchGraph = new RuleWatchGraph;
- foreach ($this->rules as $rule) {
- $this->watchGraph->insert(new RuleWatchNode($rule));
- }
- $this->makeAssertionRuleDecisions();
- $this->io->writeError('Resolving dependencies through SAT', true, IOInterface::DEBUG);
- $before = microtime(true);
- $this->runSat();
- $this->io->writeError('', true, IOInterface::DEBUG);
- $this->io->writeError(sprintf('Dependency resolution completed in %.3f seconds', microtime(true) - $before), true, IOInterface::VERBOSE);
- if ($this->problems) {
- throw new SolverProblemsException($this->problems, $this->learnedPool);
- }
- return new LockTransaction($this->pool, $request->getPresentMap(), $request->getFixedPackagesMap(), $this->decisions);
- }
- protected function propagate(int $level): ?Rule
- {
- while ($this->decisions->validOffset($this->propagateIndex)) {
- $decision = $this->decisions->atOffset($this->propagateIndex);
- $conflict = $this->watchGraph->propagateLiteral(
- $decision[Decisions::DECISION_LITERAL],
- $level,
- $this->decisions
- );
- $this->propagateIndex++;
- if ($conflict) {
- return $conflict;
- }
- }
- return null;
- }
- private function revert(int $level): void
- {
- while (!$this->decisions->isEmpty()) {
- $literal = $this->decisions->lastLiteral();
- if ($this->decisions->undecided($literal)) {
- break;
- }
- $decisionLevel = $this->decisions->decisionLevel($literal);
- if ($decisionLevel <= $level) {
- break;
- }
- $this->decisions->revertLast();
- $this->propagateIndex = \count($this->decisions);
- }
- while (!empty($this->branches) && $this->branches[\count($this->branches) - 1][self::BRANCH_LEVEL] >= $level) {
- array_pop($this->branches);
- }
- }
- private function setPropagateLearn(int $level, $literal, Rule $rule): int
- {
- $level++;
- $this->decisions->decide($literal, $level, $rule);
- while (true) {
- $rule = $this->propagate($level);
- if (null === $rule) {
- break;
- }
- if ($level === 1) {
- return $this->analyzeUnsolvable($rule);
- }
- [$learnLiteral, $newLevel, $newRule, $why] = $this->analyze($level, $rule);
- if ($newLevel <= 0 || $newLevel >= $level) {
- throw new SolverBugException(
- "Trying to revert to invalid level ".$newLevel." from level ".$level."."
- );
- }
- $level = $newLevel;
- $this->revert($level);
- $this->rules->add($newRule, RuleSet::TYPE_LEARNED);
- $this->learnedWhy[spl_object_hash($newRule)] = $why;
- $ruleNode = new RuleWatchNode($newRule);
- $ruleNode->watch2OnHighest($this->decisions);
- $this->watchGraph->insert($ruleNode);
- $this->decisions->decide($learnLiteral, $level, $newRule);
- }
- return $level;
- }
- private function selectAndInstall(int $level, array $decisionQueue, Rule $rule): int
- {
- $literals = $this->policy->selectPreferredPackages($this->pool, $decisionQueue, $rule->getRequiredPackage());
- $selectedLiteral = array_shift($literals);
- if (\count($literals)) {
- $this->branches[] = [$literals, $level];
- }
- return $this->setPropagateLearn($level, $selectedLiteral, $rule);
- }
- protected function analyze(int $level, Rule $rule): array
- {
- $analyzedRule = $rule;
- $ruleLevel = 1;
- $num = 0;
- $l1num = 0;
- $seen = [];
- $learnedLiterals = [null];
- $decisionId = \count($this->decisions);
- $this->learnedPool[] = [];
- while (true) {
- $this->learnedPool[\count($this->learnedPool) - 1][] = $rule;
- foreach ($rule->getLiterals() as $literal) {
- if ($rule instanceof MultiConflictRule && !$this->decisions->decided($literal)) {
- continue;
- }
- if ($this->decisions->satisfy($literal)) {
- continue;
- }
- if (isset($seen[abs($literal)])) {
- continue;
- }
- $seen[abs($literal)] = true;
- $l = $this->decisions->decisionLevel($literal);
- if (1 === $l) {
- $l1num++;
- } elseif ($level === $l) {
- $num++;
- } else {
- $learnedLiterals[] = $literal;
- if ($l > $ruleLevel) {
- $ruleLevel = $l;
- }
- }
- }
- unset($literal);
- $l1retry = true;
- while ($l1retry) {
- $l1retry = false;
- if (0 === $num && 0 === --$l1num) {
- break 2;
- }
- while (true) {
- if ($decisionId <= 0) {
- throw new SolverBugException(
- "Reached invalid decision id $decisionId while looking through $rule for a literal present in the analyzed rule $analyzedRule."
- );
- }
- $decisionId--;
- $decision = $this->decisions->atOffset($decisionId);
- $literal = $decision[Decisions::DECISION_LITERAL];
- if (isset($seen[abs($literal)])) {
- break;
- }
- }
- unset($seen[abs($literal)]);
- if (0 !== $num && 0 === --$num) {
- if ($literal < 0) {
- $this->testFlagLearnedPositiveLiteral = true;
- }
- $learnedLiterals[0] = -$literal;
- if (!$l1num) {
- break 2;
- }
- foreach ($learnedLiterals as $i => $learnedLiteral) {
- if ($i !== 0) {
- unset($seen[abs($learnedLiteral)]);
- }
- }
- $l1num++;
- $l1retry = true;
- } else {
- $decision = $this->decisions->atOffset($decisionId);
- $rule = $decision[Decisions::DECISION_REASON];
- if ($rule instanceof MultiConflictRule) {
- foreach ($rule->getLiterals() as $literal) {
- if (!isset($seen[abs($literal)]) && $this->decisions->satisfy(-$literal)) {
- $this->learnedPool[\count($this->learnedPool) - 1][] = $rule;
- $l = $this->decisions->decisionLevel($literal);
- if (1 === $l) {
- $l1num++;
- } elseif ($level === $l) {
- $num++;
- } else {
- $learnedLiterals[] = $literal;
- if ($l > $ruleLevel) {
- $ruleLevel = $l;
- }
- }
- $seen[abs($literal)] = true;
- break;
- }
- }
- $l1retry = true;
- }
- }
- }
- $decision = $this->decisions->atOffset($decisionId);
- $rule = $decision[Decisions::DECISION_REASON];
- }
- $why = \count($this->learnedPool) - 1;
- if (!$learnedLiterals[0]) {
- throw new SolverBugException(
- "Did not find a learnable literal in analyzed rule $analyzedRule."
- );
- }
- $newRule = new GenericRule($learnedLiterals, Rule::RULE_LEARNED, $why);
- return [$learnedLiterals[0], $ruleLevel, $newRule, $why];
- }
- private function analyzeUnsolvableRule(Problem $problem, Rule $conflictRule, array &$ruleSeen): void
- {
- $why = spl_object_hash($conflictRule);
- $ruleSeen[$why] = true;
- if ($conflictRule->getType() === RuleSet::TYPE_LEARNED) {
- $learnedWhy = $this->learnedWhy[$why];
- $problemRules = $this->learnedPool[$learnedWhy];
- foreach ($problemRules as $problemRule) {
- if (!isset($ruleSeen[spl_object_hash($problemRule)])) {
- $this->analyzeUnsolvableRule($problem, $problemRule, $ruleSeen);
- }
- }
- return;
- }
- if ($conflictRule->getType() === RuleSet::TYPE_PACKAGE) {
- return;
- }
- $problem->nextSection();
- $problem->addRule($conflictRule);
- }
- private function analyzeUnsolvable(Rule $conflictRule): int
- {
- $problem = new Problem();
- $problem->addRule($conflictRule);
- $ruleSeen = [];
- $this->analyzeUnsolvableRule($problem, $conflictRule, $ruleSeen);
- $this->problems[] = $problem;
- $seen = [];
- $literals = $conflictRule->getLiterals();
- foreach ($literals as $literal) {
- if ($this->decisions->satisfy($literal)) {
- continue;
- }
- $seen[abs($literal)] = true;
- }
- foreach ($this->decisions as $decision) {
- $literal = $decision[Decisions::DECISION_LITERAL];
- if (!isset($seen[abs($literal)])) {
- continue;
- }
- $why = $decision[Decisions::DECISION_REASON];
- $problem->addRule($why);
- $this->analyzeUnsolvableRule($problem, $why, $ruleSeen);
- $literals = $why->getLiterals();
- foreach ($literals as $literal) {
- if ($this->decisions->satisfy($literal)) {
- continue;
- }
- $seen[abs($literal)] = true;
- }
- }
- return 0;
- }
- private function enableDisableLearnedRules(): void
- {
- foreach ($this->rules->getIteratorFor(RuleSet::TYPE_LEARNED) as $rule) {
- $why = $this->learnedWhy[spl_object_hash($rule)];
- $problemRules = $this->learnedPool[$why];
- $foundDisabled = false;
- foreach ($problemRules as $problemRule) {
- if ($problemRule->isDisabled()) {
- $foundDisabled = true;
- break;
- }
- }
- if ($foundDisabled && $rule->isEnabled()) {
- $rule->disable();
- } elseif (!$foundDisabled && $rule->isDisabled()) {
- $rule->enable();
- }
- }
- }
- private function runSat(): void
- {
- $this->propagateIndex = 0;
- $level = 1;
- $systemLevel = $level + 1;
- while (true) {
- if (1 === $level) {
- $conflictRule = $this->propagate($level);
- if (null !== $conflictRule) {
- if ($this->analyzeUnsolvable($conflictRule)) {
- continue;
- }
- return;
- }
- }
- if ($level < $systemLevel) {
- $iterator = $this->rules->getIteratorFor(RuleSet::TYPE_REQUEST);
- foreach ($iterator as $rule) {
- if ($rule->isEnabled()) {
- $decisionQueue = [];
- $noneSatisfied = true;
- foreach ($rule->getLiterals() as $literal) {
- if ($this->decisions->satisfy($literal)) {
- $noneSatisfied = false;
- break;
- }
- if ($literal > 0 && $this->decisions->undecided($literal)) {
- $decisionQueue[] = $literal;
- }
- }
- if ($noneSatisfied && \count($decisionQueue)) {
- $prunedQueue = [];
- foreach ($decisionQueue as $literal) {
- if (isset($this->fixedMap[abs($literal)])) {
- $prunedQueue[] = $literal;
- }
- }
- if (!empty($prunedQueue)) {
- $decisionQueue = $prunedQueue;
- }
- }
- if ($noneSatisfied && \count($decisionQueue)) {
- $oLevel = $level;
- $level = $this->selectAndInstall($level, $decisionQueue, $rule);
- if (0 === $level) {
- return;
- }
- if ($level <= $oLevel) {
- break;
- }
- }
- }
- }
- $systemLevel = $level + 1;
- $iterator->next();
- if ($iterator->valid()) {
- continue;
- }
- }
- if ($level < $systemLevel) {
- $systemLevel = $level;
- }
- $rulesCount = \count($this->rules);
- $pass = 1;
- $this->io->writeError('Looking at all rules.', true, IOInterface::DEBUG);
- for ($i = 0, $n = 0; $n < $rulesCount; $i++, $n++) {
- if ($i === $rulesCount) {
- if (1 === $pass) {
- $this->io->writeError("Something's changed, looking at all rules again (pass #$pass)", false, IOInterface::DEBUG);
- } else {
- $this->io->overwriteError("Something's changed, looking at all rules again (pass #$pass)", false, null, IOInterface::DEBUG);
- }
- $i = 0;
- $pass++;
- }
- $rule = $this->rules->ruleById[$i];
- $literals = $rule->getLiterals();
- if ($rule->isDisabled()) {
- continue;
- }
- $decisionQueue = [];
- foreach ($literals as $literal) {
- if ($literal <= 0) {
- if (!$this->decisions->decidedInstall($literal)) {
- continue 2;
- }
- } else {
- if ($this->decisions->decidedInstall($literal)) {
- continue 2;
- }
- if ($this->decisions->undecided($literal)) {
- $decisionQueue[] = $literal;
- }
- }
- }
- if (\count($decisionQueue) < 2) {
- continue;
- }
- $level = $this->selectAndInstall($level, $decisionQueue, $rule);
- if (0 === $level) {
- return;
- }
- $rulesCount = \count($this->rules);
- $n = -1;
- }
- if ($level < $systemLevel) {
- continue;
- }
- if (\count($this->branches)) {
- $lastLiteral = null;
- $lastLevel = null;
- $lastBranchIndex = 0;
- $lastBranchOffset = 0;
- for ($i = \count($this->branches) - 1; $i >= 0; $i--) {
- [$literals, $l] = $this->branches[$i];
- foreach ($literals as $offset => $literal) {
- if ($literal && $literal > 0 && $this->decisions->decisionLevel($literal) > $l + 1) {
- $lastLiteral = $literal;
- $lastBranchIndex = $i;
- $lastBranchOffset = $offset;
- $lastLevel = $l;
- }
- }
- }
- if ($lastLiteral) {
- unset($this->branches[$lastBranchIndex][self::BRANCH_LITERALS][$lastBranchOffset]);
- $level = $lastLevel;
- $this->revert($level);
- $why = $this->decisions->lastReason();
- $level = $this->setPropagateLearn($level, $lastLiteral, $why);
- if ($level === 0) {
- return;
- }
- continue;
- }
- }
- break;
- }
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\DependencyResolver;
- class SolverBugException extends \RuntimeException
- {
- public function __construct(string $message)
- {
- parent::__construct(
- $message."\nThis exception was most likely caused by a bug in Composer.\n".
- "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"
- );
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\DependencyResolver;
- use Composer\Util\IniHelper;
- use Composer\Repository\RepositorySet;
- class SolverProblemsException extends \RuntimeException
- {
- public const ERROR_DEPENDENCY_RESOLUTION_FAILED = 2;
- protected $problems;
- protected $learnedPool;
- public function __construct(array $problems, array $learnedPool)
- {
- $this->problems = $problems;
- $this->learnedPool = $learnedPool;
- parent::__construct('Failed resolving dependencies with '.count($problems).' problems, call getPrettyString to get formatted details', self::ERROR_DEPENDENCY_RESOLUTION_FAILED);
- }
- public function getPrettyString(RepositorySet $repositorySet, Request $request, Pool $pool, bool $isVerbose, bool $isDevExtraction = false): string
- {
- $installedMap = $request->getPresentMap(true);
- $missingExtensions = [];
- $isCausedByLock = false;
- $problems = [];
- foreach ($this->problems as $problem) {
- $problems[] = $problem->getPrettyString($repositorySet, $request, $pool, $isVerbose, $installedMap, $this->learnedPool)."\n";
- $missingExtensions = array_merge($missingExtensions, $this->getExtensionProblems($problem->getReasons()));
- $isCausedByLock = $isCausedByLock || $problem->isCausedByLock($repositorySet, $request, $pool);
- }
- $i = 1;
- $text = "\n";
- foreach (array_unique($problems) as $problem) {
- $text .= " Problem ".($i++).$problem;
- }
- $hints = [];
- if (!$isDevExtraction && (strpos($text, 'could not be found') || strpos($text, 'no matching package found'))) {
- $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.";
- }
- if (!empty($missingExtensions)) {
- $hints[] = $this->createExtensionHint($missingExtensions);
- }
- if ($isCausedByLock && !$isDevExtraction && !$request->getUpdateAllowTransitiveRootDependencies()) {
- $hints[] = "Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.";
- }
- if (strpos($text, 'found composer-plugin-api[2.0.0] but it does not match') && strpos($text, '- ocramius/package-versions')) {
- $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+.";
- }
- if (!class_exists('PHPUnit\Framework\TestCase', false)) {
- if (strpos($text, 'found composer-plugin-api[2.0.0] but it does not match')) {
- $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.";
- }
- }
- if ($hints) {
- $text .= "\n" . implode("\n\n", $hints);
- }
- return $text;
- }
- public function getProblems(): array
- {
- return $this->problems;
- }
- private function createExtensionHint(array $missingExtensions): string
- {
- $paths = IniHelper::getAll();
- if ('' === $paths[0]) {
- if (count($paths) === 1) {
- return '';
- }
- array_shift($paths);
- }
- $ignoreExtensionsArguments = implode(" ", array_map(static function ($extension) {
- return "--ignore-platform-req=$extension";
- }, array_unique($missingExtensions)));
- $text = "To enable extensions, verify that they are enabled in your .ini files:\n - ";
- $text .= implode("\n - ", $paths);
- $text .= "\nYou can also run `php --ini` in a terminal to see which files are used by PHP in CLI mode.";
- $text .= "\nAlternatively, you can run Composer with `$ignoreExtensionsArguments` to temporarily ignore these required extensions.";
- return $text;
- }
- private function getExtensionProblems(array $reasonSets): array
- {
- $missingExtensions = [];
- foreach ($reasonSets as $reasonSet) {
- foreach ($reasonSet as $rule) {
- $required = $rule->getRequiredPackage();
- if (null !== $required && 0 === strpos($required, 'ext-')) {
- $missingExtensions[$required] = 1;
- }
- }
- }
- return array_keys($missingExtensions);
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\DependencyResolver;
- use Composer\Package\AliasPackage;
- use Composer\Package\Link;
- use Composer\Package\PackageInterface;
- use Composer\Repository\PlatformRepository;
- use Composer\DependencyResolver\Operation\OperationInterface;
- class Transaction
- {
- protected $operations;
- protected $presentPackages;
- protected $resultPackageMap;
- protected $resultPackagesByName = [];
- public function __construct(array $presentPackages, array $resultPackages)
- {
- $this->presentPackages = $presentPackages;
- $this->setResultPackageMaps($resultPackages);
- $this->operations = $this->calculateOperations();
- }
- public function getOperations(): array
- {
- return $this->operations;
- }
- private function setResultPackageMaps(array $resultPackages): void
- {
- $packageSort = static function (PackageInterface $a, PackageInterface $b): int {
- if ($a->getName() === $b->getName()) {
- if ($a instanceof AliasPackage !== $b instanceof AliasPackage) {
- return $a instanceof AliasPackage ? -1 : 1;
- }
- return strcmp($b->getVersion(), $a->getVersion());
- }
- return strcmp($b->getName(), $a->getName());
- };
- $this->resultPackageMap = [];
- foreach ($resultPackages as $package) {
- $this->resultPackageMap[spl_object_hash($package)] = $package;
- foreach ($package->getNames() as $name) {
- $this->resultPackagesByName[$name][] = $package;
- }
- }
- uasort($this->resultPackageMap, $packageSort);
- foreach ($this->resultPackagesByName as $name => $packages) {
- uasort($this->resultPackagesByName[$name], $packageSort);
- }
- }
- protected function calculateOperations(): array
- {
- $operations = [];
- $presentPackageMap = [];
- $removeMap = [];
- $presentAliasMap = [];
- $removeAliasMap = [];
- foreach ($this->presentPackages as $package) {
- if ($package instanceof AliasPackage) {
- $presentAliasMap[$package->getName().'::'.$package->getVersion()] = $package;
- $removeAliasMap[$package->getName().'::'.$package->getVersion()] = $package;
- } else {
- $presentPackageMap[$package->getName()] = $package;
- $removeMap[$package->getName()] = $package;
- }
- }
- $stack = $this->getRootPackages();
- $visited = [];
- $processed = [];
- while (!empty($stack)) {
- $package = array_pop($stack);
- if (isset($processed[spl_object_hash($package)])) {
- continue;
- }
- if (!isset($visited[spl_object_hash($package)])) {
- $visited[spl_object_hash($package)] = true;
- $stack[] = $package;
- if ($package instanceof AliasPackage) {
- $stack[] = $package->getAliasOf();
- } else {
- foreach ($package->getRequires() as $link) {
- $possibleRequires = $this->getProvidersInResult($link);
- foreach ($possibleRequires as $require) {
- $stack[] = $require;
- }
- }
- }
- } elseif (!isset($processed[spl_object_hash($package)])) {
- $processed[spl_object_hash($package)] = true;
- if ($package instanceof AliasPackage) {
- $aliasKey = $package->getName().'::'.$package->getVersion();
- if (isset($presentAliasMap[$aliasKey])) {
- unset($removeAliasMap[$aliasKey]);
- } else {
- $operations[] = new Operation\MarkAliasInstalledOperation($package);
- }
- } else {
- if (isset($presentPackageMap[$package->getName()])) {
- $source = $presentPackageMap[$package->getName()];
- if ($package->getVersion() !== $presentPackageMap[$package->getName()]->getVersion() ||
- $package->getDistReference() !== $presentPackageMap[$package->getName()]->getDistReference() ||
- $package->getSourceReference() !== $presentPackageMap[$package->getName()]->getSourceReference()
- ) {
- $operations[] = new Operation\UpdateOperation($source, $package);
- }
- unset($removeMap[$package->getName()]);
- } else {
- $operations[] = new Operation\InstallOperation($package);
- unset($removeMap[$package->getName()]);
- }
- }
- }
- }
- foreach ($removeMap as $name => $package) {
- array_unshift($operations, new Operation\UninstallOperation($package));
- }
- foreach ($removeAliasMap as $nameVersion => $package) {
- $operations[] = new Operation\MarkAliasUninstalledOperation($package);
- }
- $operations = $this->movePluginsToFront($operations);
- $operations = $this->moveUninstallsToFront($operations);
- return $this->operations = $operations;
- }
- protected function getRootPackages(): array
- {
- $roots = $this->resultPackageMap;
- foreach ($this->resultPackageMap as $packageHash => $package) {
- if (!isset($roots[$packageHash])) {
- continue;
- }
- foreach ($package->getRequires() as $link) {
- $possibleRequires = $this->getProvidersInResult($link);
- foreach ($possibleRequires as $require) {
- if ($require !== $package) {
- unset($roots[spl_object_hash($require)]);
- }
- }
- }
- }
- return $roots;
- }
- protected function getProvidersInResult(Link $link): array
- {
- if (!isset($this->resultPackagesByName[$link->getTarget()])) {
- return [];
- }
- return $this->resultPackagesByName[$link->getTarget()];
- }
- private function movePluginsToFront(array $operations): array
- {
- $dlModifyingPluginsNoDeps = [];
- $dlModifyingPluginsWithDeps = [];
- $dlModifyingPluginRequires = [];
- $pluginsNoDeps = [];
- $pluginsWithDeps = [];
- $pluginRequires = [];
- foreach (array_reverse($operations, true) as $idx => $op) {
- if ($op instanceof Operation\InstallOperation) {
- $package = $op->getPackage();
- } elseif ($op instanceof Operation\UpdateOperation) {
- $package = $op->getTargetPackage();
- } else {
- continue;
- }
- $isDownloadsModifyingPlugin = $package->getType() === 'composer-plugin' && ($extra = $package->getExtra()) && isset($extra['plugin-modifies-downloads']) && $extra['plugin-modifies-downloads'] === true;
- if ($isDownloadsModifyingPlugin || count(array_intersect($package->getNames(), $dlModifyingPluginRequires))) {
- $requires = array_filter(array_keys($package->getRequires()), static function ($req): bool {
- return !PlatformRepository::isPlatformPackage($req);
- });
- if ($isDownloadsModifyingPlugin && !count($requires)) {
- array_unshift($dlModifyingPluginsNoDeps, $op);
- } else {
- $dlModifyingPluginRequires = array_merge($dlModifyingPluginRequires, $requires);
- array_unshift($dlModifyingPluginsWithDeps, $op);
- }
- unset($operations[$idx]);
- continue;
- }
- $isPlugin = $package->getType() === 'composer-plugin' || $package->getType() === 'composer-installer';
- if ($isPlugin || count(array_intersect($package->getNames(), $pluginRequires))) {
- $requires = array_filter(array_keys($package->getRequires()), static function ($req): bool {
- return !PlatformRepository::isPlatformPackage($req);
- });
- if ($isPlugin && !count($requires)) {
- array_unshift($pluginsNoDeps, $op);
- } else {
- $pluginRequires = array_merge($pluginRequires, $requires);
- array_unshift($pluginsWithDeps, $op);
- }
- unset($operations[$idx]);
- }
- }
- return array_merge($dlModifyingPluginsNoDeps, $dlModifyingPluginsWithDeps, $pluginsNoDeps, $pluginsWithDeps, $operations);
- }
- private function moveUninstallsToFront(array $operations): array
- {
- $uninstOps = [];
- foreach ($operations as $idx => $op) {
- if ($op instanceof Operation\UninstallOperation || $op instanceof Operation\MarkAliasUninstalledOperation) {
- $uninstOps[] = $op;
- unset($operations[$idx]);
- }
- }
- return array_merge($uninstOps, $operations);
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Downloader;
- use Composer\Package\PackageInterface;
- use Composer\Util\Platform;
- use Symfony\Component\Finder\Finder;
- use React\Promise\PromiseInterface;
- use Composer\DependencyResolver\Operation\InstallOperation;
- abstract class ArchiveDownloader extends FileDownloader
- {
- protected $cleanupExecuted = [];
- public function prepare(string $type, PackageInterface $package, string $path, ?PackageInterface $prevPackage = null): PromiseInterface
- {
- unset($this->cleanupExecuted[$package->getName()]);
- return parent::prepare($type, $package, $path, $prevPackage);
- }
- public function cleanup(string $type, PackageInterface $package, string $path, ?PackageInterface $prevPackage = null): PromiseInterface
- {
- $this->cleanupExecuted[$package->getName()] = true;
- return parent::cleanup($type, $package, $path, $prevPackage);
- }
- public function install(PackageInterface $package, string $path, bool $output = true): PromiseInterface
- {
- if ($output) {
- $this->io->writeError(" - " . InstallOperation::format($package) . $this->getInstallOperationAppendix($package, $path));
- }
- $vendorDir = $this->config->get('vendor-dir');
- if (false === strpos($this->filesystem->normalizePath($vendorDir), $this->filesystem->normalizePath($path.DIRECTORY_SEPARATOR))) {
- $this->filesystem->emptyDirectory($path);
- }
- do {
- $temporaryDir = $vendorDir.'/composer/'.substr(md5(uniqid('', true)), 0, 8);
- } while (is_dir($temporaryDir));
- $this->addCleanupPath($package, $temporaryDir);
- if (!is_dir($path) || realpath($path) !== Platform::getCwd()) {
- $this->addCleanupPath($package, $path);
- }
- $this->filesystem->ensureDirectoryExists($temporaryDir);
- $fileName = $this->getFileName($package, $path);
- $filesystem = $this->filesystem;
- $cleanup = function () use ($path, $filesystem, $temporaryDir, $package) {
- $this->clearLastCacheWrite($package);
- $filesystem->removeDirectory($temporaryDir);
- if (is_dir($path) && realpath($path) !== Platform::getCwd()) {
- $filesystem->removeDirectory($path);
- }
- $this->removeCleanupPath($package, $temporaryDir);
- $this->removeCleanupPath($package, realpath($path));
- };
- try {
- $promise = $this->extract($package, $fileName, $temporaryDir);
- } catch (\Exception $e) {
- $cleanup();
- throw $e;
- }
- return $promise->then(function () use ($package, $filesystem, $fileName, $temporaryDir, $path): \React\Promise\PromiseInterface {
- if (file_exists($fileName)) {
- $filesystem->unlink($fileName);
- }
- $getFolderContent = static function ($dir): array {
- $finder = Finder::create()
- ->ignoreVCS(false)
- ->ignoreDotFiles(false)
- ->notName('.DS_Store')
- ->depth(0)
- ->in($dir);
- return iterator_to_array($finder);
- };
- $renameRecursively = null;
- $renameRecursively = static function ($from, $to) use ($filesystem, $getFolderContent, $package, &$renameRecursively) {
- $contentDir = $getFolderContent($from);
- foreach ($contentDir as $file) {
- $file = (string) $file;
- if (is_dir($to . '/' . basename($file))) {
- if (!is_dir($file)) {
- throw new \RuntimeException('Installing '.$package.' would lead to overwriting the '.$to.'/'.basename($file).' directory with a file from the package, invalid operation.');
- }
- $renameRecursively($file, $to . '/' . basename($file));
- } else {
- $filesystem->rename($file, $to . '/' . basename($file));
- }
- }
- };
- $renameAsOne = false;
- if (!file_exists($path)) {
- $renameAsOne = true;
- } elseif ($filesystem->isDirEmpty($path)) {
- try {
- if ($filesystem->removeDirectoryPhp($path)) {
- $renameAsOne = true;
- }
- } catch (\RuntimeException $e) {
- }
- }
- $contentDir = $getFolderContent($temporaryDir);
- $singleDirAtTopLevel = 1 === count($contentDir) && is_dir((string) reset($contentDir));
- if ($renameAsOne) {
- if ($singleDirAtTopLevel) {
- $extractedDir = (string) reset($contentDir);
- } else {
- $extractedDir = $temporaryDir;
- }
- $filesystem->rename($extractedDir, $path);
- } else {
- $from = $temporaryDir;
- if ($singleDirAtTopLevel) {
- $from = (string) reset($contentDir);
- }
- $renameRecursively($from, $path);
- }
- $promise = $filesystem->removeDirectoryAsync($temporaryDir);
- return $promise->then(function () use ($package, $path, $temporaryDir) {
- $this->removeCleanupPath($package, $temporaryDir);
- $this->removeCleanupPath($package, $path);
- });
- }, static function ($e) use ($cleanup) {
- $cleanup();
- throw $e;
- });
- }
- protected function getInstallOperationAppendix(PackageInterface $package, string $path): string
- {
- return ': Extracting archive';
- }
- abstract protected function extract(PackageInterface $package, string $file, string $path): PromiseInterface;
- }
- <?php declare(strict_types=1);
- namespace Composer\Downloader;
- use Composer\Package\PackageInterface;
- interface ChangeReportInterface
- {
- public function getLocalChanges(PackageInterface $package, string $path): ?string;
- }
- <?php declare(strict_types=1);
- namespace Composer\Downloader;
- use Composer\Package\PackageInterface;
- use Composer\IO\IOInterface;
- use Composer\Pcre\Preg;
- use Composer\Util\Filesystem;
- use Composer\Exception\IrrecoverableDownloadException;
- use React\Promise\PromiseInterface;
- class DownloadManager
- {
- private $io;
- private $preferDist = false;
- private $preferSource;
- private $packagePreferences = [];
- private $filesystem;
- private $downloaders = [];
- public function __construct(IOInterface $io, bool $preferSource = false, ?Filesystem $filesystem = null)
- {
- $this->io = $io;
- $this->preferSource = $preferSource;
- $this->filesystem = $filesystem ?: new Filesystem();
- }
- public function setPreferSource(bool $preferSource): self
- {
- $this->preferSource = $preferSource;
- return $this;
- }
- public function setPreferDist(bool $preferDist): self
- {
- $this->preferDist = $preferDist;
- return $this;
- }
- public function setPreferences(array $preferences): self
- {
- $this->packagePreferences = $preferences;
- return $this;
- }
- public function setDownloader(string $type, DownloaderInterface $downloader): self
- {
- $type = strtolower($type);
- $this->downloaders[$type] = $downloader;
- return $this;
- }
- public function getDownloader(string $type): DownloaderInterface
- {
- $type = strtolower($type);
- if (!isset($this->downloaders[$type])) {
- throw new \InvalidArgumentException(sprintf('Unknown downloader type: %s. Available types: %s.', $type, implode(', ', array_keys($this->downloaders))));
- }
- return $this->downloaders[$type];
- }
- public function getDownloaderForPackage(PackageInterface $package): ?DownloaderInterface
- {
- $installationSource = $package->getInstallationSource();
- if ('metapackage' === $package->getType()) {
- return null;
- }
- if ('dist' === $installationSource) {
- $downloader = $this->getDownloader($package->getDistType());
- } elseif ('source' === $installationSource) {
- $downloader = $this->getDownloader($package->getSourceType());
- } else {
- throw new \InvalidArgumentException(
- 'Package '.$package.' does not have an installation source set'
- );
- }
- if ($installationSource !== $downloader->getInstallationSource()) {
- throw new \LogicException(sprintf(
- 'Downloader "%s" is a %s type downloader and can not be used to download %s for package %s',
- get_class($downloader),
- $downloader->getInstallationSource(),
- $installationSource,
- $package
- ));
- }
- return $downloader;
- }
- public function getDownloaderType(DownloaderInterface $downloader): string
- {
- return array_search($downloader, $this->downloaders);
- }
- public function download(PackageInterface $package, string $targetDir, ?PackageInterface $prevPackage = null): PromiseInterface
- {
- $targetDir = $this->normalizeTargetDir($targetDir);
- $this->filesystem->ensureDirectoryExists(dirname($targetDir));
- $sources = $this->getAvailableSources($package, $prevPackage);
- $io = $this->io;
- $download = function ($retry = false) use (&$sources, $io, $package, $targetDir, &$download, $prevPackage) {
- $source = array_shift($sources);
- if ($retry) {
- $io->writeError(' <warning>Now trying to download from ' . $source . '</warning>');
- }
- $package->setInstallationSource($source);
- $downloader = $this->getDownloaderForPackage($package);
- if (!$downloader) {
- return \React\Promise\resolve(null);
- }
- $handleError = static function ($e) use ($sources, $source, $package, $io, $download) {
- if ($e instanceof \RuntimeException && !$e instanceof IrrecoverableDownloadException) {
- if (!$sources) {
- throw $e;
- }
- $io->writeError(
- ' <warning>Failed to download '.
- $package->getPrettyName().
- ' from ' . $source . ': '.
- $e->getMessage().'</warning>'
- );
- return $download(true);
- }
- throw $e;
- };
- try {
- $result = $downloader->download($package, $targetDir, $prevPackage);
- } catch (\Exception $e) {
- return $handleError($e);
- }
- $res = $result->then(static function ($res) {
- return $res;
- }, $handleError);
- return $res;
- };
- return $download();
- }
- public function prepare(string $type, PackageInterface $package, string $targetDir, ?PackageInterface $prevPackage = null): PromiseInterface
- {
- $targetDir = $this->normalizeTargetDir($targetDir);
- $downloader = $this->getDownloaderForPackage($package);
- if ($downloader) {
- return $downloader->prepare($type, $package, $targetDir, $prevPackage);
- }
- return \React\Promise\resolve(null);
- }
- public function install(PackageInterface $package, string $targetDir): PromiseInterface
- {
- $targetDir = $this->normalizeTargetDir($targetDir);
- $downloader = $this->getDownloaderForPackage($package);
- if ($downloader) {
- return $downloader->install($package, $targetDir);
- }
- return \React\Promise\resolve(null);
- }
- public function update(PackageInterface $initial, PackageInterface $target, string $targetDir): PromiseInterface
- {
- $targetDir = $this->normalizeTargetDir($targetDir);
- $downloader = $this->getDownloaderForPackage($target);
- $initialDownloader = $this->getDownloaderForPackage($initial);
- if (!$initialDownloader && !$downloader) {
- return \React\Promise\resolve(null);
- }
- if (!$downloader) {
- return $initialDownloader->remove($initial, $targetDir);
- }
- $initialType = $this->getDownloaderType($initialDownloader);
- $targetType = $this->getDownloaderType($downloader);
- if ($initialType === $targetType) {
- try {
- return $downloader->update($initial, $target, $targetDir);
- } catch (\RuntimeException $e) {
- if (!$this->io->isInteractive()) {
- throw $e;
- }
- $this->io->writeError('<error> Update failed ('.$e->getMessage().')</error>');
- if (!$this->io->askConfirmation(' Would you like to try reinstalling the package instead [<comment>yes</comment>]? ')) {
- throw $e;
- }
- }
- }
- $promise = $initialDownloader->remove($initial, $targetDir);
- return $promise->then(function ($res) use ($target, $targetDir): PromiseInterface {
- return $this->install($target, $targetDir);
- });
- }
- public function remove(PackageInterface $package, string $targetDir): PromiseInterface
- {
- $targetDir = $this->normalizeTargetDir($targetDir);
- $downloader = $this->getDownloaderForPackage($package);
- if ($downloader) {
- return $downloader->remove($package, $targetDir);
- }
- return \React\Promise\resolve(null);
- }
- public function cleanup(string $type, PackageInterface $package, string $targetDir, ?PackageInterface $prevPackage = null): PromiseInterface
- {
- $targetDir = $this->normalizeTargetDir($targetDir);
- $downloader = $this->getDownloaderForPackage($package);
- if ($downloader) {
- return $downloader->cleanup($type, $package, $targetDir, $prevPackage);
- }
- return \React\Promise\resolve(null);
- }
- protected function resolvePackageInstallPreference(PackageInterface $package): string
- {
- foreach ($this->packagePreferences as $pattern => $preference) {
- $pattern = '{^'.str_replace('\\*', '.*', preg_quote($pattern)).'$}i';
- if (Preg::isMatch($pattern, $package->getName())) {
- if ('dist' === $preference || (!$package->isDev() && 'auto' === $preference)) {
- return 'dist';
- }
- return 'source';
- }
- }
- return $package->isDev() ? 'source' : 'dist';
- }
- private function getAvailableSources(PackageInterface $package, ?PackageInterface $prevPackage = null): array
- {
- $sourceType = $package->getSourceType();
- $distType = $package->getDistType();
- $sources = [];
- if ($sourceType) {
- $sources[] = 'source';
- }
- if ($distType) {
- $sources[] = 'dist';
- }
- if (empty($sources)) {
- throw new \InvalidArgumentException('Package '.$package.' must have a source or dist specified');
- }
- if (
- $prevPackage
- && in_array($prevPackage->getInstallationSource(), $sources, true)
- && !(!$prevPackage->isDev() && $prevPackage->getInstallationSource() === 'dist' && $package->isDev())
- ) {
- $prevSource = $prevPackage->getInstallationSource();
- usort($sources, static function ($a, $b) use ($prevSource): int {
- return $a === $prevSource ? -1 : 1;
- });
- return $sources;
- }
- if (!$this->preferSource && ($this->preferDist || 'dist' === $this->resolvePackageInstallPreference($package))) {
- $sources = array_reverse($sources);
- }
- return $sources;
- }
- private function normalizeTargetDir(string $dir): string
- {
- if ($dir === '\\' || $dir === '/') {
- return $dir;
- }
- return rtrim($dir, '\\/');
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Downloader;
- use Composer\Package\PackageInterface;
- use React\Promise\PromiseInterface;
- interface DownloaderInterface
- {
- public function getInstallationSource(): string;
- public function download(PackageInterface $package, string $path, ?PackageInterface $prevPackage = null): PromiseInterface;
- public function prepare(string $type, PackageInterface $package, string $path, ?PackageInterface $prevPackage = null): PromiseInterface;
- public function install(PackageInterface $package, string $path): PromiseInterface;
- public function update(PackageInterface $initial, PackageInterface $target, string $path): PromiseInterface;
- public function remove(PackageInterface $package, string $path): PromiseInterface;
- public function cleanup(string $type, PackageInterface $package, string $path, ?PackageInterface $prevPackage = null): PromiseInterface;
- }
- <?php declare(strict_types=1);
- namespace Composer\Downloader;
- use Composer\Package\PackageInterface;
- interface DvcsDownloaderInterface
- {
- public function getUnpushedChanges(PackageInterface $package, string $path): ?string;
- }
- <?php declare(strict_types=1);
- namespace Composer\Downloader;
- use Composer\Config;
- use Composer\Cache;
- use Composer\IO\IOInterface;
- use Composer\IO\NullIO;
- use Composer\Exception\IrrecoverableDownloadException;
- use Composer\Package\Comparer\Comparer;
- use Composer\DependencyResolver\Operation\UpdateOperation;
- use Composer\DependencyResolver\Operation\InstallOperation;
- use Composer\DependencyResolver\Operation\UninstallOperation;
- use Composer\Package\PackageInterface;
- use Composer\Plugin\PluginEvents;
- use Composer\Plugin\PostFileDownloadEvent;
- use Composer\Plugin\PreFileDownloadEvent;
- use Composer\EventDispatcher\EventDispatcher;
- use Composer\Util\Filesystem;
- use Composer\Util\Platform;
- use Composer\Util\Silencer;
- use Composer\Util\HttpDownloader;
- use Composer\Util\Url as UrlUtil;
- use Composer\Util\ProcessExecutor;
- use React\Promise\PromiseInterface;
- class FileDownloader implements DownloaderInterface, ChangeReportInterface
- {
- protected $io;
- protected $config;
- protected $httpDownloader;
- protected $filesystem;
- protected $cache;
- protected $eventDispatcher;
- protected $process;
- public static $downloadMetadata = [];
- private $lastCacheWrites = [];
- private $additionalCleanupPaths = [];
- public function __construct(IOInterface $io, Config $config, HttpDownloader $httpDownloader, ?EventDispatcher $eventDispatcher = null, ?Cache $cache = null, ?Filesystem $filesystem = null, ?ProcessExecutor $process = null)
- {
- $this->io = $io;
- $this->config = $config;
- $this->eventDispatcher = $eventDispatcher;
- $this->httpDownloader = $httpDownloader;
- $this->cache = $cache;
- $this->process = $process ?? new ProcessExecutor($io);
- $this->filesystem = $filesystem ?: new Filesystem($this->process);
- if ($this->cache && $this->cache->gcIsNecessary()) {
- $this->io->writeError('Running cache garbage collection', true, IOInterface::VERY_VERBOSE);
- $this->cache->gc($config->get('cache-files-ttl'), $config->get('cache-files-maxsize'));
- }
- }
- public function getInstallationSource(): string
- {
- return 'dist';
- }
- public function download(PackageInterface $package, string $path, ?PackageInterface $prevPackage = null, bool $output = true): PromiseInterface
- {
- if (!$package->getDistUrl()) {
- throw new \InvalidArgumentException('The given package is missing url information');
- }
- $cacheKeyGenerator = static function (PackageInterface $package, $key): string {
- $cacheKey = sha1($key);
- return $package->getName().'/'.$cacheKey.'.'.$package->getDistType();
- };
- $retries = 3;
- $distUrls = $package->getDistUrls();
- $urls = [];
- foreach ($distUrls as $index => $url) {
- $processedUrl = $this->processUrl($package, $url);
- $urls[$index] = [
- 'base' => $url,
- 'processed' => $processedUrl,
- 'cacheKey' => $cacheKeyGenerator($package, $processedUrl),
- ];
- }
- $fileName = $this->getFileName($package, $path);
- $this->filesystem->ensureDirectoryExists($path);
- $this->filesystem->ensureDirectoryExists(dirname($fileName));
- $io = $this->io;
- $cache = $this->cache;
- $httpDownloader = $this->httpDownloader;
- $eventDispatcher = $this->eventDispatcher;
- $filesystem = $this->filesystem;
- $accept = null;
- $reject = null;
- $download = function () use ($io, $output, $httpDownloader, $cache, $cacheKeyGenerator, $eventDispatcher, $package, $fileName, &$urls, &$accept, &$reject) {
- $url = reset($urls);
- $index = key($urls);
- if ($eventDispatcher) {
- $preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $httpDownloader, $url['processed'], 'package', $package);
- $eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
- if ($preFileDownloadEvent->getCustomCacheKey() !== null) {
- $url['cacheKey'] = $cacheKeyGenerator($package, $preFileDownloadEvent->getCustomCacheKey());
- } elseif ($preFileDownloadEvent->getProcessedUrl() !== $url['processed']) {
- $url['cacheKey'] = $cacheKeyGenerator($package, $preFileDownloadEvent->getProcessedUrl());
- }
- $url['processed'] = $preFileDownloadEvent->getProcessedUrl();
- }
- $urls[$index] = $url;
- $checksum = $package->getDistSha1Checksum();
- $cacheKey = $url['cacheKey'];
- if ($cache && (!$checksum || $checksum === $cache->sha1($cacheKey)) && $cache->copyTo($cacheKey, $fileName)) {
- if ($output) {
- $io->writeError(" - Loading <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>) from cache", true, IOInterface::VERY_VERBOSE);
- }
- if (!$cache->isReadOnly()) {
- $this->lastCacheWrites[$package->getName()] = $cacheKey;
- }
- $result = \React\Promise\resolve($fileName);
- } else {
- if ($output) {
- $io->writeError(" - Downloading <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>)");
- }
- $result = $httpDownloader->addCopy($url['processed'], $fileName, $package->getTransportOptions())
- ->then($accept, $reject);
- }
- return $result->then(static function ($result) use ($fileName, $checksum, $url, $package, $eventDispatcher): string {
- if (null === $result) {
- return $fileName;
- }
- if (!file_exists($fileName)) {
- throw new \UnexpectedValueException($url['base'].' could not be saved to '.$fileName.', make sure the'
- .' directory is writable and you have internet connectivity');
- }
- if ($checksum && hash_file('sha1', $fileName) !== $checksum) {
- throw new \UnexpectedValueException('The checksum verification of the file failed (downloaded from '.$url['base'].')');
- }
- if ($eventDispatcher) {
- $postFileDownloadEvent = new PostFileDownloadEvent(PluginEvents::POST_FILE_DOWNLOAD, $fileName, $checksum, $url['processed'], 'package', $package);
- $eventDispatcher->dispatch($postFileDownloadEvent->getName(), $postFileDownloadEvent);
- }
- return $fileName;
- });
- };
- $accept = function ($response) use ($cache, $package, $fileName, &$urls): string {
- $url = reset($urls);
- $cacheKey = $url['cacheKey'];
- FileDownloader::$downloadMetadata[$package->getName()] = @filesize($fileName) ?: $response->getHeader('Content-Length') ?: '?';
- if ($cache && !$cache->isReadOnly()) {
- $this->lastCacheWrites[$package->getName()] = $cacheKey;
- $cache->copyFrom($cacheKey, $fileName);
- }
- $response->collect();
- return $fileName;
- };
- $reject = function ($e) use ($io, &$urls, $download, $fileName, $package, &$retries, $filesystem) {
- if (file_exists($fileName)) {
- $filesystem->unlink($fileName);
- }
- $this->clearLastCacheWrite($package);
- if ($e instanceof IrrecoverableDownloadException) {
- throw $e;
- }
- if ($e instanceof MaxFileSizeExceededException) {
- throw $e;
- }
- if ($e instanceof TransportException) {
- if ((0 !== $e->getCode() && !in_array($e->getCode(), [500, 502, 503, 504])) || !$retries) {
- $retries = 0;
- }
- }
- if ($e instanceof TransportException && $e->getStatusCode() === 499) {
- $retries = 0;
- $urls = [];
- }
- if ($retries) {
- usleep(500000);
- $retries--;
- return $download();
- }
- array_shift($urls);
- if ($urls) {
- if ($io->isDebug()) {
- $io->writeError(' Failed downloading '.$package->getName().': ['.get_class($e).'] '.$e->getCode().': '.$e->getMessage());
- $io->writeError(' Trying the next URL for '.$package->getName());
- } else {
- $io->writeError(' Failed downloading '.$package->getName().', trying the next URL ('.$e->getCode().': '.$e->getMessage().')');
- }
- $retries = 3;
- usleep(100000);
- return $download();
- }
- throw $e;
- };
- return $download();
- }
- public function prepare(string $type, PackageInterface $package, string $path, ?PackageInterface $prevPackage = null): PromiseInterface
- {
- return \React\Promise\resolve(null);
- }
- public function cleanup(string $type, PackageInterface $package, string $path, ?PackageInterface $prevPackage = null): PromiseInterface
- {
- $fileName = $this->getFileName($package, $path);
- if (file_exists($fileName)) {
- $this->filesystem->unlink($fileName);
- }
- $dirsToCleanUp = [
- $this->config->get('vendor-dir').'/composer/',
- $this->config->get('vendor-dir'),
- $path,
- ];
- if (isset($this->additionalCleanupPaths[$package->getName()])) {
- foreach ($this->additionalCleanupPaths[$package->getName()] as $path) {
- $this->filesystem->remove($path);
- }
- }
- foreach ($dirsToCleanUp as $dir) {
- if (is_dir($dir) && $this->filesystem->isDirEmpty($dir) && realpath($dir) !== Platform::getCwd()) {
- $this->filesystem->removeDirectoryPhp($dir);
- }
- }
- return \React\Promise\resolve(null);
- }
- public function install(PackageInterface $package, string $path, bool $output = true): PromiseInterface
- {
- if ($output) {
- $this->io->writeError(" - " . InstallOperation::format($package));
- }
- $this->filesystem->emptyDirectory($path);
- $this->filesystem->ensureDirectoryExists($path);
- $this->filesystem->rename($this->getFileName($package, $path), $path . '/' . pathinfo(parse_url(strtr((string) $package->getDistUrl(), '\\', '/'), PHP_URL_PATH), PATHINFO_BASENAME));
- if ($package->getBinaries()) {
- foreach ($package->getBinaries() as $bin) {
- if (file_exists($path . '/' . $bin) && !is_executable($path . '/' . $bin)) {
- Silencer::call('chmod', $path . '/' . $bin, 0777 & ~umask());
- }
- }
- }
- return \React\Promise\resolve(null);
- }
- protected function clearLastCacheWrite(PackageInterface $package): void
- {
- if ($this->cache && isset($this->lastCacheWrites[$package->getName()])) {
- $this->cache->remove($this->lastCacheWrites[$package->getName()]);
- unset($this->lastCacheWrites[$package->getName()]);
- }
- }
- protected function addCleanupPath(PackageInterface $package, string $path): void
- {
- $this->additionalCleanupPaths[$package->getName()][] = $path;
- }
- protected function removeCleanupPath(PackageInterface $package, string $path): void
- {
- if (isset($this->additionalCleanupPaths[$package->getName()])) {
- $idx = array_search($path, $this->additionalCleanupPaths[$package->getName()]);
- if (false !== $idx) {
- unset($this->additionalCleanupPaths[$package->getName()][$idx]);
- }
- }
- }
- public function update(PackageInterface $initial, PackageInterface $target, string $path): PromiseInterface
- {
- $this->io->writeError(" - " . UpdateOperation::format($initial, $target) . $this->getInstallOperationAppendix($target, $path));
- $promise = $this->remove($initial, $path, false);
- return $promise->then(function () use ($target, $path): PromiseInterface {
- return $this->install($target, $path, false);
- });
- }
- public function remove(PackageInterface $package, string $path, bool $output = true): PromiseInterface
- {
- if ($output) {
- $this->io->writeError(" - " . UninstallOperation::format($package));
- }
- $promise = $this->filesystem->removeDirectoryAsync($path);
- return $promise->then(static function ($result) use ($path): void {
- if (!$result) {
- throw new \RuntimeException('Could not completely delete '.$path.', aborting.');
- }
- });
- }
- protected function getFileName(PackageInterface $package, string $path): string
- {
- return rtrim($this->config->get('vendor-dir').'/composer/tmp-'.md5($package.spl_object_hash($package)).'.'.pathinfo(parse_url(strtr((string) $package->getDistUrl(), '\\', '/'), PHP_URL_PATH), PATHINFO_EXTENSION), '.');
- }
- protected function getInstallOperationAppendix(PackageInterface $package, string $path): string
- {
- return '';
- }
- protected function processUrl(PackageInterface $package, string $url): string
- {
- if (!extension_loaded('openssl') && 0 === strpos($url, 'https:')) {
- throw new \RuntimeException('You must enable the openssl extension to download files via https');
- }
- if ($package->getDistReference()) {
- $url = UrlUtil::updateDistReference($this->config, $url, $package->getDistReference());
- }
- return $url;
- }
- public function getLocalChanges(PackageInterface $package, string $path): ?string
- {
- $prevIO = $this->io;
- $this->io = new NullIO;
- $this->io->loadConfiguration($this->config);
- $e = null;
- $output = '';
- $targetDir = Filesystem::trimTrailingSlash($path);
- try {
- if (is_dir($targetDir.'_compare')) {
- $this->filesystem->removeDirectory($targetDir.'_compare');
- }
- $this->download($package, $targetDir.'_compare', null, false);
- $this->httpDownloader->wait();
- $this->install($package, $targetDir.'_compare', false);
- $this->process->wait();
- $comparer = new Comparer();
- $comparer->setSource($targetDir.'_compare');
- $comparer->setUpdate($targetDir);
- $comparer->doCompare();
- $output = $comparer->getChangedAsString(true);
- $this->filesystem->removeDirectory($targetDir.'_compare');
- } catch (\Exception $e) {
- }
- $this->io = $prevIO;
- if ($e) {
- throw $e;
- }
- $output = trim($output);
- return strlen($output) > 0 ? $output : null;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Downloader;
- class FilesystemException extends \Exception
- {
- public function __construct(string $message = '', int $code = 0, ?\Exception $previous = null)
- {
- parent::__construct("Filesystem exception: \n".$message, $code, $previous);
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Downloader;
- use React\Promise\PromiseInterface;
- use Composer\Package\PackageInterface;
- use Composer\Pcre\Preg;
- use Composer\Util\ProcessExecutor;
- class FossilDownloader extends VcsDownloader
- {
- protected function doDownload(PackageInterface $package, string $path, string $url, ?PackageInterface $prevPackage = null): PromiseInterface
- {
- return \React\Promise\resolve(null);
- }
- protected function doInstall(PackageInterface $package, string $path, string $url): PromiseInterface
- {
- $this->config->prohibitUrlByConfig($url, $this->io);
- $url = ProcessExecutor::escape($url);
- $ref = ProcessExecutor::escape($package->getSourceReference());
- $repoFile = $path . '.fossil';
- $this->io->writeError("Cloning ".$package->getSourceReference());
- $command = sprintf('fossil clone -- %s %s', $url, ProcessExecutor::escape($repoFile));
- if (0 !== $this->process->execute($command, $ignoredOutput)) {
- throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
- }
- $command = sprintf('fossil open --nested -- %s', ProcessExecutor::escape($repoFile));
- if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
- throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
- }
- $command = sprintf('fossil update -- %s', $ref);
- if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
- throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
- }
- return \React\Promise\resolve(null);
- }
- protected function doUpdate(PackageInterface $initial, PackageInterface $target, string $path, string $url): PromiseInterface
- {
- $this->config->prohibitUrlByConfig($url, $this->io);
- $ref = ProcessExecutor::escape($target->getSourceReference());
- $this->io->writeError(" Updating to ".$target->getSourceReference());
- if (!$this->hasMetadataRepository($path)) {
- throw new \RuntimeException('The .fslckout file is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
- }
- $command = sprintf('fossil pull && fossil up %s', $ref);
- if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
- throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
- }
- return \React\Promise\resolve(null);
- }
- public function getLocalChanges(PackageInterface $package, string $path): ?string
- {
- if (!$this->hasMetadataRepository($path)) {
- return null;
- }
- $this->process->execute('fossil changes', $output, realpath($path));
- $output = trim($output);
- return strlen($output) > 0 ? $output : null;
- }
- protected function getCommitLogs(string $fromReference, string $toReference, string $path): string
- {
- $command = sprintf('fossil timeline -t ci -W 0 -n 0 before %s', ProcessExecutor::escape($toReference));
- if (0 !== $this->process->execute($command, $output, realpath($path))) {
- throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
- }
- $log = '';
- $match = '/\d\d:\d\d:\d\d\s+\[' . $toReference . '\]/';
- foreach ($this->process->splitLines($output) as $line) {
- if (Preg::isMatch($match, $line)) {
- break;
- }
- $log .= $line;
- }
- return $log;
- }
- protected function hasMetadataRepository(string $path): bool
- {
- return is_file($path . '/.fslckout') || is_file($path . '/_FOSSIL_');
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Downloader;
- use Composer\Config;
- use Composer\IO\IOInterface;
- use Composer\Package\PackageInterface;
- use Composer\Pcre\Preg;
- use Composer\Util\Filesystem;
- use Composer\Util\Git as GitUtil;
- use Composer\Util\Url;
- use Composer\Util\Platform;
- use Composer\Util\ProcessExecutor;
- use Composer\Cache;
- use React\Promise\PromiseInterface;
- class GitDownloader extends VcsDownloader implements DvcsDownloaderInterface
- {
- private $hasStashedChanges = [];
- private $hasDiscardedChanges = [];
- private $gitUtil;
- private $cachedPackages = [];
- public function __construct(IOInterface $io, Config $config, ?ProcessExecutor $process = null, ?Filesystem $fs = null)
- {
- parent::__construct($io, $config, $process, $fs);
- $this->gitUtil = new GitUtil($this->io, $this->config, $this->process, $this->filesystem);
- }
- protected function doDownload(PackageInterface $package, string $path, string $url, ?PackageInterface $prevPackage = null): PromiseInterface
- {
- if (Filesystem::isLocalPath($url)) {
- return \React\Promise\resolve(null);
- }
- GitUtil::cleanEnv();
- $cachePath = $this->config->get('cache-vcs-dir').'/'.Preg::replace('{[^a-z0-9.]}i', '-', $url).'/';
- $gitVersion = GitUtil::getVersion($this->process);
- if ($gitVersion && version_compare($gitVersion, '2.3.0-rc0', '>=') && Cache::isUsable($cachePath)) {
- $this->io->writeError(" - Syncing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>) into cache");
- $this->io->writeError(sprintf(' Cloning to cache at %s', ProcessExecutor::escape($cachePath)), true, IOInterface::DEBUG);
- $ref = $package->getSourceReference();
- if ($this->gitUtil->fetchRefOrSyncMirror($url, $cachePath, $ref, $package->getPrettyVersion()) && is_dir($cachePath)) {
- $this->cachedPackages[$package->getId()][$ref] = true;
- }
- } elseif (null === $gitVersion) {
- throw new \RuntimeException('git was not found in your PATH, skipping source download');
- }
- return \React\Promise\resolve(null);
- }
- protected function doInstall(PackageInterface $package, string $path, string $url): PromiseInterface
- {
- GitUtil::cleanEnv();
- $path = $this->normalizePath($path);
- $cachePath = $this->config->get('cache-vcs-dir').'/'.Preg::replace('{[^a-z0-9.]}i', '-', $url).'/';
- $ref = $package->getSourceReference();
- $flag = Platform::isWindows() ? '/D ' : '';
- if (!empty($this->cachedPackages[$package->getId()][$ref])) {
- $msg = "Cloning ".$this->getShortHash($ref).' from cache';
- $cloneFlags = '--dissociate --reference %cachePath% ';
- $transportOptions = $package->getTransportOptions();
- if (isset($transportOptions['git']['single_use_clone']) && $transportOptions['git']['single_use_clone']) {
- $cloneFlags = '';
- }
- $command =
- 'git clone --no-checkout %cachePath% %path% ' . $cloneFlags
- . '&& cd '.$flag.'%path% '
- . '&& git remote set-url origin -- %sanitizedUrl% && git remote add composer -- %sanitizedUrl%';
- } else {
- $msg = "Cloning ".$this->getShortHash($ref);
- $command = 'git clone --no-checkout -- %url% %path% && cd '.$flag.'%path% && git remote add composer -- %url% && git fetch composer && git remote set-url origin -- %sanitizedUrl% && git remote set-url composer -- %sanitizedUrl%';
- if (Platform::getEnv('COMPOSER_DISABLE_NETWORK')) {
- throw new \RuntimeException('The required git reference for '.$package->getName().' is not in cache and network is disabled, aborting');
- }
- }
- $this->io->writeError($msg);
- $commandCallable = static function (string $url) use ($path, $command, $cachePath): string {
- return str_replace(
- ['%url%', '%path%', '%cachePath%', '%sanitizedUrl%'],
- [
- ProcessExecutor::escape($url),
- ProcessExecutor::escape($path),
- ProcessExecutor::escape($cachePath),
- ProcessExecutor::escape(Preg::replace('{://([^@]+?):(.+?)@}', '://', $url)),
- ],
- $command
- );
- };
- $this->gitUtil->runCommand($commandCallable, $url, $path, true);
- $sourceUrl = $package->getSourceUrl();
- if ($url !== $sourceUrl && $sourceUrl !== null) {
- $this->updateOriginUrl($path, $sourceUrl);
- } else {
- $this->setPushUrl($path, $url);
- }
- if ($newRef = $this->updateToCommit($package, $path, (string) $ref, $package->getPrettyVersion())) {
- if ($package->getDistReference() === $package->getSourceReference()) {
- $package->setDistReference($newRef);
- }
- $package->setSourceReference($newRef);
- }
- return \React\Promise\resolve(null);
- }
- protected function doUpdate(PackageInterface $initial, PackageInterface $target, string $path, string $url): PromiseInterface
- {
- GitUtil::cleanEnv();
- $path = $this->normalizePath($path);
- if (!$this->hasMetadataRepository($path)) {
- throw new \RuntimeException('The .git directory is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
- }
- $cachePath = $this->config->get('cache-vcs-dir').'/'.Preg::replace('{[^a-z0-9.]}i', '-', $url).'/';
- $ref = $target->getSourceReference();
- if (!empty($this->cachedPackages[$target->getId()][$ref])) {
- $msg = "Checking out ".$this->getShortHash($ref).' from cache';
- $command = '(git rev-parse --quiet --verify %ref% || (git remote set-url composer -- %cachePath% && git fetch composer && git fetch --tags composer)) && git remote set-url composer -- %sanitizedUrl%';
- } else {
- $msg = "Checking out ".$this->getShortHash($ref);
- $command = '(git remote set-url composer -- %url% && git rev-parse --quiet --verify %ref% || (git fetch composer && git fetch --tags composer)) && git remote set-url composer -- %sanitizedUrl%';
- if (Platform::getEnv('COMPOSER_DISABLE_NETWORK')) {
- throw new \RuntimeException('The required git reference for '.$target->getName().' is not in cache and network is disabled, aborting');
- }
- }
- $this->io->writeError($msg);
- $commandCallable = static function ($url) use ($ref, $command, $cachePath): string {
- return str_replace(
- ['%url%', '%ref%', '%cachePath%', '%sanitizedUrl%'],
- [
- ProcessExecutor::escape($url),
- ProcessExecutor::escape($ref.'^{commit}'),
- ProcessExecutor::escape($cachePath),
- ProcessExecutor::escape(Preg::replace('{://([^@]+?):(.+?)@}', '://', $url)),
- ],
- $command
- );
- };
- $this->gitUtil->runCommand($commandCallable, $url, $path);
- if ($newRef = $this->updateToCommit($target, $path, (string) $ref, $target->getPrettyVersion())) {
- if ($target->getDistReference() === $target->getSourceReference()) {
- $target->setDistReference($newRef);
- }
- $target->setSourceReference($newRef);
- }
- $updateOriginUrl = false;
- if (
- 0 === $this->process->execute('git remote -v', $output, $path)
- && Preg::isMatch('{^origin\s+(?P<url>\S+)}m', $output, $originMatch)
- && Preg::isMatch('{^composer\s+(?P<url>\S+)}m', $output, $composerMatch)
- ) {
- if ($originMatch['url'] === $composerMatch['url'] && $composerMatch['url'] !== $target->getSourceUrl()) {
- $updateOriginUrl = true;
- }
- }
- if ($updateOriginUrl && $target->getSourceUrl() !== null) {
- $this->updateOriginUrl($path, $target->getSourceUrl());
- }
- return \React\Promise\resolve(null);
- }
- public function getLocalChanges(PackageInterface $package, string $path): ?string
- {
- GitUtil::cleanEnv();
- if (!$this->hasMetadataRepository($path)) {
- return null;
- }
- $command = 'git status --porcelain --untracked-files=no';
- if (0 !== $this->process->execute($command, $output, $path)) {
- throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
- }
- $output = trim($output);
- return strlen($output) > 0 ? $output : null;
- }
- public function getUnpushedChanges(PackageInterface $package, string $path): ?string
- {
- GitUtil::cleanEnv();
- $path = $this->normalizePath($path);
- if (!$this->hasMetadataRepository($path)) {
- return null;
- }
- $command = 'git show-ref --head -d';
- if (0 !== $this->process->execute($command, $output, $path)) {
- throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
- }
- $refs = trim($output);
- if (!Preg::isMatch('{^([a-f0-9]+) HEAD$}mi', $refs, $match)) {
- return null;
- }
- $headRef = $match[1];
- if (!Preg::isMatchAll('{^'.$headRef.' refs/heads/(.+)$}mi', $refs, $matches)) {
- return null;
- }
- $candidateBranches = $matches[1];
- $branch = $candidateBranches[0];
- $unpushedChanges = null;
- $branchNotFoundError = false;
- for ($i = 0; $i <= 1; $i++) {
- $remoteBranches = [];
- foreach ($candidateBranches as $candidate) {
- if (Preg::isMatchAll('{^[a-f0-9]+ refs/remotes/((?:[^/]+)/'.preg_quote($candidate).')$}mi', $refs, $matches)) {
- foreach ($matches[1] as $match) {
- $branch = $candidate;
- $remoteBranches[] = $match;
- }
- break;
- }
- }
- if (!$remoteBranches) {
- $unpushedChanges = 'Branch ' . $branch . ' could not be found on any remote and appears to be unpushed';
- $branchNotFoundError = true;
- } else {
- if ($branchNotFoundError) {
- $unpushedChanges = null;
- }
- foreach ($remoteBranches as $remoteBranch) {
- $command = sprintf('git diff --name-status %s...%s --', $remoteBranch, $branch);
- if (0 !== $this->process->execute($command, $output, $path)) {
- throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
- }
- $output = trim($output);
- if ($unpushedChanges === null || strlen($output) < strlen($unpushedChanges)) {
- $unpushedChanges = $output;
- }
- }
- }
- if ($unpushedChanges && $i === 0) {
- $this->process->execute('git fetch --all', $output, $path);
- $command = 'git show-ref --head -d';
- if (0 !== $this->process->execute($command, $output, $path)) {
- throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
- }
- $refs = trim($output);
- }
- if (!$unpushedChanges) {
- break;
- }
- }
- return $unpushedChanges;
- }
- protected function cleanChanges(PackageInterface $package, string $path, bool $update): PromiseInterface
- {
- GitUtil::cleanEnv();
- $path = $this->normalizePath($path);
- $unpushed = $this->getUnpushedChanges($package, $path);
- if ($unpushed && ($this->io->isInteractive() || $this->config->get('discard-changes') !== true)) {
- throw new \RuntimeException('Source directory ' . $path . ' has unpushed changes on the current branch: '."\n".$unpushed);
- }
- if (null === ($changes = $this->getLocalChanges($package, $path))) {
- return \React\Promise\resolve(null);
- }
- if (!$this->io->isInteractive()) {
- $discardChanges = $this->config->get('discard-changes');
- if (true === $discardChanges) {
- return $this->discardChanges($path);
- }
- if ('stash' === $discardChanges) {
- if (!$update) {
- return parent::cleanChanges($package, $path, $update);
- }
- return $this->stashChanges($path);
- }
- return parent::cleanChanges($package, $path, $update);
- }
- $changes = array_map(static function ($elem): string {
- return ' '.$elem;
- }, Preg::split('{\s*\r?\n\s*}', $changes));
- $this->io->writeError(' <error>'.$package->getPrettyName().' has modified files:</error>');
- $this->io->writeError(array_slice($changes, 0, 10));
- if (count($changes) > 10) {
- $this->io->writeError(' <info>' . (count($changes) - 10) . ' more files modified, choose "v" to view the full list</info>');
- }
- while (true) {
- switch ($this->io->ask(' <info>Discard changes [y,n,v,d,'.($update ? 's,' : '').'?]?</info> ', '?')) {
- case 'y':
- $this->discardChanges($path);
- break 2;
- case 's':
- if (!$update) {
- goto help;
- }
- $this->stashChanges($path);
- break 2;
- case 'n':
- throw new \RuntimeException('Update aborted');
- case 'v':
- $this->io->writeError($changes);
- break;
- case 'd':
- $this->viewDiff($path);
- break;
- case '?':
- default:
- help :
- $this->io->writeError([
- ' y - discard changes and apply the '.($update ? 'update' : 'uninstall'),
- ' n - abort the '.($update ? 'update' : 'uninstall').' and let you manually clean things up',
- ' v - view modified files',
- ' d - view local modifications (diff)',
- ]);
- if ($update) {
- $this->io->writeError(' s - stash changes and try to reapply them after the update');
- }
- $this->io->writeError(' ? - print help');
- break;
- }
- }
- return \React\Promise\resolve(null);
- }
- protected function reapplyChanges(string $path): void
- {
- $path = $this->normalizePath($path);
- if (!empty($this->hasStashedChanges[$path])) {
- unset($this->hasStashedChanges[$path]);
- $this->io->writeError(' <info>Re-applying stashed changes</info>');
- if (0 !== $this->process->execute('git stash pop', $output, $path)) {
- throw new \RuntimeException("Failed to apply stashed changes:\n\n".$this->process->getErrorOutput());
- }
- }
- unset($this->hasDiscardedChanges[$path]);
- }
- protected function updateToCommit(PackageInterface $package, string $path, string $reference, string $prettyVersion): ?string
- {
- $force = !empty($this->hasDiscardedChanges[$path]) || !empty($this->hasStashedChanges[$path]) ? '-f ' : '';
- $template = 'git checkout '.$force.'%s -- && git reset --hard %1$s --';
- $branch = Preg::replace('{(?:^dev-|(?:\.x)?-dev$)}i', '', $prettyVersion);
- $branches = null;
- if (0 === $this->process->execute('git branch -r', $output, $path)) {
- $branches = $output;
- }
- $gitRef = $reference;
- if (!Preg::isMatch('{^[a-f0-9]{40}$}', $reference)
- && null !== $branches
- && Preg::isMatch('{^\s+composer/'.preg_quote($reference).'$}m', $branches)
- ) {
- $command = sprintf('git checkout '.$force.'-B %s %s -- && git reset --hard %2$s --', ProcessExecutor::escape($branch), ProcessExecutor::escape('composer/'.$reference));
- if (0 === $this->process->execute($command, $output, $path)) {
- return null;
- }
- }
- if (Preg::isMatch('{^[a-f0-9]{40}$}', $reference)) {
- if (null !== $branches && !Preg::isMatch('{^\s+composer/'.preg_quote($branch).'$}m', $branches) && Preg::isMatch('{^\s+composer/v'.preg_quote($branch).'$}m', $branches)) {
- $branch = 'v' . $branch;
- }
- $command = sprintf('git checkout %s --', ProcessExecutor::escape($branch));
- $fallbackCommand = sprintf('git checkout '.$force.'-B %s %s --', ProcessExecutor::escape($branch), ProcessExecutor::escape('composer/'.$branch));
- $resetCommand = sprintf('git reset --hard %s --', ProcessExecutor::escape($reference));
- if (0 === $this->process->execute("($command || $fallbackCommand) && $resetCommand", $output, $path)) {
- return null;
- }
- }
- $command = sprintf($template, ProcessExecutor::escape($gitRef));
- if (0 === $this->process->execute($command, $output, $path)) {
- return null;
- }
- $exceptionExtra = '';
- if (false !== strpos($this->process->getErrorOutput(), $reference)) {
- $this->io->writeError(' <warning>'.$reference.' is gone (history was rewritten?)</warning>');
- $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.';
- }
- throw new \RuntimeException(Url::sanitize('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput() . $exceptionExtra));
- }
- protected function updateOriginUrl(string $path, string $url): void
- {
- $this->process->execute(sprintf('git remote set-url origin -- %s', ProcessExecutor::escape($url)), $output, $path);
- $this->setPushUrl($path, $url);
- }
- protected function setPushUrl(string $path, string $url): void
- {
- if (Preg::isMatch('{^(?:https?|git)://'.GitUtil::getGitHubDomainsRegex($this->config).'/([^/]+)/([^/]+?)(?:\.git)?$}', $url, $match)) {
- $protocols = $this->config->get('github-protocols');
- $pushUrl = 'git@'.$match[1].':'.$match[2].'/'.$match[3].'.git';
- if (!in_array('ssh', $protocols, true)) {
- $pushUrl = 'https://' . $match[1] . '/'.$match[2].'/'.$match[3].'.git';
- }
- $cmd = sprintf('git remote set-url --push origin -- %s', ProcessExecutor::escape($pushUrl));
- $this->process->execute($cmd, $ignoredOutput, $path);
- }
- }
- protected function getCommitLogs(string $fromReference, string $toReference, string $path): string
- {
- $path = $this->normalizePath($path);
- $command = sprintf('git log %s..%s --pretty=format:"%%h - %%an: %%s"'.GitUtil::getNoShowSignatureFlag($this->process), ProcessExecutor::escape($fromReference), ProcessExecutor::escape($toReference));
- if (0 !== $this->process->execute($command, $output, $path)) {
- throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
- }
- return $output;
- }
- protected function discardChanges(string $path): PromiseInterface
- {
- $path = $this->normalizePath($path);
- if (0 !== $this->process->execute('git clean -df && git reset --hard', $output, $path)) {
- throw new \RuntimeException("Could not reset changes\n\n:".$output);
- }
- $this->hasDiscardedChanges[$path] = true;
- return \React\Promise\resolve(null);
- }
- protected function stashChanges(string $path): PromiseInterface
- {
- $path = $this->normalizePath($path);
- if (0 !== $this->process->execute('git stash --include-untracked', $output, $path)) {
- throw new \RuntimeException("Could not stash changes\n\n:".$output);
- }
- $this->hasStashedChanges[$path] = true;
- return \React\Promise\resolve(null);
- }
- protected function viewDiff(string $path): void
- {
- $path = $this->normalizePath($path);
- if (0 !== $this->process->execute('git diff HEAD', $output, $path)) {
- throw new \RuntimeException("Could not view diff\n\n:".$output);
- }
- $this->io->writeError($output);
- }
- protected function normalizePath(string $path): string
- {
- if (Platform::isWindows() && strlen($path) > 0) {
- $basePath = $path;
- $removed = [];
- while (!is_dir($basePath) && $basePath !== '\\') {
- array_unshift($removed, basename($basePath));
- $basePath = dirname($basePath);
- }
- if ($basePath === '\\') {
- return $path;
- }
- $path = rtrim(realpath($basePath) . '/' . implode('/', $removed), '/');
- }
- return $path;
- }
- protected function hasMetadataRepository(string $path): bool
- {
- $path = $this->normalizePath($path);
- return is_dir($path.'/.git');
- }
- protected function getShortHash(string $reference): string
- {
- if (!$this->io->isVerbose() && Preg::isMatch('{^[0-9a-f]{40}$}', $reference)) {
- return substr($reference, 0, 10);
- }
- return $reference;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Downloader;
- use React\Promise\PromiseInterface;
- use Composer\Package\PackageInterface;
- use Composer\Util\Platform;
- use Composer\Util\ProcessExecutor;
- class GzipDownloader extends ArchiveDownloader
- {
- protected function extract(PackageInterface $package, string $file, string $path): PromiseInterface
- {
- $filename = pathinfo(parse_url(strtr((string) $package->getDistUrl(), '\\', '/'), PHP_URL_PATH), PATHINFO_FILENAME);
- $targetFilepath = $path . DIRECTORY_SEPARATOR . $filename;
- if (!Platform::isWindows()) {
- $command = 'gzip -cd -- ' . ProcessExecutor::escape($file) . ' > ' . ProcessExecutor::escape($targetFilepath);
- if (0 === $this->process->execute($command, $ignoredOutput)) {
- return \React\Promise\resolve(null);
- }
- if (extension_loaded('zlib')) {
- $this->extractUsingExt($file, $targetFilepath);
- return \React\Promise\resolve(null);
- }
- $processError = 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput();
- throw new \RuntimeException($processError);
- }
- $this->extractUsingExt($file, $targetFilepath);
- return \React\Promise\resolve(null);
- }
- private function extractUsingExt(string $file, string $targetFilepath): void
- {
- $archiveFile = gzopen($file, 'rb');
- $targetFile = fopen($targetFilepath, 'wb');
- while ($string = gzread($archiveFile, 4096)) {
- fwrite($targetFile, $string, Platform::strlen($string));
- }
- gzclose($archiveFile);
- fclose($targetFile);
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Downloader;
- use React\Promise\PromiseInterface;
- use Composer\Package\PackageInterface;
- use Composer\Util\ProcessExecutor;
- use Composer\Util\Hg as HgUtils;
- class HgDownloader extends VcsDownloader
- {
- protected function doDownload(PackageInterface $package, string $path, string $url, ?PackageInterface $prevPackage = null): PromiseInterface
- {
- if (null === HgUtils::getVersion($this->process)) {
- throw new \RuntimeException('hg was not found in your PATH, skipping source download');
- }
- return \React\Promise\resolve(null);
- }
- protected function doInstall(PackageInterface $package, string $path, string $url): PromiseInterface
- {
- $hgUtils = new HgUtils($this->io, $this->config, $this->process);
- $cloneCommand = static function (string $url) use ($path): string {
- return sprintf('hg clone -- %s %s', ProcessExecutor::escape($url), ProcessExecutor::escape($path));
- };
- $hgUtils->runCommand($cloneCommand, $url, $path);
- $ref = ProcessExecutor::escape($package->getSourceReference());
- $command = sprintf('hg up -- %s', $ref);
- if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
- throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
- }
- return \React\Promise\resolve(null);
- }
- protected function doUpdate(PackageInterface $initial, PackageInterface $target, string $path, string $url): PromiseInterface
- {
- $hgUtils = new HgUtils($this->io, $this->config, $this->process);
- $ref = $target->getSourceReference();
- $this->io->writeError(" Updating to ".$target->getSourceReference());
- if (!$this->hasMetadataRepository($path)) {
- throw new \RuntimeException('The .hg directory is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
- }
- $command = static function ($url) use ($ref): string {
- return sprintf('hg pull -- %s && hg up -- %s', ProcessExecutor::escape($url), ProcessExecutor::escape($ref));
- };
- $hgUtils->runCommand($command, $url, $path);
- return \React\Promise\resolve(null);
- }
- public function getLocalChanges(PackageInterface $package, string $path): ?string
- {
- if (!is_dir($path.'/.hg')) {
- return null;
- }
- $this->process->execute('hg st', $output, realpath($path));
- $output = trim($output);
- return strlen($output) > 0 ? $output : null;
- }
- protected function getCommitLogs(string $fromReference, string $toReference, string $path): string
- {
- $command = sprintf('hg log -r %s:%s --style compact', ProcessExecutor::escape($fromReference), ProcessExecutor::escape($toReference));
- if (0 !== $this->process->execute($command, $output, realpath($path))) {
- throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
- }
- return $output;
- }
- protected function hasMetadataRepository(string $path): bool
- {
- return is_dir($path . '/.hg');
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Downloader;
- class MaxFileSizeExceededException extends TransportException
- {
- }
- <?php declare(strict_types=1);
- namespace Composer\Downloader;
- use React\Promise\PromiseInterface;
- use Composer\Package\Archiver\ArchivableFilesFinder;
- use Composer\Package\Dumper\ArrayDumper;
- use Composer\Package\PackageInterface;
- use Composer\Package\Version\VersionGuesser;
- use Composer\Package\Version\VersionParser;
- use Composer\Util\Platform;
- use Composer\Util\Filesystem;
- use Symfony\Component\Filesystem\Exception\IOException;
- use Symfony\Component\Filesystem\Filesystem as SymfonyFilesystem;
- use Composer\DependencyResolver\Operation\InstallOperation;
- use Composer\DependencyResolver\Operation\UninstallOperation;
- class PathDownloader extends FileDownloader implements VcsCapableDownloaderInterface
- {
- private const STRATEGY_SYMLINK = 10;
- private const STRATEGY_MIRROR = 20;
- public function download(PackageInterface $package, string $path, ?PackageInterface $prevPackage = null, bool $output = true): PromiseInterface
- {
- $path = Filesystem::trimTrailingSlash($path);
- $url = $package->getDistUrl();
- $realUrl = realpath($url);
- if (false === $realUrl || !file_exists($realUrl) || !is_dir($realUrl)) {
- throw new \RuntimeException(sprintf(
- 'Source path "%s" is not found for package %s',
- $url,
- $package->getName()
- ));
- }
- if (realpath($path) === $realUrl) {
- return \React\Promise\resolve(null);
- }
- if (strpos(realpath($path) . DIRECTORY_SEPARATOR, $realUrl . DIRECTORY_SEPARATOR) === 0) {
- throw new \RuntimeException(sprintf(
- 'Package %s cannot install to "%s" inside its source at "%s"',
- $package->getName(),
- realpath($path),
- $realUrl
- ));
- }
- return \React\Promise\resolve(null);
- }
- public function install(PackageInterface $package, string $path, bool $output = true): PromiseInterface
- {
- $path = Filesystem::trimTrailingSlash($path);
- $url = $package->getDistUrl();
- $realUrl = realpath($url);
- if (realpath($path) === $realUrl) {
- if ($output) {
- $this->io->writeError(" - " . InstallOperation::format($package) . $this->getInstallOperationAppendix($package, $path));
- }
- return \React\Promise\resolve(null);
- }
- $transportOptions = $package->getTransportOptions() + ['relative' => true];
- [$currentStrategy, $allowedStrategies] = $this->computeAllowedStrategies($transportOptions);
- $symfonyFilesystem = new SymfonyFilesystem();
- $this->filesystem->removeDirectory($path);
- if ($output) {
- $this->io->writeError(" - " . InstallOperation::format($package).': ', false);
- }
- $isFallback = false;
- if (self::STRATEGY_SYMLINK === $currentStrategy) {
- try {
- if (Platform::isWindows()) {
- if ($output) {
- $this->io->writeError(sprintf('Junctioning from %s', $url), false);
- }
- $this->filesystem->junction($realUrl, $path);
- } else {
- $absolutePath = $path;
- if (!$this->filesystem->isAbsolutePath($absolutePath)) {
- $absolutePath = Platform::getCwd() . DIRECTORY_SEPARATOR . $path;
- }
- $shortestPath = $this->filesystem->findShortestPath($absolutePath, $realUrl);
- $path = rtrim($path, "/");
- if ($output) {
- $this->io->writeError(sprintf('Symlinking from %s', $url), false);
- }
- if ($transportOptions['relative']) {
- $symfonyFilesystem->symlink($shortestPath.'/', $path);
- } else {
- $symfonyFilesystem->symlink($realUrl.'/', $path);
- }
- }
- } catch (IOException $e) {
- if (in_array(self::STRATEGY_MIRROR, $allowedStrategies, true)) {
- if ($output) {
- $this->io->writeError('');
- $this->io->writeError(' <error>Symlink failed, fallback to use mirroring!</error>');
- }
- $currentStrategy = self::STRATEGY_MIRROR;
- $isFallback = true;
- } else {
- throw new \RuntimeException(sprintf('Symlink from "%s" to "%s" failed!', $realUrl, $path));
- }
- }
- }
- if (self::STRATEGY_MIRROR === $currentStrategy) {
- $realUrl = $this->filesystem->normalizePath($realUrl);
- if ($output) {
- $this->io->writeError(sprintf('%sMirroring from %s', $isFallback ? ' ' : '', $url), false);
- }
- $iterator = new ArchivableFilesFinder($realUrl, []);
- $symfonyFilesystem->mirror($realUrl, $path, $iterator);
- }
- if ($output) {
- $this->io->writeError('');
- }
- return \React\Promise\resolve(null);
- }
- public function remove(PackageInterface $package, string $path, bool $output = true): PromiseInterface
- {
- $path = Filesystem::trimTrailingSlash($path);
- if (Platform::isWindows() && $this->filesystem->isJunction($path)) {
- if ($output) {
- $this->io->writeError(" - " . UninstallOperation::format($package).", source is still present in $path");
- }
- if (!$this->filesystem->removeJunction($path)) {
- $this->io->writeError(" <warning>Could not remove junction at " . $path . " - is another process locking it?</warning>");
- throw new \RuntimeException('Could not reliably remove junction for package ' . $package->getName());
- }
- return \React\Promise\resolve(null);
- }
- $fs = new Filesystem;
- $absPath = $fs->isAbsolutePath($path) ? $path : Platform::getCwd() . '/' . $path;
- $absDistUrl = $fs->isAbsolutePath($package->getDistUrl()) ? $package->getDistUrl() : Platform::getCwd() . '/' . $package->getDistUrl();
- if ($fs->normalizePath($absPath) === $fs->normalizePath($absDistUrl)) {
- if ($output) {
- $this->io->writeError(" - " . UninstallOperation::format($package).", source is still present in $path");
- }
- return \React\Promise\resolve(null);
- }
- return parent::remove($package, $path, $output);
- }
- public function getVcsReference(PackageInterface $package, string $path): ?string
- {
- $path = Filesystem::trimTrailingSlash($path);
- $parser = new VersionParser;
- $guesser = new VersionGuesser($this->config, $this->process, $parser);
- $dumper = new ArrayDumper;
- $packageConfig = $dumper->dump($package);
- if ($packageVersion = $guesser->guessVersion($packageConfig, $path)) {
- return $packageVersion['commit'];
- }
- return null;
- }
- protected function getInstallOperationAppendix(PackageInterface $package, string $path): string
- {
- $realUrl = realpath($package->getDistUrl());
- if (realpath($path) === $realUrl) {
- return ': Source already present';
- }
- [$currentStrategy] = $this->computeAllowedStrategies($package->getTransportOptions());
- if ($currentStrategy === self::STRATEGY_SYMLINK) {
- if (Platform::isWindows()) {
- return ': Junctioning from '.$package->getDistUrl();
- }
- return ': Symlinking from '.$package->getDistUrl();
- }
- return ': Mirroring from '.$package->getDistUrl();
- }
- private function computeAllowedStrategies(array $transportOptions): array
- {
- $currentStrategy = self::STRATEGY_SYMLINK;
- $allowedStrategies = [self::STRATEGY_SYMLINK, self::STRATEGY_MIRROR];
- $mirrorPathRepos = Platform::getEnv('COMPOSER_MIRROR_PATH_REPOS');
- if ($mirrorPathRepos) {
- $currentStrategy = self::STRATEGY_MIRROR;
- }
- $symlinkOption = $transportOptions['symlink'] ?? null;
- if (true === $symlinkOption) {
- $currentStrategy = self::STRATEGY_SYMLINK;
- $allowedStrategies = [self::STRATEGY_SYMLINK];
- } elseif (false === $symlinkOption) {
- $currentStrategy = self::STRATEGY_MIRROR;
- $allowedStrategies = [self::STRATEGY_MIRROR];
- }
- if (Platform::isWindows() && self::STRATEGY_SYMLINK === $currentStrategy && !$this->safeJunctions()) {
- if (!in_array(self::STRATEGY_MIRROR, $allowedStrategies, true)) {
- 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');
- }
- $currentStrategy = self::STRATEGY_MIRROR;
- $allowedStrategies = [self::STRATEGY_MIRROR];
- }
- if (!Platform::isWindows() && self::STRATEGY_SYMLINK === $currentStrategy && !function_exists('symlink')) {
- if (!in_array(self::STRATEGY_MIRROR, $allowedStrategies, true)) {
- 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');
- }
- $currentStrategy = self::STRATEGY_MIRROR;
- $allowedStrategies = [self::STRATEGY_MIRROR];
- }
- return [$currentStrategy, $allowedStrategies];
- }
- private function safeJunctions(): bool
- {
- return function_exists('proc_open') &&
- (PHP_WINDOWS_VERSION_MAJOR > 6 ||
- (PHP_WINDOWS_VERSION_MAJOR === 6 && PHP_WINDOWS_VERSION_MINOR >= 1));
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Downloader;
- use React\Promise\PromiseInterface;
- use Composer\Package\PackageInterface;
- use Composer\Repository\VcsRepository;
- use Composer\Util\Perforce;
- class PerforceDownloader extends VcsDownloader
- {
- protected $perforce;
- protected function doDownload(PackageInterface $package, string $path, string $url, ?PackageInterface $prevPackage = null): PromiseInterface
- {
- return \React\Promise\resolve(null);
- }
- public function doInstall(PackageInterface $package, string $path, string $url): PromiseInterface
- {
- $ref = $package->getSourceReference();
- $label = $this->getLabelFromSourceReference((string) $ref);
- $this->io->writeError('Cloning ' . $ref);
- $this->initPerforce($package, $path, $url);
- $this->perforce->setStream($ref);
- $this->perforce->p4Login();
- $this->perforce->writeP4ClientSpec();
- $this->perforce->connectClient();
- $this->perforce->syncCodeBase($label);
- $this->perforce->cleanupClientSpec();
- return \React\Promise\resolve(null);
- }
- private function getLabelFromSourceReference(string $ref): ?string
- {
- $pos = strpos($ref, '@');
- if (false !== $pos) {
- return substr($ref, $pos + 1);
- }
- return null;
- }
- public function initPerforce(PackageInterface $package, string $path, string $url): void
- {
- if (!empty($this->perforce)) {
- $this->perforce->initializePath($path);
- return;
- }
- $repository = $package->getRepository();
- $repoConfig = null;
- if ($repository instanceof VcsRepository) {
- $repoConfig = $this->getRepoConfig($repository);
- }
- $this->perforce = Perforce::create($repoConfig, $url, $path, $this->process, $this->io);
- }
- private function getRepoConfig(VcsRepository $repository): array
- {
- return $repository->getRepoConfig();
- }
- protected function doUpdate(PackageInterface $initial, PackageInterface $target, string $path, string $url): PromiseInterface
- {
- return $this->doInstall($target, $path, $url);
- }
- public function getLocalChanges(PackageInterface $package, string $path): ?string
- {
- $this->io->writeError('Perforce driver does not check for local changes before overriding');
- return null;
- }
- protected function getCommitLogs(string $fromReference, string $toReference, string $path): string
- {
- return $this->perforce->getCommitLogs($fromReference, $toReference);
- }
- public function setPerforce(Perforce $perforce): void
- {
- $this->perforce = $perforce;
- }
- protected function hasMetadataRepository(string $path): bool
- {
- return true;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Downloader;
- use React\Promise\PromiseInterface;
- use Composer\Package\PackageInterface;
- class PharDownloader extends ArchiveDownloader
- {
- protected function extract(PackageInterface $package, string $file, string $path): PromiseInterface
- {
- $archive = new \Phar($file);
- $archive->extractTo($path, null, true);
- return \React\Promise\resolve(null);
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Downloader;
- use React\Promise\PromiseInterface;
- use Composer\Util\IniHelper;
- use Composer\Util\Platform;
- use Composer\Util\ProcessExecutor;
- use Composer\Package\PackageInterface;
- use RarArchive;
- class RarDownloader extends ArchiveDownloader
- {
- protected function extract(PackageInterface $package, string $file, string $path): PromiseInterface
- {
- $processError = null;
- if (!Platform::isWindows()) {
- $command = 'unrar x -- ' . ProcessExecutor::escape($file) . ' ' . ProcessExecutor::escape($path) . ' >/dev/null && chmod -R u+w ' . ProcessExecutor::escape($path);
- if (0 === $this->process->execute($command, $ignoredOutput)) {
- return \React\Promise\resolve(null);
- }
- $processError = 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput();
- }
- if (!class_exists('RarArchive')) {
- $iniMessage = IniHelper::getMessage();
- $error = "Could not decompress the archive, enable the PHP rar extension or install unrar.\n"
- . $iniMessage . "\n" . $processError;
- if (!Platform::isWindows()) {
- $error = "Could not decompress the archive, enable the PHP rar extension.\n" . $iniMessage;
- }
- throw new \RuntimeException($error);
- }
- $rarArchive = RarArchive::open($file);
- if (false === $rarArchive) {
- throw new \UnexpectedValueException('Could not open RAR archive: ' . $file);
- }
- $entries = $rarArchive->getEntries();
- if (false === $entries) {
- throw new \RuntimeException('Could not retrieve RAR archive entries');
- }
- foreach ($entries as $entry) {
- if (false === $entry->extract($path)) {
- throw new \RuntimeException('Could not extract entry');
- }
- }
- $rarArchive->close();
- return \React\Promise\resolve(null);
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Downloader;
- use Composer\Package\PackageInterface;
- use Composer\Pcre\Preg;
- use Composer\Util\Svn as SvnUtil;
- use Composer\Repository\VcsRepository;
- use Composer\Util\ProcessExecutor;
- use React\Promise\PromiseInterface;
- class SvnDownloader extends VcsDownloader
- {
- protected $cacheCredentials = true;
- protected function doDownload(PackageInterface $package, string $path, string $url, ?PackageInterface $prevPackage = null): PromiseInterface
- {
- SvnUtil::cleanEnv();
- $util = new SvnUtil($url, $this->io, $this->config, $this->process);
- if (null === $util->binaryVersion()) {
- throw new \RuntimeException('svn was not found in your PATH, skipping source download');
- }
- return \React\Promise\resolve(null);
- }
- protected function doInstall(PackageInterface $package, string $path, string $url): PromiseInterface
- {
- SvnUtil::cleanEnv();
- $ref = $package->getSourceReference();
- $repo = $package->getRepository();
- if ($repo instanceof VcsRepository) {
- $repoConfig = $repo->getRepoConfig();
- if (array_key_exists('svn-cache-credentials', $repoConfig)) {
- $this->cacheCredentials = (bool) $repoConfig['svn-cache-credentials'];
- }
- }
- $this->io->writeError(" Checking out ".$package->getSourceReference());
- $this->execute($package, $url, "svn co", sprintf("%s/%s", $url, $ref), null, $path);
- return \React\Promise\resolve(null);
- }
- protected function doUpdate(PackageInterface $initial, PackageInterface $target, string $path, string $url): PromiseInterface
- {
- SvnUtil::cleanEnv();
- $ref = $target->getSourceReference();
- if (!$this->hasMetadataRepository($path)) {
- throw new \RuntimeException('The .svn directory is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
- }
- $util = new SvnUtil($url, $this->io, $this->config, $this->process);
- $flags = "";
- if (version_compare($util->binaryVersion(), '1.7.0', '>=')) {
- $flags .= ' --ignore-ancestry';
- }
- $this->io->writeError(" Checking out " . $ref);
- $this->execute($target, $url, "svn switch" . $flags, sprintf("%s/%s", $url, $ref), $path);
- return \React\Promise\resolve(null);
- }
- public function getLocalChanges(PackageInterface $package, string $path): ?string
- {
- if (!$this->hasMetadataRepository($path)) {
- return null;
- }
- $this->process->execute('svn status --ignore-externals', $output, $path);
- return Preg::isMatch('{^ *[^X ] +}m', $output) ? $output : null;
- }
- protected function execute(PackageInterface $package, string $baseUrl, string $command, string $url, ?string $cwd = null, ?string $path = null): string
- {
- $util = new SvnUtil($baseUrl, $this->io, $this->config, $this->process);
- $util->setCacheCredentials($this->cacheCredentials);
- try {
- return $util->execute($command, $url, $cwd, $path, $this->io->isVerbose());
- } catch (\RuntimeException $e) {
- throw new \RuntimeException(
- $package->getPrettyName().' could not be downloaded, '.$e->getMessage()
- );
- }
- }
- protected function cleanChanges(PackageInterface $package, string $path, bool $update): PromiseInterface
- {
- if (null === ($changes = $this->getLocalChanges($package, $path))) {
- return \React\Promise\resolve(null);
- }
- if (!$this->io->isInteractive()) {
- if (true === $this->config->get('discard-changes')) {
- return $this->discardChanges($path);
- }
- return parent::cleanChanges($package, $path, $update);
- }
- $changes = array_map(static function ($elem): string {
- return ' '.$elem;
- }, Preg::split('{\s*\r?\n\s*}', $changes));
- $countChanges = count($changes);
- $this->io->writeError(sprintf(' <error>'.$package->getPrettyName().' has modified file%s:</error>', $countChanges === 1 ? '' : 's'));
- $this->io->writeError(array_slice($changes, 0, 10));
- if ($countChanges > 10) {
- $remainingChanges = $countChanges - 10;
- $this->io->writeError(
- sprintf(
- ' <info>'.$remainingChanges.' more file%s modified, choose "v" to view the full list</info>',
- $remainingChanges === 1 ? '' : 's'
- )
- );
- }
- while (true) {
- switch ($this->io->ask(' <info>Discard changes [y,n,v,?]?</info> ', '?')) {
- case 'y':
- $this->discardChanges($path);
- break 2;
- case 'n':
- throw new \RuntimeException('Update aborted');
- case 'v':
- $this->io->writeError($changes);
- break;
- case '?':
- default:
- $this->io->writeError([
- ' y - discard changes and apply the '.($update ? 'update' : 'uninstall'),
- ' n - abort the '.($update ? 'update' : 'uninstall').' and let you manually clean things up',
- ' v - view modified files',
- ' ? - print help',
- ]);
- break;
- }
- }
- return \React\Promise\resolve(null);
- }
- protected function getCommitLogs(string $fromReference, string $toReference, string $path): string
- {
- if (Preg::isMatch('{@(\d+)$}', $fromReference) && Preg::isMatch('{@(\d+)$}', $toReference)) {
- $command = sprintf('svn info --non-interactive --xml -- %s', ProcessExecutor::escape($path));
- if (0 !== $this->process->execute($command, $output, $path)) {
- throw new \RuntimeException(
- 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput()
- );
- }
- $urlPattern = '#<url>(.*)</url>#';
- if (Preg::isMatch($urlPattern, $output, $matches)) {
- $baseUrl = $matches[1];
- } else {
- throw new \RuntimeException(
- 'Unable to determine svn url for path '. $path
- );
- }
- $fromRevision = Preg::replace('{.*@(\d+)$}', '$1', $fromReference);
- $toRevision = Preg::replace('{.*@(\d+)$}', '$1', $toReference);
- $command = sprintf('svn log -r%s:%s --incremental', ProcessExecutor::escape($fromRevision), ProcessExecutor::escape($toRevision));
- $util = new SvnUtil($baseUrl, $this->io, $this->config, $this->process);
- $util->setCacheCredentials($this->cacheCredentials);
- try {
- return $util->executeLocal($command, $path, null, $this->io->isVerbose());
- } catch (\RuntimeException $e) {
- throw new \RuntimeException(
- 'Failed to execute ' . $command . "\n\n".$e->getMessage()
- );
- }
- }
- return "Could not retrieve changes between $fromReference and $toReference due to missing revision information";
- }
- protected function discardChanges(string $path): PromiseInterface
- {
- if (0 !== $this->process->execute('svn revert -R .', $output, $path)) {
- throw new \RuntimeException("Could not reset changes\n\n:".$this->process->getErrorOutput());
- }
- return \React\Promise\resolve(null);
- }
- protected function hasMetadataRepository(string $path): bool
- {
- return is_dir($path.'/.svn');
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Downloader;
- use Composer\Package\PackageInterface;
- use React\Promise\PromiseInterface;
- class TarDownloader extends ArchiveDownloader
- {
- protected function extract(PackageInterface $package, string $file, string $path): PromiseInterface
- {
- $archive = new \PharData($file);
- $archive->extractTo($path, null, true);
- return \React\Promise\resolve(null);
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Downloader;
- class TransportException extends \RuntimeException
- {
- protected $headers;
- protected $response;
- protected $statusCode;
- protected $responseInfo = [];
- public function setHeaders(array $headers): void
- {
- $this->headers = $headers;
- }
- public function getHeaders(): ?array
- {
- return $this->headers;
- }
- public function setResponse(?string $response): void
- {
- $this->response = $response;
- }
- public function getResponse(): ?string
- {
- return $this->response;
- }
- public function setStatusCode($statusCode): void
- {
- $this->statusCode = $statusCode;
- }
- public function getStatusCode(): ?int
- {
- return $this->statusCode;
- }
- public function getResponseInfo(): array
- {
- return $this->responseInfo;
- }
- public function setResponseInfo(array $responseInfo): void
- {
- $this->responseInfo = $responseInfo;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Downloader;
- use Composer\Package\PackageInterface;
- interface VcsCapableDownloaderInterface
- {
- public function getVcsReference(PackageInterface $package, string $path): ?string;
- }
- <?php declare(strict_types=1);
- namespace Composer\Downloader;
- use Composer\Config;
- use Composer\Package\Dumper\ArrayDumper;
- use Composer\Package\PackageInterface;
- use Composer\Package\Version\VersionGuesser;
- use Composer\Package\Version\VersionParser;
- use Composer\Util\ProcessExecutor;
- use Composer\IO\IOInterface;
- use Composer\Util\Filesystem;
- use React\Promise\PromiseInterface;
- use Composer\DependencyResolver\Operation\UpdateOperation;
- use Composer\DependencyResolver\Operation\InstallOperation;
- use Composer\DependencyResolver\Operation\UninstallOperation;
- abstract class VcsDownloader implements DownloaderInterface, ChangeReportInterface, VcsCapableDownloaderInterface
- {
- protected $io;
- protected $config;
- protected $process;
- protected $filesystem;
- protected $hasCleanedChanges = [];
- public function __construct(IOInterface $io, Config $config, ?ProcessExecutor $process = null, ?Filesystem $fs = null)
- {
- $this->io = $io;
- $this->config = $config;
- $this->process = $process ?? new ProcessExecutor($io);
- $this->filesystem = $fs ?? new Filesystem($this->process);
- }
- public function getInstallationSource(): string
- {
- return 'source';
- }
- public function download(PackageInterface $package, string $path, ?PackageInterface $prevPackage = null): PromiseInterface
- {
- if (!$package->getSourceReference()) {
- throw new \InvalidArgumentException('Package '.$package->getPrettyName().' is missing reference information');
- }
- $urls = $this->prepareUrls($package->getSourceUrls());
- while ($url = array_shift($urls)) {
- try {
- return $this->doDownload($package, $path, $url, $prevPackage);
- } catch (\Exception $e) {
- if ($e instanceof \PHPUnit\Framework\Exception) {
- throw $e;
- }
- if ($this->io->isDebug()) {
- $this->io->writeError('Failed: ['.get_class($e).'] '.$e->getMessage());
- } elseif (count($urls)) {
- $this->io->writeError(' Failed, trying the next URL');
- }
- if (!count($urls)) {
- throw $e;
- }
- }
- }
- return \React\Promise\resolve(null);
- }
- public function prepare(string $type, PackageInterface $package, string $path, ?PackageInterface $prevPackage = null): PromiseInterface
- {
- if ($type === 'update') {
- $this->cleanChanges($prevPackage, $path, true);
- $this->hasCleanedChanges[$prevPackage->getUniqueName()] = true;
- } elseif ($type === 'install') {
- $this->filesystem->emptyDirectory($path);
- } elseif ($type === 'uninstall') {
- $this->cleanChanges($package, $path, false);
- }
- return \React\Promise\resolve(null);
- }
- public function cleanup(string $type, PackageInterface $package, string $path, ?PackageInterface $prevPackage = null): PromiseInterface
- {
- if ($type === 'update' && isset($this->hasCleanedChanges[$prevPackage->getUniqueName()])) {
- $this->reapplyChanges($path);
- unset($this->hasCleanedChanges[$prevPackage->getUniqueName()]);
- }
- return \React\Promise\resolve(null);
- }
- public function install(PackageInterface $package, string $path): PromiseInterface
- {
- if (!$package->getSourceReference()) {
- throw new \InvalidArgumentException('Package '.$package->getPrettyName().' is missing reference information');
- }
- $this->io->writeError(" - " . InstallOperation::format($package).': ', false);
- $urls = $this->prepareUrls($package->getSourceUrls());
- while ($url = array_shift($urls)) {
- try {
- $this->doInstall($package, $path, $url);
- break;
- } catch (\Exception $e) {
- if ($e instanceof \PHPUnit\Framework\Exception) {
- throw $e;
- }
- if ($this->io->isDebug()) {
- $this->io->writeError('Failed: ['.get_class($e).'] '.$e->getMessage());
- } elseif (count($urls)) {
- $this->io->writeError(' Failed, trying the next URL');
- }
- if (!count($urls)) {
- throw $e;
- }
- }
- }
- return \React\Promise\resolve(null);
- }
- public function update(PackageInterface $initial, PackageInterface $target, string $path): PromiseInterface
- {
- if (!$target->getSourceReference()) {
- throw new \InvalidArgumentException('Package '.$target->getPrettyName().' is missing reference information');
- }
- $this->io->writeError(" - " . UpdateOperation::format($initial, $target).': ', false);
- $urls = $this->prepareUrls($target->getSourceUrls());
- $exception = null;
- while ($url = array_shift($urls)) {
- try {
- $this->doUpdate($initial, $target, $path, $url);
- $exception = null;
- break;
- } catch (\Exception $exception) {
- if ($exception instanceof \PHPUnit\Framework\Exception) {
- throw $exception;
- }
- if ($this->io->isDebug()) {
- $this->io->writeError('Failed: ['.get_class($exception).'] '.$exception->getMessage());
- } elseif (count($urls)) {
- $this->io->writeError(' Failed, trying the next URL');
- }
- }
- }
- if (!$exception && $this->io->isVerbose() && $this->hasMetadataRepository($path)) {
- $message = 'Pulling in changes:';
- $logs = $this->getCommitLogs($initial->getSourceReference(), $target->getSourceReference(), $path);
- if ('' === trim($logs)) {
- $message = 'Rolling back changes:';
- $logs = $this->getCommitLogs($target->getSourceReference(), $initial->getSourceReference(), $path);
- }
- if ('' !== trim($logs)) {
- $logs = implode("\n", array_map(static function ($line): string {
- return ' ' . $line;
- }, explode("\n", $logs)));
- $logs = str_replace('<', '\<', $logs);
- $this->io->writeError(' '.$message);
- $this->io->writeError($logs);
- }
- }
- if (!$urls && $exception) {
- throw $exception;
- }
- return \React\Promise\resolve(null);
- }
- public function remove(PackageInterface $package, string $path): PromiseInterface
- {
- $this->io->writeError(" - " . UninstallOperation::format($package));
- $promise = $this->filesystem->removeDirectoryAsync($path);
- return $promise->then(static function (bool $result) use ($path) {
- if (!$result) {
- throw new \RuntimeException('Could not completely delete '.$path.', aborting.');
- }
- });
- }
- public function getVcsReference(PackageInterface $package, string $path): ?string
- {
- $parser = new VersionParser;
- $guesser = new VersionGuesser($this->config, $this->process, $parser);
- $dumper = new ArrayDumper;
- $packageConfig = $dumper->dump($package);
- if ($packageVersion = $guesser->guessVersion($packageConfig, $path)) {
- return $packageVersion['commit'];
- }
- return null;
- }
- protected function cleanChanges(PackageInterface $package, string $path, bool $update): PromiseInterface
- {
- if (null !== $this->getLocalChanges($package, $path)) {
- throw new \RuntimeException('Source directory ' . $path . ' has uncommitted changes.');
- }
- return \React\Promise\resolve(null);
- }
- protected function reapplyChanges(string $path): void
- {
- }
- abstract protected function doDownload(PackageInterface $package, string $path, string $url, ?PackageInterface $prevPackage = null): PromiseInterface;
- abstract protected function doInstall(PackageInterface $package, string $path, string $url): PromiseInterface;
- abstract protected function doUpdate(PackageInterface $initial, PackageInterface $target, string $path, string $url): PromiseInterface;
- abstract protected function getCommitLogs(string $fromReference, string $toReference, string $path): string;
- abstract protected function hasMetadataRepository(string $path): bool;
- private function prepareUrls(array $urls): array
- {
- foreach ($urls as $index => $url) {
- if (Filesystem::isLocalPath($url)) {
- $fileProtocol = 'file://';
- $isFileProtocol = false;
- if (0 === strpos($url, $fileProtocol)) {
- $url = substr($url, strlen($fileProtocol));
- $isFileProtocol = true;
- }
- if (false !== strpos($url, '%')) {
- $url = rawurldecode($url);
- }
- $urls[$index] = realpath($url);
- if ($isFileProtocol) {
- $urls[$index] = $fileProtocol . $urls[$index];
- }
- }
- }
- return $urls;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Downloader;
- use React\Promise\PromiseInterface;
- use Composer\Package\PackageInterface;
- use Composer\Util\ProcessExecutor;
- class XzDownloader extends ArchiveDownloader
- {
- protected function extract(PackageInterface $package, string $file, string $path): PromiseInterface
- {
- $command = 'tar -xJf ' . ProcessExecutor::escape($file) . ' -C ' . ProcessExecutor::escape($path);
- if (0 === $this->process->execute($command, $ignoredOutput)) {
- return \React\Promise\resolve(null);
- }
- $processError = 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput();
- throw new \RuntimeException($processError);
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Downloader;
- use Composer\Package\PackageInterface;
- use Composer\Pcre\Preg;
- use Composer\Util\IniHelper;
- use Composer\Util\Platform;
- use Composer\Util\ProcessExecutor;
- use Symfony\Component\Process\ExecutableFinder;
- use Symfony\Component\Process\Process;
- use React\Promise\PromiseInterface;
- use ZipArchive;
- class ZipDownloader extends ArchiveDownloader
- {
- private static $unzipCommands;
- private static $hasZipArchive;
- private static $isWindows;
- private $zipArchiveObject;
- public function download(PackageInterface $package, string $path, ?PackageInterface $prevPackage = null, bool $output = true): PromiseInterface
- {
- if (null === self::$unzipCommands) {
- self::$unzipCommands = [];
- $finder = new ExecutableFinder;
- if (Platform::isWindows() && ($cmd = $finder->find('7z', null, ['C:\Program Files\7-Zip']))) {
- self::$unzipCommands[] = ['7z', ProcessExecutor::escape($cmd).' x -bb0 -y %s -o%s'];
- }
- if ($cmd = $finder->find('unzip')) {
- self::$unzipCommands[] = ['unzip', ProcessExecutor::escape($cmd).' -qq %s -d %s'];
- }
- if (!Platform::isWindows() && ($cmd = $finder->find('7z'))) {
- self::$unzipCommands[] = ['7z', ProcessExecutor::escape($cmd).' x -bb0 -y %s -o%s'];
- }
- if (!Platform::isWindows() && ($cmd = $finder->find('7zz'))) {
- self::$unzipCommands[] = ['7zz', ProcessExecutor::escape($cmd).' x -bb0 -y %s -o%s'];
- }
- }
- $procOpenMissing = false;
- if (!function_exists('proc_open')) {
- self::$unzipCommands = [];
- $procOpenMissing = true;
- }
- if (null === self::$hasZipArchive) {
- self::$hasZipArchive = class_exists('ZipArchive');
- }
- if (!self::$hasZipArchive && !self::$unzipCommands) {
- $iniMessage = IniHelper::getMessage();
- if ($procOpenMissing) {
- $error = "The zip extension is missing and unzip/7z commands cannot be called as proc_open is disabled, skipping.\n" . $iniMessage;
- } else {
- $error = "The zip extension and unzip/7z commands are both missing, skipping.\n" . $iniMessage;
- }
- throw new \RuntimeException($error);
- }
- if (null === self::$isWindows) {
- self::$isWindows = Platform::isWindows();
- if (!self::$isWindows && !self::$unzipCommands) {
- if ($procOpenMissing) {
- $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>");
- $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>");
- $this->io->writeError("<warning>Enabling proc_open and installing 'unzip' or '7z' (21.01+) may remediate them.</warning>");
- } else {
- $this->io->writeError("<warning>As there is no 'unzip' nor '7z' command installed zip files are being unpacked using the PHP zip extension.</warning>");
- $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>");
- $this->io->writeError("<warning>Installing 'unzip' or '7z' (21.01+) may remediate them.</warning>");
- }
- }
- }
- return parent::download($package, $path, $prevPackage, $output);
- }
- private function extractWithSystemUnzip(PackageInterface $package, string $file, string $path): PromiseInterface
- {
- static $warned7ZipLinux = false;
- $isLastChance = !self::$hasZipArchive;
- if (!self::$unzipCommands) {
- return $this->extractWithZipArchive($package, $file, $path);
- }
- $commandSpec = reset(self::$unzipCommands);
- $command = sprintf($commandSpec[1], ProcessExecutor::escape($file), ProcessExecutor::escape($path));
- if (Platform::isWindows()) {
- $command = sprintf($commandSpec[1], ProcessExecutor::escape(strtr($file, '/', '\\')), ProcessExecutor::escape(strtr($path, '/', '\\')));
- }
- $executable = $commandSpec[0];
- if (!$warned7ZipLinux && !Platform::isWindows() && in_array($executable, ['7z', '7zz'], true)) {
- $warned7ZipLinux = true;
- if (0 === $this->process->execute($executable, $output)) {
- if (Preg::isMatch('{^\s*7-Zip(?: \[64\])? ([0-9.]+)}', $output, $match) && version_compare($match[1], '21.01', '<')) {
- $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>');
- }
- }
- }
- $io = $this->io;
- $tryFallback = function (\Throwable $processError) use ($isLastChance, $io, $file, $path, $package, $executable): \React\Promise\PromiseInterface {
- if ($isLastChance) {
- throw $processError;
- }
- if (!is_file($file)) {
- $io->writeError(' <warning>'.$processError->getMessage().'</warning>');
- $io->writeError(' <warning>This most likely is due to a custom installer plugin not handling the returned Promise from the downloader</warning>');
- $io->writeError(' <warning>See https://github.com/composer/installers/commit/5006d0c28730ade233a8f42ec31ac68fb1c5c9bb for an example fix</warning>');
- } else {
- $io->writeError(' <warning>'.$processError->getMessage().'</warning>');
- $io->writeError(' The archive may contain identical file names with different capitalization (which fails on case insensitive filesystems)');
- $io->writeError(' Unzip with '.$executable.' command failed, falling back to ZipArchive class');
- }
- return $this->extractWithZipArchive($package, $file, $path);
- };
- try {
- $promise = $this->process->executeAsync($command);
- return $promise->then(function (Process $process) use ($tryFallback, $command, $package, $file) {
- if (!$process->isSuccessful()) {
- if (isset($this->cleanupExecuted[$package->getName()])) {
- throw new \RuntimeException('Failed to extract '.$package->getName().' as the installation was aborted by another package operation.');
- }
- $output = $process->getErrorOutput();
- $output = str_replace(', '.$file.'.zip or '.$file.'.ZIP', '', $output);
- return $tryFallback(new \RuntimeException('Failed to extract '.$package->getName().': ('.$process->getExitCode().') '.$command."\n\n".$output));
- }
- });
- } catch (\Throwable $e) {
- return $tryFallback($e);
- }
- }
- private function extractWithZipArchive(PackageInterface $package, string $file, string $path): PromiseInterface
- {
- $processError = null;
- $zipArchive = $this->zipArchiveObject ?: new ZipArchive();
- try {
- if (!file_exists($file) || ($filesize = filesize($file)) === false || $filesize === 0) {
- $retval = -1;
- } else {
- $retval = $zipArchive->open($file);
- }
- if (true === $retval) {
- $extractResult = $zipArchive->extractTo($path);
- if (true === $extractResult) {
- $zipArchive->close();
- return \React\Promise\resolve(null);
- }
- $processError = new \RuntimeException(rtrim("There was an error extracting the ZIP file, it is either corrupted or using an invalid format.\n"));
- } else {
- $processError = new \UnexpectedValueException(rtrim($this->getErrorMessage($retval, $file)."\n"), $retval);
- }
- } catch (\ErrorException $e) {
- $processError = new \RuntimeException('The archive may contain identical file names with different capitalization (which fails on case insensitive filesystems): '.$e->getMessage(), 0, $e);
- } catch (\Throwable $e) {
- $processError = $e;
- }
- throw $processError;
- }
- protected function extract(PackageInterface $package, string $file, string $path): PromiseInterface
- {
- return $this->extractWithSystemUnzip($package, $file, $path);
- }
- protected function getErrorMessage(int $retval, string $file): string
- {
- switch ($retval) {
- case ZipArchive::ER_EXISTS:
- return sprintf("File '%s' already exists.", $file);
- case ZipArchive::ER_INCONS:
- return sprintf("Zip archive '%s' is inconsistent.", $file);
- case ZipArchive::ER_INVAL:
- return sprintf("Invalid argument (%s)", $file);
- case ZipArchive::ER_MEMORY:
- return sprintf("Malloc failure (%s)", $file);
- case ZipArchive::ER_NOENT:
- return sprintf("No such zip file: '%s'", $file);
- case ZipArchive::ER_NOZIP:
- return sprintf("'%s' is not a zip archive.", $file);
- case ZipArchive::ER_OPEN:
- return sprintf("Can't open zip file: %s", $file);
- case ZipArchive::ER_READ:
- return sprintf("Zip read error (%s)", $file);
- case ZipArchive::ER_SEEK:
- return sprintf("Zip seek error (%s)", $file);
- case -1:
- return sprintf("'%s' is a corrupted zip archive (0 bytes), try again.", $file);
- default:
- return sprintf("'%s' is not a valid zip archive, got error code: %s", $file, $retval);
- }
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\EventDispatcher;
- class Event
- {
- protected $name;
- protected $args;
- protected $flags;
- private $propagationStopped = false;
- public function __construct(string $name, array $args = [], array $flags = [])
- {
- $this->name = $name;
- $this->args = $args;
- $this->flags = $flags;
- }
- public function getName(): string
- {
- return $this->name;
- }
- public function getArguments(): array
- {
- return $this->args;
- }
- public function getFlags(): array
- {
- return $this->flags;
- }
- public function isPropagationStopped(): bool
- {
- return $this->propagationStopped;
- }
- public function stopPropagation(): void
- {
- $this->propagationStopped = true;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\EventDispatcher;
- use Composer\DependencyResolver\Transaction;
- use Composer\Installer\InstallerEvent;
- use Composer\IO\IOInterface;
- use Composer\Composer;
- use Composer\PartialComposer;
- use Composer\Pcre\Preg;
- use Composer\Util\Platform;
- use Composer\DependencyResolver\Operation\OperationInterface;
- use Composer\Repository\RepositoryInterface;
- use Composer\Script;
- use Composer\Installer\PackageEvent;
- use Composer\Installer\BinaryInstaller;
- use Composer\Util\ProcessExecutor;
- use Composer\Script\Event as ScriptEvent;
- use Composer\Autoload\ClassLoader;
- use Symfony\Component\Process\PhpExecutableFinder;
- use Symfony\Component\Process\ExecutableFinder;
- class EventDispatcher
- {
- protected $composer;
- protected $io;
- protected $loader;
- protected $process;
- protected $listeners = [];
- protected $runScripts = true;
- private $eventStack;
- public function __construct(PartialComposer $composer, IOInterface $io, ?ProcessExecutor $process = null)
- {
- $this->composer = $composer;
- $this->io = $io;
- $this->process = $process ?? new ProcessExecutor($io);
- $this->eventStack = [];
- }
- public function setRunScripts(bool $runScripts = true): self
- {
- $this->runScripts = (bool) $runScripts;
- return $this;
- }
- public function dispatch(?string $eventName, ?Event $event = null): int
- {
- if (null === $event) {
- if (null === $eventName) {
- throw new \InvalidArgumentException('If no $event is passed in to '.__METHOD__.' you have to pass in an $eventName, got null.');
- }
- $event = new Event($eventName);
- }
- return $this->doDispatch($event);
- }
- public function dispatchScript(string $eventName, bool $devMode = false, array $additionalArgs = [], array $flags = []): int
- {
- assert($this->composer instanceof Composer, new \LogicException('This should only be reached with a fully loaded Composer'));
- return $this->doDispatch(new Script\Event($eventName, $this->composer, $this->io, $devMode, $additionalArgs, $flags));
- }
- public function dispatchPackageEvent(string $eventName, bool $devMode, RepositoryInterface $localRepo, array $operations, OperationInterface $operation): int
- {
- assert($this->composer instanceof Composer, new \LogicException('This should only be reached with a fully loaded Composer'));
- return $this->doDispatch(new PackageEvent($eventName, $this->composer, $this->io, $devMode, $localRepo, $operations, $operation));
- }
- public function dispatchInstallerEvent(string $eventName, bool $devMode, bool $executeOperations, Transaction $transaction): int
- {
- assert($this->composer instanceof Composer, new \LogicException('This should only be reached with a fully loaded Composer'));
- return $this->doDispatch(new InstallerEvent($eventName, $this->composer, $this->io, $devMode, $executeOperations, $transaction));
- }
- protected function doDispatch(Event $event)
- {
- if (Platform::getEnv('COMPOSER_DEBUG_EVENTS')) {
- $details = null;
- if ($event instanceof PackageEvent) {
- $details = (string) $event->getOperation();
- }
- $this->io->writeError('Dispatching <info>'.$event->getName().'</info>'.($details ? ' ('.$details.')' : '').' event');
- }
- $listeners = $this->getListeners($event);
- $this->pushEvent($event);
- try {
- $returnMax = 0;
- foreach ($listeners as $callable) {
- $return = 0;
- $this->ensureBinDirIsInPath();
- if (!is_string($callable)) {
- if (!is_callable($callable)) {
- $className = is_object($callable[0]) ? get_class($callable[0]) : $callable[0];
- throw new \RuntimeException('Subscriber '.$className.'::'.$callable[1].' for event '.$event->getName().' is not callable, make sure the function is defined and public');
- }
- if (is_array($callable) && (is_string($callable[0]) || is_object($callable[0])) && is_string($callable[1])) {
- $this->io->writeError(sprintf('> %s: %s', $event->getName(), (is_object($callable[0]) ? get_class($callable[0]) : $callable[0]).'->'.$callable[1]), true, IOInterface::VERBOSE);
- }
- $return = false === $callable($event) ? 1 : 0;
- } elseif ($this->isComposerScript($callable)) {
- $this->io->writeError(sprintf('> %s: %s', $event->getName(), $callable), true, IOInterface::VERBOSE);
- $script = explode(' ', substr($callable, 1));
- $scriptName = $script[0];
- unset($script[0]);
- $args = array_merge($script, $event->getArguments());
- $flags = $event->getFlags();
- if (strpos($callable, '@composer ') === 0) {
- $exec = $this->getPhpExecCommand() . ' ' . ProcessExecutor::escape(Platform::getEnv('COMPOSER_BINARY')) . ' ' . implode(' ', $args);
- if (0 !== ($exitCode = $this->executeTty($exec))) {
- $this->io->writeError(sprintf('<error>Script %s handling the %s event returned with error code '.$exitCode.'</error>', $callable, $event->getName()), true, IOInterface::QUIET);
- throw new ScriptExecutionException('Error Output: '.$this->process->getErrorOutput(), $exitCode);
- }
- } else {
- if (!$this->getListeners(new Event($scriptName))) {
- $this->io->writeError(sprintf('<warning>You made a reference to a non-existent script %s</warning>', $callable), true, IOInterface::QUIET);
- }
- try {
- $scriptEvent = new Script\Event($scriptName, $event->getComposer(), $event->getIO(), $event->isDevMode(), $args, $flags);
- $scriptEvent->setOriginatingEvent($event);
- $return = $this->dispatch($scriptName, $scriptEvent);
- } catch (ScriptExecutionException $e) {
- $this->io->writeError(sprintf('<error>Script %s was called via %s</error>', $callable, $event->getName()), true, IOInterface::QUIET);
- throw $e;
- }
- }
- } elseif ($this->isPhpScript($callable)) {
- $className = substr($callable, 0, strpos($callable, '::'));
- $methodName = substr($callable, strpos($callable, '::') + 2);
- if (!class_exists($className)) {
- $this->io->writeError('<warning>Class '.$className.' is not autoloadable, can not call '.$event->getName().' script</warning>', true, IOInterface::QUIET);
- continue;
- }
- if (!is_callable($callable)) {
- $this->io->writeError('<warning>Method '.$callable.' is not callable, can not call '.$event->getName().' script</warning>', true, IOInterface::QUIET);
- continue;
- }
- try {
- $return = false === $this->executeEventPhpScript($className, $methodName, $event) ? 1 : 0;
- } catch (\Exception $e) {
- $message = "Script %s handling the %s event terminated with an exception";
- $this->io->writeError('<error>'.sprintf($message, $callable, $event->getName()).'</error>', true, IOInterface::QUIET);
- throw $e;
- }
- } else {
- $args = implode(' ', array_map(['Composer\Util\ProcessExecutor', 'escape'], $event->getArguments()));
- if (strpos($callable, '@putenv ') === 0) {
- $exec = $callable;
- } else {
- $exec = $callable . ($args === '' ? '' : ' '.$args);
- }
- if ($this->io->isVerbose()) {
- $this->io->writeError(sprintf('> %s: %s', $event->getName(), $exec));
- } elseif ($event->getName() !== '__exec_command') {
- $this->io->writeError(sprintf('> %s', $exec));
- }
- $possibleLocalBinaries = $this->composer->getPackage()->getBinaries();
- if ($possibleLocalBinaries) {
- foreach ($possibleLocalBinaries as $localExec) {
- if (Preg::isMatch('{\b'.preg_quote($callable).'$}', $localExec)) {
- $caller = BinaryInstaller::determineBinaryCaller($localExec);
- $exec = Preg::replace('{^'.preg_quote($callable).'}', $caller . ' ' . $localExec, $exec);
- break;
- }
- }
- }
- if (strpos($exec, '@putenv ') === 0) {
- if (false === strpos($exec, '=')) {
- Platform::clearEnv(substr($exec, 8));
- } else {
- [$var, $value] = explode('=', substr($exec, 8), 2);
- Platform::putEnv($var, $value);
- }
- continue;
- }
- if (strpos($exec, '@php ') === 0) {
- $pathAndArgs = substr($exec, 5);
- if (Platform::isWindows()) {
- $pathAndArgs = Preg::replaceCallback('{^\S+}', static function ($path) {
- return str_replace('/', '\\', $path[0]);
- }, $pathAndArgs);
- }
- $matched = Preg::isMatch('{^[^\'"\s/\\\\]+}', $pathAndArgs, $match);
- if ($matched && !file_exists($match[0])) {
- $finder = new ExecutableFinder;
- if ($pathToExec = $finder->find($match[0])) {
- $pathAndArgs = $pathToExec . substr($pathAndArgs, strlen($match[0]));
- }
- }
- $exec = $this->getPhpExecCommand() . ' ' . $pathAndArgs;
- } else {
- $finder = new PhpExecutableFinder();
- $phpPath = $finder->find(false);
- if ($phpPath) {
- Platform::putEnv('PHP_BINARY', $phpPath);
- }
- if (Platform::isWindows()) {
- $exec = Preg::replaceCallback('{^\S+}', static function ($path) {
- return str_replace('/', '\\', $path[0]);
- }, $exec);
- }
- }
- if (strpos($exec, 'composer ') === 0) {
- $exec = $this->getPhpExecCommand() . ' ' . ProcessExecutor::escape(Platform::getEnv('COMPOSER_BINARY')) . substr($exec, 8);
- }
- if (0 !== ($exitCode = $this->executeTty($exec))) {
- $this->io->writeError(sprintf('<error>Script %s handling the %s event returned with error code '.$exitCode.'</error>', $callable, $event->getName()), true, IOInterface::QUIET);
- throw new ScriptExecutionException('Error Output: '.$this->process->getErrorOutput(), $exitCode);
- }
- }
- $returnMax = max($returnMax, $return);
- if ($event->isPropagationStopped()) {
- break;
- }
- }
- } finally {
- $this->popEvent();
- }
- return $returnMax;
- }
- protected function executeTty(string $exec): int
- {
- if ($this->io->isInteractive()) {
- return $this->process->executeTty($exec);
- }
- return $this->process->execute($exec);
- }
- protected function getPhpExecCommand(): string
- {
- $finder = new PhpExecutableFinder();
- $phpPath = $finder->find(false);
- if (!$phpPath) {
- throw new \RuntimeException('Failed to locate PHP binary to execute '.$phpPath);
- }
- $phpArgs = $finder->findArguments();
- $phpArgs = $phpArgs ? ' ' . implode(' ', $phpArgs) : '';
- $allowUrlFOpenFlag = ' -d allow_url_fopen=' . ProcessExecutor::escape(ini_get('allow_url_fopen'));
- $disableFunctionsFlag = ' -d disable_functions=' . ProcessExecutor::escape(ini_get('disable_functions'));
- $memoryLimitFlag = ' -d memory_limit=' . ProcessExecutor::escape(ini_get('memory_limit'));
- return ProcessExecutor::escape($phpPath) . $phpArgs . $allowUrlFOpenFlag . $disableFunctionsFlag . $memoryLimitFlag;
- }
- protected function executeEventPhpScript(string $className, string $methodName, Event $event)
- {
- if ($this->io->isVerbose()) {
- $this->io->writeError(sprintf('> %s: %s::%s', $event->getName(), $className, $methodName));
- } else {
- $this->io->writeError(sprintf('> %s::%s', $className, $methodName));
- }
- return $className::$methodName($event);
- }
- public function addListener(string $eventName, $listener, int $priority = 0): void
- {
- $this->listeners[$eventName][$priority][] = $listener;
- }
- public function removeListener($listener): void
- {
- foreach ($this->listeners as $eventName => $priorities) {
- foreach ($priorities as $priority => $listeners) {
- foreach ($listeners as $index => $candidate) {
- if ($listener === $candidate || (is_array($candidate) && is_object($listener) && $candidate[0] === $listener)) {
- unset($this->listeners[$eventName][$priority][$index]);
- }
- }
- }
- }
- }
- public function addSubscriber(EventSubscriberInterface $subscriber): void
- {
- foreach ($subscriber->getSubscribedEvents() as $eventName => $params) {
- if (is_string($params)) {
- $this->addListener($eventName, [$subscriber, $params]);
- } elseif (is_string($params[0])) {
- $this->addListener($eventName, [$subscriber, $params[0]], $params[1] ?? 0);
- } else {
- foreach ($params as $listener) {
- $this->addListener($eventName, [$subscriber, $listener[0]], $listener[1] ?? 0);
- }
- }
- }
- }
- protected function getListeners(Event $event): array
- {
- $scriptListeners = $this->runScripts ? $this->getScriptListeners($event) : [];
- if (!isset($this->listeners[$event->getName()][0])) {
- $this->listeners[$event->getName()][0] = [];
- }
- krsort($this->listeners[$event->getName()]);
- $listeners = $this->listeners;
- $listeners[$event->getName()][0] = array_merge($listeners[$event->getName()][0], $scriptListeners);
- return array_merge(...$listeners[$event->getName()]);
- }
- public function hasEventListeners(Event $event): bool
- {
- $listeners = $this->getListeners($event);
- return count($listeners) > 0;
- }
- protected function getScriptListeners(Event $event): array
- {
- $package = $this->composer->getPackage();
- $scripts = $package->getScripts();
- if (empty($scripts[$event->getName()])) {
- return [];
- }
- assert($this->composer instanceof Composer, new \LogicException('This should only be reached with a fully loaded Composer'));
- if ($this->loader) {
- $this->loader->unregister();
- }
- $generator = $this->composer->getAutoloadGenerator();
- if ($event instanceof ScriptEvent) {
- $generator->setDevMode($event->isDevMode());
- }
- $packages = $this->composer->getRepositoryManager()->getLocalRepository()->getCanonicalPackages();
- $packageMap = $generator->buildPackageMap($this->composer->getInstallationManager(), $package, $packages);
- $map = $generator->parseAutoloads($packageMap, $package);
- $this->loader = $generator->createLoader($map, $this->composer->getConfig()->get('vendor-dir'));
- $this->loader->register(false);
- return $scripts[$event->getName()];
- }
- protected function isPhpScript(string $callable): bool
- {
- return false === strpos($callable, ' ') && false !== strpos($callable, '::');
- }
- protected function isComposerScript(string $callable): bool
- {
- return strpos($callable, '@') === 0 && strpos($callable, '@php ') !== 0 && strpos($callable, '@putenv ') !== 0;
- }
- protected function pushEvent(Event $event): int
- {
- $eventName = $event->getName();
- if (in_array($eventName, $this->eventStack)) {
- throw new \RuntimeException(sprintf("Circular call to script handler '%s' detected", $eventName));
- }
- return array_push($this->eventStack, $eventName);
- }
- protected function popEvent(): ?string
- {
- return array_pop($this->eventStack);
- }
- private function ensureBinDirIsInPath(): void
- {
- $pathEnv = 'PATH';
- if (!isset($_SERVER[$pathEnv]) && isset($_SERVER['Path'])) {
- $pathEnv = 'Path';
- }
- $binDir = $this->composer->getConfig()->get('bin-dir');
- if (is_dir($binDir)) {
- $binDir = realpath($binDir);
- $pathValue = (string) Platform::getEnv($pathEnv);
- if (!Preg::isMatch('{(^|'.PATH_SEPARATOR.')'.preg_quote($binDir).'($|'.PATH_SEPARATOR.')}', $pathValue)) {
- Platform::putEnv($pathEnv, $binDir.PATH_SEPARATOR.$pathValue);
- }
- }
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\EventDispatcher;
- interface EventSubscriberInterface
- {
- public static function getSubscribedEvents();
- }
- <?php declare(strict_types=1);
- namespace Composer\EventDispatcher;
- class ScriptExecutionException extends \RuntimeException
- {
- }
- <?php declare(strict_types=1);
- namespace Composer\Exception;
- class IrrecoverableDownloadException extends \RuntimeException
- {
- }
- <?php declare(strict_types=1);
- namespace Composer\Exception;
- class NoSslException extends \RuntimeException
- {
- }
- <?php declare(strict_types=1);
- namespace Composer;
- use Composer\Config\JsonConfigSource;
- use Composer\Json\JsonFile;
- use Composer\IO\IOInterface;
- use Composer\Package\Archiver;
- use Composer\Package\Version\VersionGuesser;
- use Composer\Package\RootPackageInterface;
- use Composer\Repository\RepositoryManager;
- use Composer\Repository\RepositoryFactory;
- use Composer\Util\Filesystem;
- use Composer\Util\Platform;
- use Composer\Util\ProcessExecutor;
- use Composer\Util\HttpDownloader;
- use Composer\Util\Loop;
- use Composer\Util\Silencer;
- use Composer\Plugin\PluginEvents;
- use Composer\EventDispatcher\Event;
- use Phar;
- use Symfony\Component\Console\Formatter\OutputFormatter;
- use Symfony\Component\Console\Formatter\OutputFormatterStyle;
- use Symfony\Component\Console\Output\ConsoleOutput;
- use Composer\EventDispatcher\EventDispatcher;
- use Composer\Autoload\AutoloadGenerator;
- use Composer\Package\Version\VersionParser;
- use Composer\Downloader\TransportException;
- use Composer\Json\JsonValidationException;
- use Composer\Repository\InstalledRepositoryInterface;
- use UnexpectedValueException;
- use ZipArchive;
- class Factory
- {
- protected static function getHomeDir(): string
- {
- $home = Platform::getEnv('COMPOSER_HOME');
- if ($home) {
- return $home;
- }
- if (Platform::isWindows()) {
- if (!Platform::getEnv('APPDATA')) {
- throw new \RuntimeException('The APPDATA or COMPOSER_HOME environment variable must be set for composer to run correctly');
- }
- return rtrim(strtr(Platform::getEnv('APPDATA'), '\\', '/'), '/') . '/Composer';
- }
- $userDir = self::getUserDir();
- $dirs = [];
- if (self::useXdg()) {
- $xdgConfig = Platform::getEnv('XDG_CONFIG_HOME');
- if (!$xdgConfig) {
- $xdgConfig = $userDir . '/.config';
- }
- $dirs[] = $xdgConfig . '/composer';
- }
- $dirs[] = $userDir . '/.composer';
- foreach ($dirs as $dir) {
- if (Silencer::call('is_dir', $dir)) {
- return $dir;
- }
- }
- return $dirs[0];
- }
- protected static function getCacheDir(string $home): string
- {
- $cacheDir = Platform::getEnv('COMPOSER_CACHE_DIR');
- if ($cacheDir) {
- return $cacheDir;
- }
- $homeEnv = Platform::getEnv('COMPOSER_HOME');
- if ($homeEnv) {
- return $homeEnv . '/cache';
- }
- if (Platform::isWindows()) {
- if ($cacheDir = Platform::getEnv('LOCALAPPDATA')) {
- $cacheDir .= '/Composer';
- } else {
- $cacheDir = $home . '/cache';
- }
- return rtrim(strtr($cacheDir, '\\', '/'), '/');
- }
- $userDir = self::getUserDir();
- if (PHP_OS === 'Darwin') {
- if (is_dir($home . '/cache') && !is_dir($userDir . '/Library/Caches/composer')) {
- Silencer::call('rename', $home . '/cache', $userDir . '/Library/Caches/composer');
- }
- return $userDir . '/Library/Caches/composer';
- }
- if ($home === $userDir . '/.composer' && is_dir($home . '/cache')) {
- return $home . '/cache';
- }
- if (self::useXdg()) {
- $xdgCache = Platform::getEnv('XDG_CACHE_HOME') ?: $userDir . '/.cache';
- return $xdgCache . '/composer';
- }
- return $home . '/cache';
- }
- protected static function getDataDir(string $home): string
- {
- $homeEnv = Platform::getEnv('COMPOSER_HOME');
- if ($homeEnv) {
- return $homeEnv;
- }
- if (Platform::isWindows()) {
- return strtr($home, '\\', '/');
- }
- $userDir = self::getUserDir();
- if ($home !== $userDir . '/.composer' && self::useXdg()) {
- $xdgData = Platform::getEnv('XDG_DATA_HOME') ?: $userDir . '/.local/share';
- return $xdgData . '/composer';
- }
- return $home;
- }
- public static function createConfig(?IOInterface $io = null, ?string $cwd = null): Config
- {
- $cwd = $cwd ?? Platform::getCwd(true);
- $config = new Config(true, $cwd);
- $home = self::getHomeDir();
- $config->merge([
- 'config' => [
- 'home' => $home,
- 'cache-dir' => self::getCacheDir($home),
- 'data-dir' => self::getDataDir($home),
- ],
- ], Config::SOURCE_DEFAULT);
- $file = new JsonFile($config->get('home').'/config.json');
- if ($file->exists()) {
- if ($io instanceof IOInterface) {
- $io->writeError('Loading config file ' . $file->getPath(), true, IOInterface::DEBUG);
- }
- self::validateJsonSchema($io, $file);
- $config->merge($file->read(), $file->getPath());
- }
- $config->setConfigSource(new JsonConfigSource($file));
- $htaccessProtect = $config->get('htaccess-protect');
- if ($htaccessProtect) {
- $dirs = [$config->get('home'), $config->get('cache-dir'), $config->get('data-dir')];
- foreach ($dirs as $dir) {
- if (!file_exists($dir . '/.htaccess')) {
- if (!is_dir($dir)) {
- Silencer::call('mkdir', $dir, 0777, true);
- }
- Silencer::call('file_put_contents', $dir . '/.htaccess', 'Deny from all');
- }
- }
- }
- $file = new JsonFile($config->get('home').'/auth.json');
- if ($file->exists()) {
- if ($io instanceof IOInterface) {
- $io->writeError('Loading config file ' . $file->getPath(), true, IOInterface::DEBUG);
- }
- self::validateJsonSchema($io, $file, JsonFile::AUTH_SCHEMA);
- $config->merge(['config' => $file->read()], $file->getPath());
- }
- $config->setAuthConfigSource(new JsonConfigSource($file, true));
- if ($composerAuthEnv = Platform::getEnv('COMPOSER_AUTH')) {
- $authData = json_decode($composerAuthEnv);
- if (null === $authData) {
- if ($io instanceof IOInterface) {
- $io->writeError('<error>COMPOSER_AUTH environment variable is malformed, should be a valid JSON object</error>');
- }
- } else {
- if ($io instanceof IOInterface) {
- $io->writeError('Loading auth config from COMPOSER_AUTH', true, IOInterface::DEBUG);
- }
- self::validateJsonSchema($io, $authData, JsonFile::AUTH_SCHEMA, 'COMPOSER_AUTH');
- $authData = json_decode($composerAuthEnv, true);
- if (null !== $authData) {
- $config->merge(['config' => $authData], 'COMPOSER_AUTH');
- }
- }
- }
- return $config;
- }
- public static function getComposerFile(): string
- {
- return trim((string) Platform::getEnv('COMPOSER')) ?: './composer.json';
- }
- public static function getLockFile(string $composerFile): string
- {
- return "json" === pathinfo($composerFile, PATHINFO_EXTENSION)
- ? substr($composerFile, 0, -4).'lock'
- : $composerFile . '.lock';
- }
- public static function createAdditionalStyles(): array
- {
- return [
- 'highlight' => new OutputFormatterStyle('red'),
- 'warning' => new OutputFormatterStyle('black', 'yellow'),
- ];
- }
- public static function createOutput(): ConsoleOutput
- {
- $styles = self::createAdditionalStyles();
- $formatter = new OutputFormatter(false, $styles);
- return new ConsoleOutput(ConsoleOutput::VERBOSITY_NORMAL, null, $formatter);
- }
- public function createComposer(IOInterface $io, $localConfig = null, $disablePlugins = false, ?string $cwd = null, bool $fullLoad = true, bool $disableScripts = false)
- {
- if (is_string($localConfig) && is_file($localConfig) && null === $cwd) {
- $cwd = dirname($localConfig);
- }
- $cwd = $cwd ?? Platform::getCwd(true);
- if (null === $localConfig) {
- $localConfig = static::getComposerFile();
- }
- $localConfigSource = Config::SOURCE_UNKNOWN;
- if (is_string($localConfig)) {
- $composerFile = $localConfig;
- $file = new JsonFile($localConfig, null, $io);
- if (!$file->exists()) {
- if ($localConfig === './composer.json' || $localConfig === 'composer.json') {
- $message = 'Composer could not find a composer.json file in '.$cwd;
- } else {
- $message = 'Composer could not find the config file: '.$localConfig;
- }
- $instructions = $fullLoad ? 'To initialize a project, please create a composer.json file. See https://getcomposer.org/basic-usage' : '';
- throw new \InvalidArgumentException($message.PHP_EOL.$instructions);
- }
- if (!Platform::isInputCompletionProcess()) {
- try {
- $file->validateSchema(JsonFile::LAX_SCHEMA);
- } catch (JsonValidationException $e) {
- $errors = ' - ' . implode(PHP_EOL . ' - ', $e->getErrors());
- $message = $e->getMessage() . ':' . PHP_EOL . $errors;
- throw new JsonValidationException($message);
- }
- }
- $localConfig = $file->read();
- $localConfigSource = $file->getPath();
- }
- $config = static::createConfig($io, $cwd);
- $config->merge($localConfig, $localConfigSource);
- if (isset($composerFile)) {
- $io->writeError('Loading config file ' . $composerFile .' ('.realpath($composerFile).')', true, IOInterface::DEBUG);
- $config->setConfigSource(new JsonConfigSource(new JsonFile(realpath($composerFile), null, $io)));
- $localAuthFile = new JsonFile(dirname(realpath($composerFile)) . '/auth.json', null, $io);
- if ($localAuthFile->exists()) {
- $io->writeError('Loading config file ' . $localAuthFile->getPath(), true, IOInterface::DEBUG);
- self::validateJsonSchema($io, $localAuthFile, JsonFile::AUTH_SCHEMA);
- $config->merge(['config' => $localAuthFile->read()], $localAuthFile->getPath());
- $config->setAuthConfigSource(new JsonConfigSource($localAuthFile, true));
- }
- }
- $vendorDir = $config->get('vendor-dir');
- $composer = $fullLoad ? new Composer() : new PartialComposer();
- $composer->setConfig($config);
- if ($fullLoad) {
- $io->loadConfiguration($config);
- if (!class_exists('Composer\InstalledVersions', false) && file_exists($installedVersionsPath = $config->get('vendor-dir').'/composer/InstalledVersions.php')) {
- include $installedVersionsPath;
- }
- }
- $httpDownloader = self::createHttpDownloader($io, $config);
- $process = new ProcessExecutor($io);
- $loop = new Loop($httpDownloader, $process);
- $composer->setLoop($loop);
- $dispatcher = new EventDispatcher($composer, $io, $process);
- $dispatcher->setRunScripts(!$disableScripts);
- $composer->setEventDispatcher($dispatcher);
- $rm = RepositoryFactory::manager($io, $config, $httpDownloader, $dispatcher, $process);
- $composer->setRepositoryManager($rm);
- if (!$fullLoad && !isset($localConfig['version'])) {
- $localConfig['version'] = '1.0.0';
- }
- $parser = new VersionParser;
- $guesser = new VersionGuesser($config, $process, $parser);
- $loader = $this->loadRootPackage($rm, $config, $parser, $guesser, $io);
- $package = $loader->load($localConfig, 'Composer\Package\RootPackage', $cwd);
- $composer->setPackage($package);
- $this->addLocalRepository($io, $rm, $vendorDir, $package, $process);
- $im = $this->createInstallationManager($loop, $io, $dispatcher);
- $composer->setInstallationManager($im);
- if ($composer instanceof Composer) {
- $dm = $this->createDownloadManager($io, $config, $httpDownloader, $process, $dispatcher);
- $composer->setDownloadManager($dm);
- $generator = new AutoloadGenerator($dispatcher, $io);
- $composer->setAutoloadGenerator($generator);
- $am = $this->createArchiveManager($config, $dm, $loop);
- $composer->setArchiveManager($am);
- }
- $this->createDefaultInstallers($im, $composer, $io, $process);
- if ($composer instanceof Composer && isset($composerFile)) {
- $lockFile = self::getLockFile($composerFile);
- if (!$config->get('lock') && file_exists($lockFile)) {
- $io->writeError('<warning>'.$lockFile.' is present but ignored as the "lock" config option is disabled.</warning>');
- }
- $locker = new Package\Locker($io, new JsonFile($config->get('lock') ? $lockFile : Platform::getDevNull(), null, $io), $im, file_get_contents($composerFile), $process);
- $composer->setLocker($locker);
- } elseif ($composer instanceof Composer) {
- $locker = new Package\Locker($io, new JsonFile(Platform::getDevNull(), null, $io), $im, JsonFile::encode($localConfig), $process);
- $composer->setLocker($locker);
- }
- if ($composer instanceof Composer) {
- $globalComposer = null;
- if (realpath($config->get('home')) !== $cwd) {
- $globalComposer = $this->createGlobalComposer($io, $config, $disablePlugins, $disableScripts);
- }
- $pm = $this->createPluginManager($io, $composer, $globalComposer, $disablePlugins);
- $composer->setPluginManager($pm);
- if (realpath($config->get('home')) === $cwd) {
- $pm->setRunningInGlobalDir(true);
- }
- $pm->loadInstalledPlugins();
- }
- if ($fullLoad) {
- $initEvent = new Event(PluginEvents::INIT);
- $composer->getEventDispatcher()->dispatch($initEvent->getName(), $initEvent);
- $this->purgePackages($rm->getLocalRepository(), $im);
- }
- return $composer;
- }
- public static function createGlobal(IOInterface $io, bool $disablePlugins = false, bool $disableScripts = false): ?Composer
- {
- $factory = new static();
- return $factory->createGlobalComposer($io, static::createConfig($io), $disablePlugins, $disableScripts, true);
- }
- protected function addLocalRepository(IOInterface $io, RepositoryManager $rm, string $vendorDir, RootPackageInterface $rootPackage, ?ProcessExecutor $process = null): void
- {
- $fs = null;
- if ($process) {
- $fs = new Filesystem($process);
- }
- $rm->setLocalRepository(new Repository\InstalledFilesystemRepository(new JsonFile($vendorDir.'/composer/installed.json', null, $io), true, $rootPackage, $fs));
- }
- protected function createGlobalComposer(IOInterface $io, Config $config, $disablePlugins, bool $disableScripts, bool $fullLoad = false): ?PartialComposer
- {
- $disablePlugins = $disablePlugins === 'global' || $disablePlugins === true;
- $composer = null;
- try {
- $composer = $this->createComposer($io, $config->get('home') . '/composer.json', $disablePlugins, $config->get('home'), $fullLoad, $disableScripts);
- } catch (\Exception $e) {
- $io->writeError('Failed to initialize global composer: '.$e->getMessage(), true, IOInterface::DEBUG);
- }
- return $composer;
- }
- public function createDownloadManager(IOInterface $io, Config $config, HttpDownloader $httpDownloader, ProcessExecutor $process, ?EventDispatcher $eventDispatcher = null): Downloader\DownloadManager
- {
- $cache = null;
- if ($config->get('cache-files-ttl') > 0) {
- $cache = new Cache($io, $config->get('cache-files-dir'), 'a-z0-9_./');
- $cache->setReadOnly($config->get('cache-read-only'));
- }
- $fs = new Filesystem($process);
- $dm = new Downloader\DownloadManager($io, false, $fs);
- switch ($preferred = $config->get('preferred-install')) {
- case 'dist':
- $dm->setPreferDist(true);
- break;
- case 'source':
- $dm->setPreferSource(true);
- break;
- case 'auto':
- default:
- break;
- }
- if (is_array($preferred)) {
- $dm->setPreferences($preferred);
- }
- $dm->setDownloader('git', new Downloader\GitDownloader($io, $config, $process, $fs));
- $dm->setDownloader('svn', new Downloader\SvnDownloader($io, $config, $process, $fs));
- $dm->setDownloader('fossil', new Downloader\FossilDownloader($io, $config, $process, $fs));
- $dm->setDownloader('hg', new Downloader\HgDownloader($io, $config, $process, $fs));
- $dm->setDownloader('perforce', new Downloader\PerforceDownloader($io, $config, $process, $fs));
- $dm->setDownloader('zip', new Downloader\ZipDownloader($io, $config, $httpDownloader, $eventDispatcher, $cache, $fs, $process));
- $dm->setDownloader('rar', new Downloader\RarDownloader($io, $config, $httpDownloader, $eventDispatcher, $cache, $fs, $process));
- $dm->setDownloader('tar', new Downloader\TarDownloader($io, $config, $httpDownloader, $eventDispatcher, $cache, $fs, $process));
- $dm->setDownloader('gzip', new Downloader\GzipDownloader($io, $config, $httpDownloader, $eventDispatcher, $cache, $fs, $process));
- $dm->setDownloader('xz', new Downloader\XzDownloader($io, $config, $httpDownloader, $eventDispatcher, $cache, $fs, $process));
- $dm->setDownloader('phar', new Downloader\PharDownloader($io, $config, $httpDownloader, $eventDispatcher, $cache, $fs, $process));
- $dm->setDownloader('file', new Downloader\FileDownloader($io, $config, $httpDownloader, $eventDispatcher, $cache, $fs, $process));
- $dm->setDownloader('path', new Downloader\PathDownloader($io, $config, $httpDownloader, $eventDispatcher, $cache, $fs, $process));
- return $dm;
- }
- public function createArchiveManager(Config $config, Downloader\DownloadManager $dm, Loop $loop)
- {
- $am = new Archiver\ArchiveManager($dm, $loop);
- if (class_exists(ZipArchive::class)) {
- $am->addArchiver(new Archiver\ZipArchiver);
- }
- if (class_exists(Phar::class)) {
- $am->addArchiver(new Archiver\PharArchiver);
- }
- return $am;
- }
- protected function createPluginManager(IOInterface $io, Composer $composer, ?PartialComposer $globalComposer = null, $disablePlugins = false): Plugin\PluginManager
- {
- return new Plugin\PluginManager($io, $composer, $globalComposer, $disablePlugins);
- }
- public function createInstallationManager(Loop $loop, IOInterface $io, ?EventDispatcher $eventDispatcher = null): Installer\InstallationManager
- {
- return new Installer\InstallationManager($loop, $io, $eventDispatcher);
- }
- protected function createDefaultInstallers(Installer\InstallationManager $im, PartialComposer $composer, IOInterface $io, ?ProcessExecutor $process = null): void
- {
- $fs = new Filesystem($process);
- $binaryInstaller = new Installer\BinaryInstaller($io, rtrim($composer->getConfig()->get('bin-dir'), '/'), $composer->getConfig()->get('bin-compat'), $fs, rtrim($composer->getConfig()->get('vendor-dir'), '/'));
- $im->addInstaller(new Installer\LibraryInstaller($io, $composer, null, $fs, $binaryInstaller));
- $im->addInstaller(new Installer\PluginInstaller($io, $composer, $fs, $binaryInstaller));
- $im->addInstaller(new Installer\MetapackageInstaller($io));
- }
- protected function purgePackages(InstalledRepositoryInterface $repo, Installer\InstallationManager $im): void
- {
- foreach ($repo->getPackages() as $package) {
- if (!$im->isPackageInstalled($repo, $package)) {
- $repo->removePackage($package);
- }
- }
- }
- protected function loadRootPackage(RepositoryManager $rm, Config $config, VersionParser $parser, VersionGuesser $guesser, IOInterface $io): Package\Loader\RootPackageLoader
- {
- return new Package\Loader\RootPackageLoader($rm, $config, $parser, $guesser, $io);
- }
- public static function create(IOInterface $io, $config = null, $disablePlugins = false, bool $disableScripts = false): Composer
- {
- $factory = new static();
- if ($config !== null && $config !== self::getComposerFile() && $disablePlugins === false) {
- $disablePlugins = 'local';
- }
- return $factory->createComposer($io, $config, $disablePlugins, null, true, $disableScripts);
- }
- public static function createHttpDownloader(IOInterface $io, Config $config, array $options = []): HttpDownloader
- {
- static $warned = false;
- $disableTls = false;
- if (isset($_SERVER['argv']) && in_array('disable-tls', $_SERVER['argv']) && (in_array('conf', $_SERVER['argv']) || in_array('config', $_SERVER['argv']))) {
- $warned = true;
- $disableTls = !extension_loaded('openssl');
- } elseif ($config->get('disable-tls') === true) {
- if (!$warned) {
- $io->writeError('<warning>You are running Composer with SSL/TLS protection disabled.</warning>');
- }
- $warned = true;
- $disableTls = true;
- } elseif (!extension_loaded('openssl')) {
- throw new Exception\NoSslException('The openssl extension is required for SSL/TLS protection but is not available. '
- . '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.');
- }
- $httpDownloaderOptions = [];
- if ($disableTls === false) {
- if ('' !== $config->get('cafile')) {
- $httpDownloaderOptions['ssl']['cafile'] = $config->get('cafile');
- }
- if ('' !== $config->get('capath')) {
- $httpDownloaderOptions['ssl']['capath'] = $config->get('capath');
- }
- $httpDownloaderOptions = array_replace_recursive($httpDownloaderOptions, $options);
- }
- try {
- $httpDownloader = new HttpDownloader($io, $config, $httpDownloaderOptions, $disableTls);
- } catch (TransportException $e) {
- if (false !== strpos($e->getMessage(), 'cafile')) {
- $io->write('<error>Unable to locate a valid CA certificate file. You must set a valid \'cafile\' option.</error>');
- $io->write('<error>A valid CA certificate file is required for SSL/TLS protection.</error>');
- $io->write('<error>You can disable this error, at your own risk, by setting the \'disable-tls\' option to true.</error>');
- }
- throw $e;
- }
- return $httpDownloader;
- }
- private static function useXdg(): bool
- {
- foreach (array_keys($_SERVER) as $key) {
- if (strpos($key, 'XDG_') === 0) {
- return true;
- }
- }
- if (Silencer::call('is_dir', '/etc/xdg')) {
- return true;
- }
- return false;
- }
- private static function getUserDir(): string
- {
- $home = Platform::getEnv('HOME');
- if (!$home) {
- throw new \RuntimeException('The HOME or COMPOSER_HOME environment variable must be set for composer to run correctly');
- }
- return rtrim(strtr($home, '\\', '/'), '/');
- }
- private static function validateJsonSchema(?IOInterface $io, $fileOrData, int $schema = JsonFile::LAX_SCHEMA, ?string $source = null): void
- {
- if (Platform::isInputCompletionProcess()) {
- return;
- }
- try {
- if ($fileOrData instanceof JsonFile) {
- $fileOrData->validateSchema($schema);
- } else {
- if (null === $source) {
- throw new \InvalidArgumentException('$source is required to be provided if $fileOrData is arbitrary data');
- }
- JsonFile::validateJsonSchema($source, $fileOrData, $schema);
- }
- } catch (JsonValidationException $e) {
- $msg = $e->getMessage().', this may result in errors and should be resolved:'.PHP_EOL.' - '.implode(PHP_EOL.' - ', $e->getErrors());
- if ($io instanceof IOInterface) {
- $io->writeError('<warning>'.$msg.'</>');
- } else {
- throw new UnexpectedValueException($msg);
- }
- }
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Filter\PlatformRequirementFilter;
- use Composer\Repository\PlatformRepository;
- final class IgnoreAllPlatformRequirementFilter implements PlatformRequirementFilterInterface
- {
- public function isIgnored(string $req): bool
- {
- return PlatformRepository::isPlatformPackage($req);
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Filter\PlatformRequirementFilter;
- use Composer\Package\BasePackage;
- use Composer\Pcre\Preg;
- use Composer\Repository\PlatformRepository;
- use Composer\Semver\Constraint\Constraint;
- use Composer\Semver\Constraint\ConstraintInterface;
- use Composer\Semver\Constraint\MatchAllConstraint;
- use Composer\Semver\Constraint\MultiConstraint;
- use Composer\Semver\Interval;
- use Composer\Semver\Intervals;
- final class IgnoreListPlatformRequirementFilter implements PlatformRequirementFilterInterface
- {
- private $ignoreRegex;
- private $ignoreUpperBoundRegex;
- public function __construct(array $reqList)
- {
- $ignoreAll = $ignoreUpperBound = [];
- foreach ($reqList as $req) {
- if (substr($req, -1) === '+') {
- $ignoreUpperBound[] = substr($req, 0, -1);
- } else {
- $ignoreAll[] = $req;
- }
- }
- $this->ignoreRegex = BasePackage::packageNamesToRegexp($ignoreAll);
- $this->ignoreUpperBoundRegex = BasePackage::packageNamesToRegexp($ignoreUpperBound);
- }
- public function isIgnored(string $req): bool
- {
- if (!PlatformRepository::isPlatformPackage($req)) {
- return false;
- }
- return Preg::isMatch($this->ignoreRegex, $req);
- }
- public function filterConstraint(string $req, ConstraintInterface $constraint): ConstraintInterface
- {
- if (!PlatformRepository::isPlatformPackage($req)) {
- return $constraint;
- }
- if (!Preg::isMatch($this->ignoreUpperBoundRegex, $req)) {
- return $constraint;
- }
- if (Preg::isMatch($this->ignoreRegex, $req)) {
- return new MatchAllConstraint;
- }
- $intervals = Intervals::get($constraint);
- $last = end($intervals['numeric']);
- if ($last !== false && (string) $last->getEnd() !== (string) Interval::untilPositiveInfinity()) {
- $constraint = new MultiConstraint([$constraint, new Constraint('>=', $last->getEnd()->getVersion())], false);
- }
- return $constraint;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Filter\PlatformRequirementFilter;
- final class IgnoreNothingPlatformRequirementFilter implements PlatformRequirementFilterInterface
- {
- public function isIgnored(string $req): bool
- {
- return false;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Filter\PlatformRequirementFilter;
- final class PlatformRequirementFilterFactory
- {
- public static function fromBoolOrList($boolOrList): PlatformRequirementFilterInterface
- {
- if (is_bool($boolOrList)) {
- return $boolOrList ? self::ignoreAll() : self::ignoreNothing();
- }
- if (is_array($boolOrList)) {
- return new IgnoreListPlatformRequirementFilter($boolOrList);
- }
- throw new \InvalidArgumentException(
- sprintf(
- 'PlatformRequirementFilter: Unknown $boolOrList parameter %s. Please report at https://github.com/composer/composer/issues/new.',
- gettype($boolOrList)
- )
- );
- }
- public static function ignoreAll(): PlatformRequirementFilterInterface
- {
- return new IgnoreAllPlatformRequirementFilter();
- }
- public static function ignoreNothing(): PlatformRequirementFilterInterface
- {
- return new IgnoreNothingPlatformRequirementFilter();
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Filter\PlatformRequirementFilter;
- interface PlatformRequirementFilterInterface
- {
- public function isIgnored(string $req): bool;
- }
- <?php declare(strict_types=1);
- namespace Composer\IO;
- use Composer\Config;
- use Composer\Pcre\Preg;
- use Composer\Util\ProcessExecutor;
- use Psr\Log\LogLevel;
- abstract class BaseIO implements IOInterface
- {
- protected $authentications = [];
- public function getAuthentications()
- {
- return $this->authentications;
- }
- public function resetAuthentications()
- {
- $this->authentications = [];
- }
- public function hasAuthentication($repositoryName)
- {
- return isset($this->authentications[$repositoryName]);
- }
- public function getAuthentication($repositoryName)
- {
- if (isset($this->authentications[$repositoryName])) {
- return $this->authentications[$repositoryName];
- }
- return ['username' => null, 'password' => null];
- }
- public function setAuthentication($repositoryName, $username, $password = null)
- {
- $this->authentications[$repositoryName] = ['username' => $username, 'password' => $password];
- }
- public function writeRaw($messages, bool $newline = true, int $verbosity = self::NORMAL)
- {
- $this->write($messages, $newline, $verbosity);
- }
- public function writeErrorRaw($messages, bool $newline = true, int $verbosity = self::NORMAL)
- {
- $this->writeError($messages, $newline, $verbosity);
- }
- protected function checkAndSetAuthentication(string $repositoryName, string $username, ?string $password = null)
- {
- if ($this->hasAuthentication($repositoryName)) {
- $auth = $this->getAuthentication($repositoryName);
- if ($auth['username'] === $username && $auth['password'] === $password) {
- return;
- }
- $this->writeError(
- sprintf(
- "<warning>Warning: You should avoid overwriting already defined auth settings for %s.</warning>",
- $repositoryName
- )
- );
- }
- $this->setAuthentication($repositoryName, $username, $password);
- }
- public function loadConfiguration(Config $config)
- {
- $bitbucketOauth = $config->get('bitbucket-oauth');
- $githubOauth = $config->get('github-oauth');
- $gitlabOauth = $config->get('gitlab-oauth');
- $gitlabToken = $config->get('gitlab-token');
- $httpBasic = $config->get('http-basic');
- $bearerToken = $config->get('bearer');
- foreach ($bitbucketOauth as $domain => $cred) {
- $this->checkAndSetAuthentication($domain, $cred['consumer-key'], $cred['consumer-secret']);
- }
- foreach ($githubOauth as $domain => $token) {
- if (!Preg::isMatch('{^[.A-Za-z0-9_]+$}', $token)) {
- throw new \UnexpectedValueException('Your github oauth token for '.$domain.' contains invalid characters: "'.$token.'"');
- }
- $this->checkAndSetAuthentication($domain, $token, 'x-oauth-basic');
- }
- foreach ($gitlabOauth as $domain => $token) {
- $token = is_array($token) ? $token["token"] : $token;
- $this->checkAndSetAuthentication($domain, $token, 'oauth2');
- }
- foreach ($gitlabToken as $domain => $token) {
- $username = is_array($token) ? $token["username"] : $token;
- $password = is_array($token) ? $token["token"] : 'private-token';
- $this->checkAndSetAuthentication($domain, $username, $password);
- }
- foreach ($httpBasic as $domain => $cred) {
- $this->checkAndSetAuthentication($domain, $cred['username'], $cred['password']);
- }
- foreach ($bearerToken as $domain => $token) {
- $this->checkAndSetAuthentication($domain, $token, 'bearer');
- }
- ProcessExecutor::setTimeout($config->get('process-timeout'));
- }
- public function emergency($message, array $context = []): void
- {
- $this->log(LogLevel::EMERGENCY, $message, $context);
- }
- public function alert($message, array $context = []): void
- {
- $this->log(LogLevel::ALERT, $message, $context);
- }
- public function critical($message, array $context = []): void
- {
- $this->log(LogLevel::CRITICAL, $message, $context);
- }
- public function error($message, array $context = []): void
- {
- $this->log(LogLevel::ERROR, $message, $context);
- }
- public function warning($message, array $context = []): void
- {
- $this->log(LogLevel::WARNING, $message, $context);
- }
- public function notice($message, array $context = []): void
- {
- $this->log(LogLevel::NOTICE, $message, $context);
- }
- public function info($message, array $context = []): void
- {
- $this->log(LogLevel::INFO, $message, $context);
- }
- public function debug($message, array $context = []): void
- {
- $this->log(LogLevel::DEBUG, $message, $context);
- }
- public function log($level, $message, array $context = []): void
- {
- $message = (string) $message;
- if (in_array($level, [LogLevel::EMERGENCY, LogLevel::ALERT, LogLevel::CRITICAL, LogLevel::ERROR])) {
- $this->writeError('<error>'.$message.'</error>');
- } elseif ($level === LogLevel::WARNING) {
- $this->writeError('<warning>'.$message.'</warning>');
- } elseif ($level === LogLevel::NOTICE) {
- $this->writeError('<info>'.$message.'</info>', true, self::VERBOSE);
- } elseif ($level === LogLevel::INFO) {
- $this->writeError('<info>'.$message.'</info>', true, self::VERY_VERBOSE);
- } else {
- $this->writeError($message, true, self::DEBUG);
- }
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\IO;
- use Composer\Pcre\Preg;
- use Symfony\Component\Console\Helper\QuestionHelper;
- use Symfony\Component\Console\Output\StreamOutput;
- use Symfony\Component\Console\Formatter\OutputFormatterInterface;
- use Symfony\Component\Console\Input\StreamableInputInterface;
- use Symfony\Component\Console\Input\StringInput;
- use Symfony\Component\Console\Helper\HelperSet;
- class BufferIO extends ConsoleIO
- {
- protected $input;
- protected $output;
- public function __construct(string $input = '', int $verbosity = StreamOutput::VERBOSITY_NORMAL, ?OutputFormatterInterface $formatter = null)
- {
- $input = new StringInput($input);
- $input->setInteractive(false);
- $output = new StreamOutput(fopen('php://memory', 'rw'), $verbosity, $formatter ? $formatter->isDecorated() : false, $formatter);
- parent::__construct($input, $output, new HelperSet([
- new QuestionHelper(),
- ]));
- }
- public function getOutput(): string
- {
- fseek($this->output->getStream(), 0);
- $output = stream_get_contents($this->output->getStream());
- $output = Preg::replaceCallback("{(?<=^|\n|\x08)(.+?)(\x08+)}", static function ($matches): string {
- $pre = strip_tags($matches[1]);
- if (strlen($pre) === strlen($matches[2])) {
- return '';
- }
- return rtrim($matches[1])."\n";
- }, $output);
- return $output;
- }
- public function setUserInputs(array $inputs): void
- {
- if (!$this->input instanceof StreamableInputInterface) {
- throw new \RuntimeException('Setting the user inputs requires at least the version 3.2 of the symfony/console component.');
- }
- $this->input->setStream($this->createStream($inputs));
- $this->input->setInteractive(true);
- }
- private function createStream(array $inputs)
- {
- $stream = fopen('php://memory', 'r+');
- foreach ($inputs as $input) {
- fwrite($stream, $input.PHP_EOL);
- }
- rewind($stream);
- return $stream;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\IO;
- use Composer\Question\StrictConfirmationQuestion;
- use Symfony\Component\Console\Helper\HelperSet;
- use Symfony\Component\Console\Helper\ProgressBar;
- use Symfony\Component\Console\Helper\Table;
- use Symfony\Component\Console\Input\InputInterface;
- use Symfony\Component\Console\Output\ConsoleOutputInterface;
- use Symfony\Component\Console\Output\OutputInterface;
- use Symfony\Component\Console\Question\ChoiceQuestion;
- use Symfony\Component\Console\Question\Question;
- class ConsoleIO extends BaseIO
- {
- protected $input;
- protected $output;
- protected $helperSet;
- protected $lastMessage = '';
- protected $lastMessageErr = '';
- private $startTime;
- private $verbosityMap;
- public function __construct(InputInterface $input, OutputInterface $output, HelperSet $helperSet)
- {
- $this->input = $input;
- $this->output = $output;
- $this->helperSet = $helperSet;
- $this->verbosityMap = [
- self::QUIET => OutputInterface::VERBOSITY_QUIET,
- self::NORMAL => OutputInterface::VERBOSITY_NORMAL,
- self::VERBOSE => OutputInterface::VERBOSITY_VERBOSE,
- self::VERY_VERBOSE => OutputInterface::VERBOSITY_VERY_VERBOSE,
- self::DEBUG => OutputInterface::VERBOSITY_DEBUG,
- ];
- }
- public function enableDebugging(float $startTime)
- {
- $this->startTime = $startTime;
- }
- public function isInteractive()
- {
- return $this->input->isInteractive();
- }
- public function isDecorated()
- {
- return $this->output->isDecorated();
- }
- public function isVerbose()
- {
- return $this->output->isVerbose();
- }
- public function isVeryVerbose()
- {
- return $this->output->isVeryVerbose();
- }
- public function isDebug()
- {
- return $this->output->isDebug();
- }
- public function write($messages, bool $newline = true, int $verbosity = self::NORMAL)
- {
- $this->doWrite($messages, $newline, false, $verbosity);
- }
- public function writeError($messages, bool $newline = true, int $verbosity = self::NORMAL)
- {
- $this->doWrite($messages, $newline, true, $verbosity);
- }
- public function writeRaw($messages, bool $newline = true, int $verbosity = self::NORMAL)
- {
- $this->doWrite($messages, $newline, false, $verbosity, true);
- }
- public function writeErrorRaw($messages, bool $newline = true, int $verbosity = self::NORMAL)
- {
- $this->doWrite($messages, $newline, true, $verbosity, true);
- }
- private function doWrite($messages, bool $newline, bool $stderr, int $verbosity, bool $raw = false): void
- {
- $sfVerbosity = $this->verbosityMap[$verbosity];
- if ($sfVerbosity > $this->output->getVerbosity()) {
- return;
- }
- if ($raw) {
- $sfVerbosity |= OutputInterface::OUTPUT_RAW;
- }
- if (null !== $this->startTime) {
- $memoryUsage = memory_get_usage() / 1024 / 1024;
- $timeSpent = microtime(true) - $this->startTime;
- $messages = array_map(static function ($message) use ($memoryUsage, $timeSpent): string {
- return sprintf('[%.1fMiB/%.2fs] %s', $memoryUsage, $timeSpent, $message);
- }, (array) $messages);
- }
- if (true === $stderr && $this->output instanceof ConsoleOutputInterface) {
- $this->output->getErrorOutput()->write($messages, $newline, $sfVerbosity);
- $this->lastMessageErr = implode($newline ? "\n" : '', (array) $messages);
- return;
- }
- $this->output->write($messages, $newline, $sfVerbosity);
- $this->lastMessage = implode($newline ? "\n" : '', (array) $messages);
- }
- public function overwrite($messages, bool $newline = true, ?int $size = null, int $verbosity = self::NORMAL)
- {
- $this->doOverwrite($messages, $newline, $size, false, $verbosity);
- }
- public function overwriteError($messages, bool $newline = true, ?int $size = null, int $verbosity = self::NORMAL)
- {
- $this->doOverwrite($messages, $newline, $size, true, $verbosity);
- }
- private function doOverwrite($messages, bool $newline, ?int $size, bool $stderr, int $verbosity): void
- {
- $messages = implode($newline ? "\n" : '', (array) $messages);
- if (!isset($size)) {
- $size = strlen(strip_tags($stderr ? $this->lastMessageErr : $this->lastMessage));
- }
- $this->doWrite(str_repeat("\x08", $size), false, $stderr, $verbosity);
- $this->doWrite($messages, false, $stderr, $verbosity);
- $fill = $size - strlen(strip_tags($messages));
- if ($fill > 0) {
- $this->doWrite(str_repeat(' ', $fill), false, $stderr, $verbosity);
- $this->doWrite(str_repeat("\x08", $fill), false, $stderr, $verbosity);
- }
- if ($newline) {
- $this->doWrite('', true, $stderr, $verbosity);
- }
- if ($stderr) {
- $this->lastMessageErr = $messages;
- } else {
- $this->lastMessage = $messages;
- }
- }
- public function getProgressBar(int $max = 0)
- {
- return new ProgressBar($this->getErrorOutput(), $max);
- }
- public function ask($question, $default = null)
- {
- $helper = $this->helperSet->get('question');
- $question = new Question($question, $default);
- return $helper->ask($this->input, $this->getErrorOutput(), $question);
- }
- public function askConfirmation($question, $default = true)
- {
- $helper = $this->helperSet->get('question');
- $question = new StrictConfirmationQuestion($question, $default);
- return $helper->ask($this->input, $this->getErrorOutput(), $question);
- }
- public function askAndValidate($question, $validator, $attempts = null, $default = null)
- {
- $helper = $this->helperSet->get('question');
- $question = new Question($question, $default);
- $question->setValidator($validator);
- $question->setMaxAttempts($attempts);
- return $helper->ask($this->input, $this->getErrorOutput(), $question);
- }
- public function askAndHideAnswer($question)
- {
- $helper = $this->helperSet->get('question');
- $question = new Question($question);
- $question->setHidden(true);
- return $helper->ask($this->input, $this->getErrorOutput(), $question);
- }
- public function select($question, $choices, $default, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false)
- {
- $helper = $this->helperSet->get('question');
- $question = new ChoiceQuestion($question, $choices, $default);
- $question->setMaxAttempts($attempts ?: null);
- $question->setErrorMessage($errorMessage);
- $question->setMultiselect($multiselect);
- $result = $helper->ask($this->input, $this->getErrorOutput(), $question);
- if (!is_array($result)) {
- return (string) array_search($result, $choices, true);
- }
- $results = [];
- foreach ($choices as $index => $choice) {
- if (in_array($choice, $result, true)) {
- $results[] = (string) $index;
- }
- }
- return $results;
- }
- public function getTable(): Table
- {
- return new Table($this->output);
- }
- private function getErrorOutput(): OutputInterface
- {
- if ($this->output instanceof ConsoleOutputInterface) {
- return $this->output->getErrorOutput();
- }
- return $this->output;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\IO;
- use Composer\Config;
- use Psr\Log\LoggerInterface;
- interface IOInterface extends LoggerInterface
- {
- public const QUIET = 1;
- public const NORMAL = 2;
- public const VERBOSE = 4;
- public const VERY_VERBOSE = 8;
- public const DEBUG = 16;
- public function isInteractive();
- public function isVerbose();
- public function isVeryVerbose();
- public function isDebug();
- public function isDecorated();
- public function write($messages, bool $newline = true, int $verbosity = self::NORMAL);
- public function writeError($messages, bool $newline = true, int $verbosity = self::NORMAL);
- public function writeRaw($messages, bool $newline = true, int $verbosity = self::NORMAL);
- public function writeErrorRaw($messages, bool $newline = true, int $verbosity = self::NORMAL);
- public function overwrite($messages, bool $newline = true, ?int $size = null, int $verbosity = self::NORMAL);
- public function overwriteError($messages, bool $newline = true, ?int $size = null, int $verbosity = self::NORMAL);
- public function ask(string $question, $default = null);
- public function askConfirmation(string $question, bool $default = true);
- public function askAndValidate(string $question, callable $validator, ?int $attempts = null, $default = null);
- public function askAndHideAnswer(string $question);
- public function select(string $question, array $choices, $default, $attempts = false, string $errorMessage = 'Value "%s" is invalid', bool $multiselect = false);
- public function getAuthentications();
- public function hasAuthentication(string $repositoryName);
- public function getAuthentication(string $repositoryName);
- public function setAuthentication(string $repositoryName, string $username, ?string $password = null);
- public function loadConfiguration(Config $config);
- }
- <?php declare(strict_types=1);
- namespace Composer\IO;
- class NullIO extends BaseIO
- {
- public function isInteractive(): bool
- {
- return false;
- }
- public function isVerbose(): bool
- {
- return false;
- }
- public function isVeryVerbose(): bool
- {
- return false;
- }
- public function isDebug(): bool
- {
- return false;
- }
- public function isDecorated(): bool
- {
- return false;
- }
- public function write($messages, bool $newline = true, int $verbosity = self::NORMAL): void
- {
- }
- public function writeError($messages, bool $newline = true, int $verbosity = self::NORMAL): void
- {
- }
- public function overwrite($messages, bool $newline = true, ?int $size = null, int $verbosity = self::NORMAL): void
- {
- }
- public function overwriteError($messages, bool $newline = true, ?int $size = null, int $verbosity = self::NORMAL): void
- {
- }
- public function ask($question, $default = null)
- {
- return $default;
- }
- public function askConfirmation($question, $default = true): bool
- {
- return $default;
- }
- public function askAndValidate($question, $validator, $attempts = null, $default = null)
- {
- return $default;
- }
- public function askAndHideAnswer($question): ?string
- {
- return null;
- }
- public function select($question, $choices, $default, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false)
- {
- return $default;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer;
- use Composer\Autoload\AutoloadGenerator;
- use Composer\Console\GithubActionError;
- use Composer\DependencyResolver\DefaultPolicy;
- use Composer\DependencyResolver\LocalRepoTransaction;
- use Composer\DependencyResolver\LockTransaction;
- use Composer\DependencyResolver\Operation\UpdateOperation;
- use Composer\DependencyResolver\Operation\InstallOperation;
- use Composer\DependencyResolver\Operation\UninstallOperation;
- use Composer\DependencyResolver\PoolOptimizer;
- use Composer\DependencyResolver\Pool;
- use Composer\DependencyResolver\Request;
- use Composer\DependencyResolver\Solver;
- use Composer\DependencyResolver\SolverProblemsException;
- use Composer\DependencyResolver\PolicyInterface;
- use Composer\Downloader\DownloadManager;
- use Composer\Downloader\TransportException;
- use Composer\EventDispatcher\EventDispatcher;
- use Composer\Filter\PlatformRequirementFilter\IgnoreListPlatformRequirementFilter;
- use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterFactory;
- use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterInterface;
- use Composer\Installer\InstallationManager;
- use Composer\Installer\InstallerEvents;
- use Composer\Installer\SuggestedPackagesReporter;
- use Composer\IO\IOInterface;
- use Composer\Package\AliasPackage;
- use Composer\Package\RootAliasPackage;
- use Composer\Package\BasePackage;
- use Composer\Package\CompletePackage;
- use Composer\Package\CompletePackageInterface;
- use Composer\Package\Link;
- use Composer\Package\Loader\ArrayLoader;
- use Composer\Package\Dumper\ArrayDumper;
- use Composer\Package\Version\VersionParser;
- use Composer\Package\Package;
- use Composer\Repository\ArrayRepository;
- use Composer\Repository\RepositorySet;
- use Composer\Repository\CompositeRepository;
- use Composer\Semver\Constraint\Constraint;
- use Composer\Package\Locker;
- use Composer\Package\RootPackageInterface;
- use Composer\Repository\InstalledArrayRepository;
- use Composer\Repository\InstalledRepositoryInterface;
- use Composer\Repository\InstalledRepository;
- use Composer\Repository\RootPackageRepository;
- use Composer\Repository\PlatformRepository;
- use Composer\Repository\RepositoryInterface;
- use Composer\Repository\RepositoryManager;
- use Composer\Repository\LockArrayRepository;
- use Composer\Script\ScriptEvents;
- use Composer\Semver\Constraint\ConstraintInterface;
- use Composer\Advisory\Auditor;
- use Composer\Util\Platform;
- class Installer
- {
- public const ERROR_NONE = 0;
- public const ERROR_GENERIC_FAILURE = 1;
- public const ERROR_NO_LOCK_FILE_FOR_PARTIAL_UPDATE = 3;
- public const ERROR_LOCK_FILE_INVALID = 4;
- public const ERROR_DEPENDENCY_RESOLUTION_FAILED = 2;
- protected $io;
- protected $config;
- protected $package;
- protected $fixedRootPackage;
- protected $downloadManager;
- protected $repositoryManager;
- protected $locker;
- protected $installationManager;
- protected $eventDispatcher;
- protected $autoloadGenerator;
- protected $preferSource = false;
- protected $preferDist = false;
- protected $optimizeAutoloader = false;
- protected $classMapAuthoritative = false;
- protected $apcuAutoloader = false;
- protected $apcuAutoloaderPrefix = null;
- protected $devMode = false;
- protected $dryRun = false;
- protected $verbose = false;
- protected $update = false;
- protected $install = true;
- protected $dumpAutoloader = true;
- protected $runScripts = true;
- protected $preferStable = false;
- protected $preferLowest = false;
- protected $writeLock;
- protected $executeOperations = true;
- protected $audit = true;
- protected $auditFormat = Auditor::FORMAT_SUMMARY;
- protected $updateMirrors = false;
- protected $updateAllowList = null;
- protected $updateAllowTransitiveDependencies = Request::UPDATE_ONLY_LISTED;
- protected $suggestedPackagesReporter;
- protected $platformRequirementFilter;
- protected $additionalFixedRepository;
- protected $temporaryConstraints = [];
- public function __construct(IOInterface $io, Config $config, RootPackageInterface $package, DownloadManager $downloadManager, RepositoryManager $repositoryManager, Locker $locker, InstallationManager $installationManager, EventDispatcher $eventDispatcher, AutoloadGenerator $autoloadGenerator)
- {
- $this->io = $io;
- $this->config = $config;
- $this->package = $package;
- $this->downloadManager = $downloadManager;
- $this->repositoryManager = $repositoryManager;
- $this->locker = $locker;
- $this->installationManager = $installationManager;
- $this->eventDispatcher = $eventDispatcher;
- $this->autoloadGenerator = $autoloadGenerator;
- $this->suggestedPackagesReporter = new SuggestedPackagesReporter($this->io);
- $this->platformRequirementFilter = PlatformRequirementFilterFactory::ignoreNothing();
- $this->writeLock = $config->get('lock');
- }
- public function run(): int
- {
- gc_collect_cycles();
- gc_disable();
- if ($this->updateAllowList && $this->updateMirrors) {
- throw new \RuntimeException("The installer options updateMirrors and updateAllowList are mutually exclusive.");
- }
- $isFreshInstall = $this->repositoryManager->getLocalRepository()->isFresh();
- if (!$this->update && !$this->locker->isLocked()) {
- $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>');
- $this->update = true;
- }
- if ($this->dryRun) {
- $this->verbose = true;
- $this->runScripts = false;
- $this->executeOperations = false;
- $this->writeLock = false;
- $this->dumpAutoloader = false;
- $this->mockLocalRepositories($this->repositoryManager);
- }
- if ($this->update && !$this->install) {
- $this->dumpAutoloader = false;
- }
- if ($this->runScripts) {
- Platform::putEnv('COMPOSER_DEV_MODE', $this->devMode ? '1' : '0');
- $eventName = $this->update ? ScriptEvents::PRE_UPDATE_CMD : ScriptEvents::PRE_INSTALL_CMD;
- $this->eventDispatcher->dispatchScript($eventName, $this->devMode);
- }
- $this->downloadManager->setPreferSource($this->preferSource);
- $this->downloadManager->setPreferDist($this->preferDist);
- $localRepo = $this->repositoryManager->getLocalRepository();
- try {
- if ($this->update) {
- $res = $this->doUpdate($localRepo, $this->install);
- } else {
- $res = $this->doInstall($localRepo);
- }
- if ($res !== 0) {
- return $res;
- }
- } catch (\Exception $e) {
- if ($this->executeOperations && $this->install && $this->config->get('notify-on-install')) {
- $this->installationManager->notifyInstalls($this->io);
- }
- throw $e;
- }
- if ($this->executeOperations && $this->install && $this->config->get('notify-on-install')) {
- $this->installationManager->notifyInstalls($this->io);
- }
- if ($this->update) {
- $installedRepo = new InstalledRepository([
- $this->locker->getLockedRepository($this->devMode),
- $this->createPlatformRepo(false),
- new RootPackageRepository(clone $this->package),
- ]);
- if ($isFreshInstall) {
- $this->suggestedPackagesReporter->addSuggestionsFromPackage($this->package);
- }
- $this->suggestedPackagesReporter->outputMinimalistic($installedRepo);
- }
- $lockedRepository = $this->locker->getLockedRepository(true);
- foreach ($lockedRepository->getPackages() as $package) {
- if (!$package instanceof CompletePackage || !$package->isAbandoned()) {
- continue;
- }
- $replacement = is_string($package->getReplacementPackage())
- ? 'Use ' . $package->getReplacementPackage() . ' instead'
- : 'No replacement was suggested';
- $this->io->writeError(
- sprintf(
- "<warning>Package %s is abandoned, you should avoid using it. %s.</warning>",
- $package->getPrettyName(),
- $replacement
- )
- );
- }
- if ($this->dumpAutoloader) {
- if ($this->optimizeAutoloader) {
- $this->io->writeError('<info>Generating optimized autoload files</info>');
- } else {
- $this->io->writeError('<info>Generating autoload files</info>');
- }
- $this->autoloadGenerator->setClassMapAuthoritative($this->classMapAuthoritative);
- $this->autoloadGenerator->setApcu($this->apcuAutoloader, $this->apcuAutoloaderPrefix);
- $this->autoloadGenerator->setRunScripts($this->runScripts);
- $this->autoloadGenerator->setPlatformRequirementFilter($this->platformRequirementFilter);
- $this->autoloadGenerator->dump($this->config, $localRepo, $this->package, $this->installationManager, 'composer', $this->optimizeAutoloader);
- }
- if ($this->install && $this->executeOperations) {
- foreach ($localRepo->getPackages() as $package) {
- $this->installationManager->ensureBinariesPresence($package);
- }
- }
- $fundingCount = 0;
- foreach ($localRepo->getPackages() as $package) {
- if ($package instanceof CompletePackageInterface && !$package instanceof AliasPackage && $package->getFunding()) {
- $fundingCount++;
- }
- }
- if ($fundingCount > 0) {
- $this->io->writeError([
- sprintf(
- "<info>%d package%s you are using %s looking for funding.</info>",
- $fundingCount,
- 1 === $fundingCount ? '' : 's',
- 1 === $fundingCount ? 'is' : 'are'
- ),
- '<info>Use the `composer fund` command to find out more!</info>',
- ]);
- }
- if ($this->runScripts) {
- $eventName = $this->update ? ScriptEvents::POST_UPDATE_CMD : ScriptEvents::POST_INSTALL_CMD;
- $this->eventDispatcher->dispatchScript($eventName, $this->devMode);
- }
- if (!defined('HHVM_VERSION')) {
- gc_enable();
- }
- if ($this->audit) {
- if ($this->update && !$this->install) {
- $packages = $lockedRepository->getCanonicalPackages();
- $target = 'locked';
- } else {
- $packages = $localRepo->getCanonicalPackages();
- $target = 'installed';
- }
- if (count($packages) > 0) {
- try {
- $auditor = new Auditor();
- $repoSet = new RepositorySet();
- foreach ($this->repositoryManager->getRepositories() as $repo) {
- $repoSet->addRepository($repo);
- }
- $auditor->audit($this->io, $repoSet, $packages, $this->auditFormat);
- } catch (TransportException $e) {
- $this->io->error('Failed to audit '.$target.' packages.');
- if ($this->io->isVerbose()) {
- $this->io->error('['.get_class($e).'] '.$e->getMessage());
- }
- }
- } else {
- $this->io->writeError('No '.$target.' packages - skipping audit.');
- }
- }
- return 0;
- }
- protected function doUpdate(InstalledRepositoryInterface $localRepo, bool $doInstall): int
- {
- $platformRepo = $this->createPlatformRepo(true);
- $aliases = $this->getRootAliases(true);
- $lockedRepository = null;
- try {
- if ($this->locker->isLocked()) {
- $lockedRepository = $this->locker->getLockedRepository(true);
- }
- } catch (\Seld\JsonLint\ParsingException $e) {
- if ($this->updateAllowList || $this->updateMirrors) {
- throw $e;
- }
- }
- if (($this->updateAllowList || $this->updateMirrors) && !$lockedRepository) {
- $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);
- return self::ERROR_NO_LOCK_FILE_FOR_PARTIAL_UPDATE;
- }
- $this->io->writeError('<info>Loading composer repositories with package information</info>');
- $policy = $this->createPolicy(true);
- $repositorySet = $this->createRepositorySet(true, $platformRepo, $aliases);
- $repositories = $this->repositoryManager->getRepositories();
- foreach ($repositories as $repository) {
- $repositorySet->addRepository($repository);
- }
- if ($lockedRepository) {
- $repositorySet->addRepository($lockedRepository);
- }
- $request = $this->createRequest($this->fixedRootPackage, $platformRepo, $lockedRepository);
- $this->requirePackagesForUpdate($request, $lockedRepository, true);
- if ($this->updateAllowList) {
- $request->setUpdateAllowList($this->updateAllowList, $this->updateAllowTransitiveDependencies);
- }
- $pool = $repositorySet->createPool($request, $this->io, $this->eventDispatcher, $this->createPoolOptimizer($policy));
- $this->io->writeError('<info>Updating dependencies</info>');
- $solver = new Solver($policy, $pool, $this->io);
- try {
- $lockTransaction = $solver->solve($request, $this->platformRequirementFilter);
- $ruleSetSize = $solver->getRuleSetSize();
- $solver = null;
- } catch (SolverProblemsException $e) {
- $err = 'Your requirements could not be resolved to an installable set of packages.';
- $prettyProblem = $e->getPrettyString($repositorySet, $request, $pool, $this->io->isVerbose());
- $this->io->writeError('<error>'. $err .'</error>', true, IOInterface::QUIET);
- $this->io->writeError($prettyProblem);
- if (!$this->devMode) {
- $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);
- }
- $ghe = new GithubActionError($this->io);
- $ghe->emit($err."\n".$prettyProblem);
- return max(self::ERROR_GENERIC_FAILURE, $e->getCode());
- }
- $this->io->writeError("Analyzed ".count($pool)." packages to resolve dependencies", true, IOInterface::VERBOSE);
- $this->io->writeError("Analyzed ".$ruleSetSize." rules to resolve dependencies", true, IOInterface::VERBOSE);
- $pool = null;
- if (!$lockTransaction->getOperations()) {
- $this->io->writeError('Nothing to modify in lock file');
- }
- $exitCode = $this->extractDevPackages($lockTransaction, $platformRepo, $aliases, $policy, $lockedRepository);
- if ($exitCode !== 0) {
- return $exitCode;
- }
- if (method_exists('Composer\Semver\CompilingMatcher', 'clear')) {
- \Composer\Semver\CompilingMatcher::clear();
- }
- $platformReqs = $this->extractPlatformRequirements($this->package->getRequires());
- $platformDevReqs = $this->extractPlatformRequirements($this->package->getDevRequires());
- $installsUpdates = $uninstalls = [];
- if ($lockTransaction->getOperations()) {
- $installNames = $updateNames = $uninstallNames = [];
- foreach ($lockTransaction->getOperations() as $operation) {
- if ($operation instanceof InstallOperation) {
- $installsUpdates[] = $operation;
- $installNames[] = $operation->getPackage()->getPrettyName().':'.$operation->getPackage()->getFullPrettyVersion();
- } elseif ($operation instanceof UpdateOperation) {
- if ($this->updateMirrors
- && $operation->getInitialPackage()->getName() === $operation->getTargetPackage()->getName()
- && $operation->getInitialPackage()->getVersion() === $operation->getTargetPackage()->getVersion()
- ) {
- continue;
- }
- $installsUpdates[] = $operation;
- $updateNames[] = $operation->getTargetPackage()->getPrettyName().':'.$operation->getTargetPackage()->getFullPrettyVersion();
- } elseif ($operation instanceof UninstallOperation) {
- $uninstalls[] = $operation;
- $uninstallNames[] = $operation->getPackage()->getPrettyName();
- }
- }
- if ($this->config->get('lock')) {
- $this->io->writeError(sprintf(
- "<info>Lock file operations: %d install%s, %d update%s, %d removal%s</info>",
- count($installNames),
- 1 === count($installNames) ? '' : 's',
- count($updateNames),
- 1 === count($updateNames) ? '' : 's',
- count($uninstalls),
- 1 === count($uninstalls) ? '' : 's'
- ));
- if ($installNames) {
- $this->io->writeError("Installs: ".implode(', ', $installNames), true, IOInterface::VERBOSE);
- }
- if ($updateNames) {
- $this->io->writeError("Updates: ".implode(', ', $updateNames), true, IOInterface::VERBOSE);
- }
- if ($uninstalls) {
- $this->io->writeError("Removals: ".implode(', ', $uninstallNames), true, IOInterface::VERBOSE);
- }
- }
- }
- $sortByName = static function ($a, $b): int {
- if ($a instanceof UpdateOperation) {
- $a = $a->getTargetPackage()->getName();
- } else {
- $a = $a->getPackage()->getName();
- }
- if ($b instanceof UpdateOperation) {
- $b = $b->getTargetPackage()->getName();
- } else {
- $b = $b->getPackage()->getName();
- }
- return strcmp($a, $b);
- };
- usort($uninstalls, $sortByName);
- usort($installsUpdates, $sortByName);
- foreach (array_merge($uninstalls, $installsUpdates) as $operation) {
- if ($operation instanceof InstallOperation) {
- $this->suggestedPackagesReporter->addSuggestionsFromPackage($operation->getPackage());
- }
- if ($this->config->get('lock') && (false === strpos($operation->getOperationType(), 'Alias') || $this->io->isDebug())) {
- $this->io->writeError(' - ' . $operation->show(true));
- }
- }
- $updatedLock = $this->locker->setLockData(
- $lockTransaction->getNewLockPackages(false, $this->updateMirrors),
- $lockTransaction->getNewLockPackages(true, $this->updateMirrors),
- $platformReqs,
- $platformDevReqs,
- $lockTransaction->getAliases($aliases),
- $this->package->getMinimumStability(),
- $this->package->getStabilityFlags(),
- $this->preferStable || $this->package->getPreferStable(),
- $this->preferLowest,
- $this->config->get('platform') ?: [],
- $this->writeLock && $this->executeOperations
- );
- if ($updatedLock && $this->writeLock && $this->executeOperations) {
- $this->io->writeError('<info>Writing lock file</info>');
- }
- if ($this->executeOperations && count($lockTransaction->getOperations()) > 0) {
- $vendorDir = $this->config->get('vendor-dir');
- if (is_dir($vendorDir)) {
- @touch($vendorDir);
- }
- }
- if ($doInstall) {
- return $this->doInstall($localRepo, true);
- }
- return 0;
- }
- protected function extractDevPackages(LockTransaction $lockTransaction, PlatformRepository $platformRepo, array $aliases, PolicyInterface $policy, ?LockArrayRepository $lockedRepository = null): int
- {
- if (!$this->package->getDevRequires()) {
- return 0;
- }
- $resultRepo = new ArrayRepository([]);
- $loader = new ArrayLoader(null, true);
- $dumper = new ArrayDumper();
- foreach ($lockTransaction->getNewLockPackages(false) as $pkg) {
- $resultRepo->addPackage($loader->load($dumper->dump($pkg)));
- }
- $repositorySet = $this->createRepositorySet(true, $platformRepo, $aliases);
- $repositorySet->addRepository($resultRepo);
- $request = $this->createRequest($this->fixedRootPackage, $platformRepo);
- $this->requirePackagesForUpdate($request, $lockedRepository, false);
- $pool = $repositorySet->createPoolWithAllPackages();
- $solver = new Solver($policy, $pool, $this->io);
- try {
- $nonDevLockTransaction = $solver->solve($request, $this->platformRequirementFilter);
- $solver = null;
- } catch (SolverProblemsException $e) {
- $err = 'Unable to find a compatible set of packages based on your non-dev requirements alone.';
- $prettyProblem = $e->getPrettyString($repositorySet, $request, $pool, $this->io->isVerbose(), true);
- $this->io->writeError('<error>'. $err .'</error>', true, IOInterface::QUIET);
- $this->io->writeError('Your requirements can be resolved successfully when require-dev packages are present.');
- $this->io->writeError('You may need to move packages from require-dev or some of their dependencies to require.');
- $this->io->writeError($prettyProblem);
- $ghe = new GithubActionError($this->io);
- $ghe->emit($err."\n".$prettyProblem);
- return $e->getCode();
- }
- $lockTransaction->setNonDevPackages($nonDevLockTransaction);
- return 0;
- }
- protected function doInstall(InstalledRepositoryInterface $localRepo, bool $alreadySolved = false): int
- {
- if ($this->config->get('lock')) {
- $this->io->writeError('<info>Installing dependencies from lock file'.($this->devMode ? ' (including require-dev)' : '').'</info>');
- }
- $lockedRepository = $this->locker->getLockedRepository($this->devMode);
- if (!$alreadySolved) {
- $this->io->writeError('<info>Verifying lock file contents can be installed on current platform.</info>');
- $platformRepo = $this->createPlatformRepo(false);
- $policy = $this->createPolicy(false);
- $repositorySet = $this->createRepositorySet(false, $platformRepo, [], $lockedRepository);
- $repositorySet->addRepository($lockedRepository);
- $request = $this->createRequest($this->fixedRootPackage, $platformRepo, $lockedRepository);
- if (!$this->locker->isFresh()) {
- $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);
- }
- foreach ($lockedRepository->getPackages() as $package) {
- $request->fixLockedPackage($package);
- }
- foreach ($this->locker->getPlatformRequirements($this->devMode) as $link) {
- $request->requireName($link->getTarget(), $link->getConstraint());
- }
- $pool = $repositorySet->createPool($request, $this->io, $this->eventDispatcher);
- $solver = new Solver($policy, $pool, $this->io);
- try {
- $lockTransaction = $solver->solve($request, $this->platformRequirementFilter);
- $solver = null;
- if (0 !== count($lockTransaction->getOperations())) {
- $this->io->writeError('<error>Your lock file cannot be installed on this system without changes. Please run composer update.</error>', true, IOInterface::QUIET);
- return self::ERROR_LOCK_FILE_INVALID;
- }
- } catch (SolverProblemsException $e) {
- $err = 'Your lock file does not contain a compatible set of packages. Please run composer update.';
- $prettyProblem = $e->getPrettyString($repositorySet, $request, $pool, $this->io->isVerbose());
- $this->io->writeError('<error>'. $err .'</error>', true, IOInterface::QUIET);
- $this->io->writeError($prettyProblem);
- $ghe = new GithubActionError($this->io);
- $ghe->emit($err."\n".$prettyProblem);
- return max(self::ERROR_GENERIC_FAILURE, $e->getCode());
- }
- }
- $localRepoTransaction = new LocalRepoTransaction($lockedRepository, $localRepo);
- $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::PRE_OPERATIONS_EXEC, $this->devMode, $this->executeOperations, $localRepoTransaction);
- if (!$localRepoTransaction->getOperations()) {
- $this->io->writeError('Nothing to install, update or remove');
- }
- if ($localRepoTransaction->getOperations()) {
- $installs = $updates = $uninstalls = [];
- foreach ($localRepoTransaction->getOperations() as $operation) {
- if ($operation instanceof InstallOperation) {
- $installs[] = $operation->getPackage()->getPrettyName().':'.$operation->getPackage()->getFullPrettyVersion();
- } elseif ($operation instanceof UpdateOperation) {
- $updates[] = $operation->getTargetPackage()->getPrettyName().':'.$operation->getTargetPackage()->getFullPrettyVersion();
- } elseif ($operation instanceof UninstallOperation) {
- $uninstalls[] = $operation->getPackage()->getPrettyName();
- }
- }
- $this->io->writeError(sprintf(
- "<info>Package operations: %d install%s, %d update%s, %d removal%s</info>",
- count($installs),
- 1 === count($installs) ? '' : 's',
- count($updates),
- 1 === count($updates) ? '' : 's',
- count($uninstalls),
- 1 === count($uninstalls) ? '' : 's'
- ));
- if ($installs) {
- $this->io->writeError("Installs: ".implode(', ', $installs), true, IOInterface::VERBOSE);
- }
- if ($updates) {
- $this->io->writeError("Updates: ".implode(', ', $updates), true, IOInterface::VERBOSE);
- }
- if ($uninstalls) {
- $this->io->writeError("Removals: ".implode(', ', $uninstalls), true, IOInterface::VERBOSE);
- }
- }
- if ($this->executeOperations) {
- $localRepo->setDevPackageNames($this->locker->getDevPackageNames());
- $this->installationManager->execute($localRepo, $localRepoTransaction->getOperations(), $this->devMode, $this->runScripts);
- } else {
- foreach ($localRepoTransaction->getOperations() as $operation) {
- if (false === strpos($operation->getOperationType(), 'Alias') || $this->io->isDebug()) {
- $this->io->writeError(' - ' . $operation->show(false));
- }
- }
- }
- return 0;
- }
- protected function createPlatformRepo(bool $forUpdate): PlatformRepository
- {
- if ($forUpdate) {
- $platformOverrides = $this->config->get('platform') ?: [];
- } else {
- $platformOverrides = $this->locker->getPlatformOverrides();
- }
- return new PlatformRepository([], $platformOverrides);
- }
- private function createRepositorySet(bool $forUpdate, PlatformRepository $platformRepo, array $rootAliases = [], ?RepositoryInterface $lockedRepository = null): RepositorySet
- {
- if ($forUpdate) {
- $minimumStability = $this->package->getMinimumStability();
- $stabilityFlags = $this->package->getStabilityFlags();
- $requires = array_merge($this->package->getRequires(), $this->package->getDevRequires());
- } else {
- $minimumStability = $this->locker->getMinimumStability();
- $stabilityFlags = $this->locker->getStabilityFlags();
- $requires = [];
- foreach ($lockedRepository->getPackages() as $package) {
- $constraint = new Constraint('=', $package->getVersion());
- $constraint->setPrettyString($package->getPrettyVersion());
- $requires[$package->getName()] = $constraint;
- }
- }
- $rootRequires = [];
- foreach ($requires as $req => $constraint) {
- if ($constraint instanceof Link) {
- $constraint = $constraint->getConstraint();
- }
- if ($this->platformRequirementFilter->isIgnored($req)) {
- continue;
- } elseif ($this->platformRequirementFilter instanceof IgnoreListPlatformRequirementFilter) {
- $constraint = $this->platformRequirementFilter->filterConstraint($req, $constraint);
- }
- $rootRequires[$req] = $constraint;
- }
- $this->fixedRootPackage = clone $this->package;
- $this->fixedRootPackage->setRequires([]);
- $this->fixedRootPackage->setDevRequires([]);
- $stabilityFlags[$this->package->getName()] = BasePackage::$stabilities[VersionParser::parseStability($this->package->getVersion())];
- $repositorySet = new RepositorySet($minimumStability, $stabilityFlags, $rootAliases, $this->package->getReferences(), $rootRequires, $this->temporaryConstraints);
- $repositorySet->addRepository(new RootPackageRepository($this->fixedRootPackage));
- $repositorySet->addRepository($platformRepo);
- if ($this->additionalFixedRepository) {
- $additionalFixedRepositories = $this->additionalFixedRepository;
- if ($additionalFixedRepositories instanceof CompositeRepository) {
- $additionalFixedRepositories = $additionalFixedRepositories->getRepositories();
- } else {
- $additionalFixedRepositories = [$additionalFixedRepositories];
- }
- foreach ($additionalFixedRepositories as $additionalFixedRepository) {
- if ($additionalFixedRepository instanceof InstalledRepository || $additionalFixedRepository instanceof InstalledRepositoryInterface) {
- $repositorySet->allowInstalledRepositories();
- break;
- }
- }
- $repositorySet->addRepository($this->additionalFixedRepository);
- }
- return $repositorySet;
- }
- private function createPolicy(bool $forUpdate): DefaultPolicy
- {
- $preferStable = null;
- $preferLowest = null;
- if (!$forUpdate) {
- $preferStable = $this->locker->getPreferStable();
- $preferLowest = $this->locker->getPreferLowest();
- }
- if (null === $preferStable) {
- $preferStable = $this->preferStable || $this->package->getPreferStable();
- }
- if (null === $preferLowest) {
- $preferLowest = $this->preferLowest;
- }
- return new DefaultPolicy($preferStable, $preferLowest);
- }
- private function createRequest(RootPackageInterface $rootPackage, PlatformRepository $platformRepo, ?LockArrayRepository $lockedRepository = null): Request
- {
- $request = new Request($lockedRepository);
- $request->fixPackage($rootPackage);
- if ($rootPackage instanceof RootAliasPackage) {
- $request->fixPackage($rootPackage->getAliasOf());
- }
- $fixedPackages = $platformRepo->getPackages();
- if ($this->additionalFixedRepository) {
- $fixedPackages = array_merge($fixedPackages, $this->additionalFixedRepository->getPackages());
- }
- $provided = $rootPackage->getProvides();
- foreach ($fixedPackages as $package) {
- if ($package->getRepository() !== $platformRepo
- || !isset($provided[$package->getName()])
- || !$provided[$package->getName()]->getConstraint()->matches(new Constraint('=', $package->getVersion()))
- ) {
- $request->fixPackage($package);
- }
- }
- return $request;
- }
- private function requirePackagesForUpdate(Request $request, ?LockArrayRepository $lockedRepository = null, bool $includeDevRequires = true): void
- {
- if ($this->updateMirrors) {
- $excludedPackages = [];
- if (!$includeDevRequires) {
- $excludedPackages = array_flip($this->locker->getDevPackageNames());
- }
- foreach ($lockedRepository->getPackages() as $lockedPackage) {
- if (!$lockedPackage instanceof AliasPackage && !isset($excludedPackages[$lockedPackage->getName()])) {
- $request->requireName($lockedPackage->getName(), new Constraint('==', $lockedPackage->getVersion()));
- }
- }
- } else {
- $links = $this->package->getRequires();
- if ($includeDevRequires) {
- $links = array_merge($links, $this->package->getDevRequires());
- }
- foreach ($links as $link) {
- $request->requireName($link->getTarget(), $link->getConstraint());
- }
- }
- }
- private function getRootAliases(bool $forUpdate): array
- {
- if ($forUpdate) {
- $aliases = $this->package->getAliases();
- } else {
- $aliases = $this->locker->getAliases();
- }
- return $aliases;
- }
- private function extractPlatformRequirements(array $links): array
- {
- $platformReqs = [];
- foreach ($links as $link) {
- if (PlatformRepository::isPlatformPackage($link->getTarget())) {
- $platformReqs[$link->getTarget()] = $link->getPrettyConstraint();
- }
- }
- return $platformReqs;
- }
- private function mockLocalRepositories(RepositoryManager $rm): void
- {
- $packages = [];
- foreach ($rm->getLocalRepository()->getPackages() as $package) {
- $packages[(string) $package] = clone $package;
- }
- foreach ($packages as $key => $package) {
- if ($package instanceof AliasPackage) {
- $alias = (string) $package->getAliasOf();
- $className = get_class($package);
- $packages[$key] = new $className($packages[$alias], $package->getVersion(), $package->getPrettyVersion());
- }
- }
- $rm->setLocalRepository(
- new InstalledArrayRepository($packages)
- );
- }
- private function createPoolOptimizer(PolicyInterface $policy): ?PoolOptimizer
- {
- if ('0' === Platform::getEnv('COMPOSER_POOL_OPTIMIZER')) {
- $this->io->write('Pool Optimizer was disabled for debugging purposes.', true, IOInterface::DEBUG);
- return null;
- }
- return new PoolOptimizer($policy);
- }
- public static function create(IOInterface $io, Composer $composer): self
- {
- return new static(
- $io,
- $composer->getConfig(),
- $composer->getPackage(),
- $composer->getDownloadManager(),
- $composer->getRepositoryManager(),
- $composer->getLocker(),
- $composer->getInstallationManager(),
- $composer->getEventDispatcher(),
- $composer->getAutoloadGenerator()
- );
- }
- public function setAdditionalFixedRepository(RepositoryInterface $additionalFixedRepository): self
- {
- $this->additionalFixedRepository = $additionalFixedRepository;
- return $this;
- }
- public function setTemporaryConstraints(array $constraints): self
- {
- $this->temporaryConstraints = $constraints;
- return $this;
- }
- public function setDryRun(bool $dryRun = true): self
- {
- $this->dryRun = (bool) $dryRun;
- return $this;
- }
- public function isDryRun(): bool
- {
- return $this->dryRun;
- }
- public function setPreferSource(bool $preferSource = true): self
- {
- $this->preferSource = (bool) $preferSource;
- return $this;
- }
- public function setPreferDist(bool $preferDist = true): self
- {
- $this->preferDist = (bool) $preferDist;
- return $this;
- }
- public function setOptimizeAutoloader(bool $optimizeAutoloader): self
- {
- $this->optimizeAutoloader = (bool) $optimizeAutoloader;
- if (!$this->optimizeAutoloader) {
- $this->setClassMapAuthoritative(false);
- }
- return $this;
- }
- public function setClassMapAuthoritative(bool $classMapAuthoritative): self
- {
- $this->classMapAuthoritative = (bool) $classMapAuthoritative;
- if ($this->classMapAuthoritative) {
- $this->setOptimizeAutoloader(true);
- }
- return $this;
- }
- public function setApcuAutoloader(bool $apcuAutoloader, ?string $apcuAutoloaderPrefix = null): self
- {
- $this->apcuAutoloader = $apcuAutoloader;
- $this->apcuAutoloaderPrefix = $apcuAutoloaderPrefix;
- return $this;
- }
- public function setUpdate(bool $update): self
- {
- $this->update = (bool) $update;
- return $this;
- }
- public function setInstall(bool $install): self
- {
- $this->install = (bool) $install;
- return $this;
- }
- public function setDevMode(bool $devMode = true): self
- {
- $this->devMode = (bool) $devMode;
- return $this;
- }
- public function setDumpAutoloader(bool $dumpAutoloader = true): self
- {
- $this->dumpAutoloader = (bool) $dumpAutoloader;
- return $this;
- }
- public function setRunScripts(bool $runScripts = true): self
- {
- $this->runScripts = (bool) $runScripts;
- return $this;
- }
- public function setConfig(Config $config): self
- {
- $this->config = $config;
- return $this;
- }
- public function setVerbose(bool $verbose = true): self
- {
- $this->verbose = (bool) $verbose;
- return $this;
- }
- public function isVerbose(): bool
- {
- return $this->verbose;
- }
- public function setIgnorePlatformRequirements($ignorePlatformReqs): self
- {
- trigger_error('Installer::setIgnorePlatformRequirements is deprecated since Composer 2.2, use setPlatformRequirementFilter instead.', E_USER_DEPRECATED);
- return $this->setPlatformRequirementFilter(PlatformRequirementFilterFactory::fromBoolOrList($ignorePlatformReqs));
- }
- public function setPlatformRequirementFilter(PlatformRequirementFilterInterface $platformRequirementFilter): self
- {
- $this->platformRequirementFilter = $platformRequirementFilter;
- return $this;
- }
- public function setUpdateMirrors(bool $updateMirrors): self
- {
- $this->updateMirrors = $updateMirrors;
- return $this;
- }
- public function setUpdateAllowList(array $packages): self
- {
- $this->updateAllowList = array_flip(array_map('strtolower', $packages));
- return $this;
- }
- public function setUpdateAllowTransitiveDependencies(int $updateAllowTransitiveDependencies): self
- {
- if (!in_array($updateAllowTransitiveDependencies, [Request::UPDATE_ONLY_LISTED, Request::UPDATE_LISTED_WITH_TRANSITIVE_DEPS_NO_ROOT_REQUIRE, Request::UPDATE_LISTED_WITH_TRANSITIVE_DEPS], true)) {
- throw new \RuntimeException("Invalid value for updateAllowTransitiveDependencies supplied");
- }
- $this->updateAllowTransitiveDependencies = $updateAllowTransitiveDependencies;
- return $this;
- }
- public function setPreferStable(bool $preferStable = true): self
- {
- $this->preferStable = (bool) $preferStable;
- return $this;
- }
- public function setPreferLowest(bool $preferLowest = true): self
- {
- $this->preferLowest = (bool) $preferLowest;
- return $this;
- }
- public function setWriteLock(bool $writeLock = true): self
- {
- $this->writeLock = (bool) $writeLock;
- return $this;
- }
- public function setExecuteOperations(bool $executeOperations = true): self
- {
- $this->executeOperations = (bool) $executeOperations;
- return $this;
- }
- public function setAudit(bool $audit): self
- {
- $this->audit = $audit;
- return $this;
- }
- public function setAuditFormat(string $auditFormat): self
- {
- $this->auditFormat = $auditFormat;
- return $this;
- }
- public function disablePlugins(): self
- {
- $this->installationManager->disablePlugins();
- return $this;
- }
- public function setSuggestedPackagesReporter(SuggestedPackagesReporter $suggestedPackagesReporter): self
- {
- $this->suggestedPackagesReporter = $suggestedPackagesReporter;
- return $this;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Installer;
- use Composer\IO\IOInterface;
- use Composer\Package\PackageInterface;
- use Composer\Pcre\Preg;
- use Composer\Util\Filesystem;
- use Composer\Util\Platform;
- use Composer\Util\ProcessExecutor;
- use Composer\Util\Silencer;
- class BinaryInstaller
- {
- protected $binDir;
- protected $binCompat;
- protected $io;
- protected $filesystem;
- private $vendorDir;
- public function __construct(IOInterface $io, string $binDir, string $binCompat, ?Filesystem $filesystem = null, ?string $vendorDir = null)
- {
- $this->binDir = $binDir;
- $this->binCompat = $binCompat;
- $this->io = $io;
- $this->filesystem = $filesystem ?: new Filesystem();
- $this->vendorDir = $vendorDir;
- }
- public function installBinaries(PackageInterface $package, string $installPath, bool $warnOnOverwrite = true): void
- {
- $binaries = $this->getBinaries($package);
- if (!$binaries) {
- return;
- }
- Platform::workaroundFilesystemIssues();
- foreach ($binaries as $bin) {
- $binPath = $installPath.'/'.$bin;
- if (!file_exists($binPath)) {
- $this->io->writeError(' <warning>Skipped installation of bin '.$bin.' for package '.$package->getName().': file not found in package</warning>');
- continue;
- }
- if (is_dir($binPath)) {
- $this->io->writeError(' <warning>Skipped installation of bin '.$bin.' for package '.$package->getName().': found a directory at that path</warning>');
- continue;
- }
- if (!$this->filesystem->isAbsolutePath($binPath)) {
- $binPath = realpath($binPath);
- }
- $this->initializeBinDir();
- $link = $this->binDir.'/'.basename($bin);
- if (file_exists($link)) {
- if (!is_link($link)) {
- if ($warnOnOverwrite) {
- $this->io->writeError(' Skipped installation of bin '.$bin.' for package '.$package->getName().': name conflicts with an existing file');
- }
- continue;
- }
- if (realpath($link) === realpath($binPath)) {
- $this->filesystem->unlink($link);
- }
- }
- $binCompat = $this->binCompat;
- if ($binCompat === "auto" && (Platform::isWindows() || Platform::isWindowsSubsystemForLinux())) {
- $binCompat = 'full';
- }
- if ($binCompat === "full") {
- $this->installFullBinaries($binPath, $link, $bin, $package);
- } else {
- $this->installUnixyProxyBinaries($binPath, $link);
- }
- Silencer::call('chmod', $binPath, 0777 & ~umask());
- }
- }
- public function removeBinaries(PackageInterface $package): void
- {
- $this->initializeBinDir();
- $binaries = $this->getBinaries($package);
- if (!$binaries) {
- return;
- }
- foreach ($binaries as $bin) {
- $link = $this->binDir.'/'.basename($bin);
- if (is_link($link) || file_exists($link)) {
- $this->filesystem->unlink($link);
- }
- if (is_file($link.'.bat')) {
- $this->filesystem->unlink($link.'.bat');
- }
- }
- if (is_dir($this->binDir) && $this->filesystem->isDirEmpty($this->binDir)) {
- Silencer::call('rmdir', $this->binDir);
- }
- }
- public static function determineBinaryCaller(string $bin): string
- {
- if ('.bat' === substr($bin, -4) || '.exe' === substr($bin, -4)) {
- return 'call';
- }
- $handle = fopen($bin, 'r');
- $line = fgets($handle);
- fclose($handle);
- if (Preg::isMatch('{^#!/(?:usr/bin/env )?(?:[^/]+/)*(.+)$}m', $line, $match)) {
- return trim($match[1]);
- }
- return 'php';
- }
- protected function getBinaries(PackageInterface $package): array
- {
- return $package->getBinaries();
- }
- protected function installFullBinaries(string $binPath, string $link, string $bin, PackageInterface $package): void
- {
- if ('.bat' !== substr($binPath, -4)) {
- $this->installUnixyProxyBinaries($binPath, $link);
- $link .= '.bat';
- if (file_exists($link)) {
- $this->io->writeError(' Skipped installation of bin '.$bin.'.bat proxy for package '.$package->getName().': a .bat proxy was already installed');
- }
- }
- if (!file_exists($link)) {
- file_put_contents($link, $this->generateWindowsProxyCode($binPath, $link));
- Silencer::call('chmod', $link, 0777 & ~umask());
- }
- }
- protected function installUnixyProxyBinaries(string $binPath, string $link): void
- {
- file_put_contents($link, $this->generateUnixyProxyCode($binPath, $link));
- Silencer::call('chmod', $link, 0777 & ~umask());
- }
- protected function initializeBinDir(): void
- {
- $this->filesystem->ensureDirectoryExists($this->binDir);
- $this->binDir = realpath($this->binDir);
- }
- protected function generateWindowsProxyCode(string $bin, string $link): string
- {
- $binPath = $this->filesystem->findShortestPath($link, $bin);
- $caller = self::determineBinaryCaller($bin);
- if ($caller === 'php') {
- return "@ECHO OFF\r\n".
- "setlocal DISABLEDELAYEDEXPANSION\r\n".
- "SET BIN_TARGET=%~dp0/".trim(ProcessExecutor::escape(basename($link, '.bat')), '"\'')."\r\n".
- "SET COMPOSER_RUNTIME_BIN_DIR=%~dp0\r\n".
- "{$caller} \"%BIN_TARGET%\" %*\r\n";
- }
- return "@ECHO OFF\r\n".
- "setlocal DISABLEDELAYEDEXPANSION\r\n".
- "SET BIN_TARGET=%~dp0/".trim(ProcessExecutor::escape($binPath), '"\'')."\r\n".
- "SET COMPOSER_RUNTIME_BIN_DIR=%~dp0\r\n".
- "{$caller} \"%BIN_TARGET%\" %*\r\n";
- }
- protected function generateUnixyProxyCode(string $bin, string $link): string
- {
- $binPath = $this->filesystem->findShortestPath($link, $bin);
- $binDir = ProcessExecutor::escape(dirname($binPath));
- $binFile = basename($binPath);
- $binContents = file_get_contents($bin);
- if (Preg::isMatch('{^(#!.*\r?\n)?[\r\n\t ]*<\?php}', $binContents, $match)) {
- $proxyCode = empty($match[1]) ? '#!/usr/bin/env php' : trim($match[1]);
- $binPathExported = $this->filesystem->findShortestPathCode($link, $bin, false, true);
- $streamProxyCode = $streamHint = '';
- $globalsCode = '$GLOBALS[\'_composer_bin_dir\'] = __DIR__;'."\n";
- $phpunitHack1 = $phpunitHack2 = '';
- if ($this->vendorDir) {
- $globalsCode .= '$GLOBALS[\'_composer_autoload_path\'] = ' . $this->filesystem->findShortestPathCode($link, $this->vendorDir . '/autoload.php', false, true).";\n";
- }
- if ($this->filesystem->normalizePath($bin) === $this->filesystem->normalizePath($this->vendorDir.'/phpunit/phpunit/phpunit')) {
- $globalsCode .= '$GLOBALS[\'__PHPUNIT_ISOLATION_EXCLUDE_LIST\'] = $GLOBALS[\'__PHPUNIT_ISOLATION_BLACKLIST\'] = array(realpath('.$binPathExported.'));'."\n";
- $phpunitHack1 = "'phpvfscomposer://'.";
- $phpunitHack2 = '
- $data = str_replace(\'__DIR__\', var_export(dirname($this->realpath), true), $data);
- $data = str_replace(\'__FILE__\', var_export($this->realpath, true), $data);';
- }
- if (trim($match[0]) !== '<?php') {
- $streamHint = ' using a stream wrapper to prevent the shebang from being output on PHP<8'."\n *";
- $streamProxyCode = <<<STREAMPROXY
- if (PHP_VERSION_ID < 80000) {
- if (!class_exists('Composer\BinProxyWrapper')) {
- /**
- * @internal
- */
- final class BinProxyWrapper
- {
- private \$handle;
- private \$position;
- private \$realpath;
- public function stream_open(\$path, \$mode, \$options, &\$opened_path)
- {
- // get rid of phpvfscomposer:// prefix for __FILE__ & __DIR__ resolution
- \$opened_path = substr(\$path, 17);
- \$this->realpath = realpath(\$opened_path) ?: \$opened_path;
- \$opened_path = $phpunitHack1\$this->realpath;
- \$this->handle = fopen(\$this->realpath, \$mode);
- \$this->position = 0;
- return (bool) \$this->handle;
- }
- public function stream_read(\$count)
- {
- \$data = fread(\$this->handle, \$count);
- if (\$this->position === 0) {
- \$data = preg_replace('{^#!.*\\r?\\n}', '', \$data);
- }$phpunitHack2
- \$this->position += strlen(\$data);
- return \$data;
- }
- public function stream_cast(\$castAs)
- {
- return \$this->handle;
- }
- public function stream_close()
- {
- fclose(\$this->handle);
- }
- public function stream_lock(\$operation)
- {
- return \$operation ? flock(\$this->handle, \$operation) : true;
- }
- public function stream_seek(\$offset, \$whence)
- {
- if (0 === fseek(\$this->handle, \$offset, \$whence)) {
- \$this->position = ftell(\$this->handle);
- return true;
- }
- return false;
- }
- public function stream_tell()
- {
- return \$this->position;
- }
- public function stream_eof()
- {
- return feof(\$this->handle);
- }
- public function stream_stat()
- {
- return array();
- }
- public function stream_set_option(\$option, \$arg1, \$arg2)
- {
- return true;
- }
- public function url_stat(\$path, \$flags)
- {
- \$path = substr(\$path, 17);
- if (file_exists(\$path)) {
- return stat(\$path);
- }
- return false;
- }
- }
- }
- if (
- (function_exists('stream_get_wrappers') && in_array('phpvfscomposer', stream_get_wrappers(), true))
- || (function_exists('stream_wrapper_register') && stream_wrapper_register('phpvfscomposer', 'Composer\BinProxyWrapper'))
- ) {
- include("phpvfscomposer://" . $binPathExported);
- exit(0);
- }
- }
- STREAMPROXY;
- }
- return $proxyCode . "\n" . <<<PROXY
- <?php
- /**
- * Proxy PHP file generated by Composer
- *
- * This file includes the referenced bin path ($binPath)
- *$streamHint
- * @generated
- */
- namespace Composer;
- $globalsCode
- $streamProxyCode
- include $binPathExported;
- PROXY;
- }
- return <<<PROXY
- #!/usr/bin/env sh
- # Support bash to support `source` with fallback on $0 if this does not run with bash
- # https://stackoverflow.com/a/35006505/6512
- selfArg="\$BASH_SOURCE"
- if [ -z "\$selfArg" ]; then
- selfArg="\$0"
- fi
- self=\$(realpath \$selfArg 2> /dev/null)
- if [ -z "\$self" ]; then
- self="\$selfArg"
- fi
- dir=\$(cd "\${self%[/\\\\]*}" > /dev/null; cd $binDir && pwd)
- if [ -d /proc/cygdrive ]; then
- case \$(which php) in
- \$(readlink -n /proc/cygdrive)/*)
- # We are in Cygwin using Windows php, so the path must be translated
- dir=\$(cygpath -m "\$dir");
- ;;
- esac
- fi
- export COMPOSER_RUNTIME_BIN_DIR="\$(cd "\${self%[/\\\\]*}" > /dev/null; pwd)"
- # If bash is sourcing this file, we have to source the target as well
- bashSource="\$BASH_SOURCE"
- if [ -n "\$bashSource" ]; then
- if [ "\$bashSource" != "\$0" ]; then
- source "\${dir}/$binFile" "\$@"
- return
- fi
- fi
- "\${dir}/$binFile" "\$@"
- PROXY;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Installer;
- use Composer\Package\PackageInterface;
- interface BinaryPresenceInterface
- {
- public function ensureBinariesPresence(PackageInterface $package);
- }
- <?php declare(strict_types=1);
- namespace Composer\Installer;
- use Composer\IO\IOInterface;
- use Composer\IO\ConsoleIO;
- use Composer\Package\PackageInterface;
- use Composer\Package\AliasPackage;
- use Composer\Repository\InstalledRepositoryInterface;
- use Composer\DependencyResolver\Operation\OperationInterface;
- use Composer\DependencyResolver\Operation\InstallOperation;
- use Composer\DependencyResolver\Operation\UpdateOperation;
- use Composer\DependencyResolver\Operation\UninstallOperation;
- use Composer\DependencyResolver\Operation\MarkAliasInstalledOperation;
- use Composer\DependencyResolver\Operation\MarkAliasUninstalledOperation;
- use Composer\Downloader\FileDownloader;
- use Composer\EventDispatcher\EventDispatcher;
- use Composer\Util\Loop;
- use Composer\Util\Platform;
- use React\Promise\PromiseInterface;
- use Seld\Signal\SignalHandler;
- class InstallationManager
- {
- private $installers = [];
- private $cache = [];
- private $notifiablePackages = [];
- private $loop;
- private $io;
- private $eventDispatcher;
- private $outputProgress;
- public function __construct(Loop $loop, IOInterface $io, ?EventDispatcher $eventDispatcher = null)
- {
- $this->loop = $loop;
- $this->io = $io;
- $this->eventDispatcher = $eventDispatcher;
- }
- public function reset(): void
- {
- $this->notifiablePackages = [];
- FileDownloader::$downloadMetadata = [];
- }
- public function addInstaller(InstallerInterface $installer): void
- {
- array_unshift($this->installers, $installer);
- $this->cache = [];
- }
- public function removeInstaller(InstallerInterface $installer): void
- {
- if (false !== ($key = array_search($installer, $this->installers, true))) {
- array_splice($this->installers, $key, 1);
- $this->cache = [];
- }
- }
- public function disablePlugins(): void
- {
- foreach ($this->installers as $i => $installer) {
- if (!$installer instanceof PluginInstaller) {
- continue;
- }
- unset($this->installers[$i]);
- }
- }
- public function getInstaller(string $type): InstallerInterface
- {
- $type = strtolower($type);
- if (isset($this->cache[$type])) {
- return $this->cache[$type];
- }
- foreach ($this->installers as $installer) {
- if ($installer->supports($type)) {
- return $this->cache[$type] = $installer;
- }
- }
- throw new \InvalidArgumentException('Unknown installer type: '.$type);
- }
- public function isPackageInstalled(InstalledRepositoryInterface $repo, PackageInterface $package): bool
- {
- if ($package instanceof AliasPackage) {
- return $repo->hasPackage($package) && $this->isPackageInstalled($repo, $package->getAliasOf());
- }
- return $this->getInstaller($package->getType())->isInstalled($repo, $package);
- }
- public function ensureBinariesPresence(PackageInterface $package): void
- {
- try {
- $installer = $this->getInstaller($package->getType());
- } catch (\InvalidArgumentException $e) {
- return;
- }
- if ($installer instanceof BinaryPresenceInterface) {
- $installer->ensureBinariesPresence($package);
- }
- }
- public function execute(InstalledRepositoryInterface $repo, array $operations, bool $devMode = true, bool $runScripts = true): void
- {
- $cleanupPromises = [];
- $loop = $this->loop;
- $io = $this->io;
- $runCleanup = static function () use (&$cleanupPromises, $loop): void {
- $promises = [];
- $loop->abortJobs();
- foreach ($cleanupPromises as $cleanup) {
- $promises[] = new \React\Promise\Promise(static function ($resolve, $reject) use ($cleanup): void {
- $promise = $cleanup();
- if (!$promise instanceof PromiseInterface) {
- $resolve();
- } else {
- $promise->then(static function () use ($resolve): void {
- $resolve();
- });
- }
- });
- }
- if (!empty($promises)) {
- $loop->wait($promises);
- }
- };
- $signalHandler = SignalHandler::create([SignalHandler::SIGINT, SignalHandler::SIGTERM, SignalHandler::SIGHUP], static function (string $signal, SignalHandler $handler) use ($io, $runCleanup) {
- $io->writeError('Received '.$signal.', aborting', true, IOInterface::DEBUG);
- $runCleanup();
- $handler->exitWithLastSignal();
- });
- try {
- $batches = [];
- $batch = [];
- foreach ($operations as $index => $operation) {
- if ($operation instanceof UpdateOperation || $operation instanceof InstallOperation) {
- $package = $operation instanceof UpdateOperation ? $operation->getTargetPackage() : $operation->getPackage();
- if ($package->getType() === 'composer-plugin' && ($extra = $package->getExtra()) && isset($extra['plugin-modifies-downloads']) && $extra['plugin-modifies-downloads'] === true) {
- if ($batch) {
- $batches[] = $batch;
- }
- $batches[] = [$index => $operation];
- $batch = [];
- continue;
- }
- }
- $batch[$index] = $operation;
- }
- if ($batch) {
- $batches[] = $batch;
- }
- foreach ($batches as $batch) {
- $this->downloadAndExecuteBatch($repo, $batch, $cleanupPromises, $devMode, $runScripts, $operations);
- }
- } catch (\Exception $e) {
- $runCleanup();
- throw $e;
- } finally {
- $signalHandler->unregister();
- }
- $repo->write($devMode, $this);
- }
- private function downloadAndExecuteBatch(InstalledRepositoryInterface $repo, array $operations, array &$cleanupPromises, bool $devMode, bool $runScripts, array $allOperations): void
- {
- $promises = [];
- foreach ($operations as $index => $operation) {
- $opType = $operation->getOperationType();
- if (!in_array($opType, ['update', 'install', 'uninstall'])) {
- continue;
- }
- if ($opType === 'update') {
- $package = $operation->getTargetPackage();
- $initialPackage = $operation->getInitialPackage();
- } else {
- $package = $operation->getPackage();
- $initialPackage = null;
- }
- $installer = $this->getInstaller($package->getType());
- $cleanupPromises[$index] = static function () use ($opType, $installer, $package, $initialPackage) {
- if (!$package->getInstallationSource()) {
- return;
- }
- return $installer->cleanup($opType, $package, $initialPackage);
- };
- if ($opType !== 'uninstall') {
- $promise = $installer->download($package, $initialPackage);
- if ($promise) {
- $promises[] = $promise;
- }
- }
- }
- if (count($promises)) {
- $this->waitOnPromises($promises);
- }
- $batches = [];
- $batch = [];
- foreach ($operations as $index => $operation) {
- if ($operation instanceof InstallOperation || $operation instanceof UpdateOperation) {
- $package = $operation instanceof UpdateOperation ? $operation->getTargetPackage() : $operation->getPackage();
- if ($package->getType() === 'composer-plugin' || $package->getType() === 'composer-installer') {
- if ($batch) {
- $batches[] = $batch;
- }
- $batches[] = [$index => $operation];
- $batch = [];
- continue;
- }
- }
- $batch[$index] = $operation;
- }
- if ($batch) {
- $batches[] = $batch;
- }
- foreach ($batches as $batch) {
- $this->executeBatch($repo, $batch, $cleanupPromises, $devMode, $runScripts, $allOperations);
- }
- }
- private function executeBatch(InstalledRepositoryInterface $repo, array $operations, array $cleanupPromises, bool $devMode, bool $runScripts, array $allOperations): void
- {
- $promises = [];
- $postExecCallbacks = [];
- foreach ($operations as $index => $operation) {
- $opType = $operation->getOperationType();
- if (!in_array($opType, ['update', 'install', 'uninstall'])) {
- if ($this->io->isDebug()) {
- $this->io->writeError(' - ' . $operation->show(false));
- }
- $this->{$opType}($repo, $operation);
- continue;
- }
- if ($opType === 'update') {
- $package = $operation->getTargetPackage();
- $initialPackage = $operation->getInitialPackage();
- } else {
- $package = $operation->getPackage();
- $initialPackage = null;
- }
- $installer = $this->getInstaller($package->getType());
- $eventName = [
- 'install' => PackageEvents::PRE_PACKAGE_INSTALL,
- 'update' => PackageEvents::PRE_PACKAGE_UPDATE,
- 'uninstall' => PackageEvents::PRE_PACKAGE_UNINSTALL,
- ][$opType] ?? null;
- if (null !== $eventName && $runScripts && $this->eventDispatcher) {
- $this->eventDispatcher->dispatchPackageEvent($eventName, $devMode, $repo, $allOperations, $operation);
- }
- $dispatcher = $this->eventDispatcher;
- $io = $this->io;
- $promise = $installer->prepare($opType, $package, $initialPackage);
- if (!$promise instanceof PromiseInterface) {
- $promise = \React\Promise\resolve(null);
- }
- $promise = $promise->then(function () use ($opType, $repo, $operation) {
- return $this->{$opType}($repo, $operation);
- })->then($cleanupPromises[$index])
- ->then(function () use ($devMode, $repo): void {
- $repo->write($devMode, $this);
- }, static function ($e) use ($opType, $package, $io): void {
- $io->writeError(' <error>' . ucfirst($opType) .' of '.$package->getPrettyName().' failed</error>');
- throw $e;
- });
- $eventName = [
- 'install' => PackageEvents::POST_PACKAGE_INSTALL,
- 'update' => PackageEvents::POST_PACKAGE_UPDATE,
- 'uninstall' => PackageEvents::POST_PACKAGE_UNINSTALL,
- ][$opType] ?? null;
- if (null !== $eventName && $runScripts && $dispatcher) {
- $postExecCallbacks[] = static function () use ($dispatcher, $eventName, $devMode, $repo, $allOperations, $operation): void {
- $dispatcher->dispatchPackageEvent($eventName, $devMode, $repo, $allOperations, $operation);
- };
- }
- $promises[] = $promise;
- }
- if (count($promises)) {
- $this->waitOnPromises($promises);
- }
- Platform::workaroundFilesystemIssues();
- foreach ($postExecCallbacks as $cb) {
- $cb();
- }
- }
- private function waitOnPromises(array $promises): void
- {
- $progress = null;
- if (
- $this->outputProgress
- && $this->io instanceof ConsoleIO
- && !Platform::getEnv('CI')
- && !$this->io->isDebug()
- && count($promises) > 1
- ) {
- $progress = $this->io->getProgressBar();
- }
- $this->loop->wait($promises, $progress);
- if ($progress) {
- $progress->clear();
- if (!$this->io->isDecorated()) {
- $this->io->writeError('');
- }
- }
- }
- public function install(InstalledRepositoryInterface $repo, InstallOperation $operation): ?PromiseInterface
- {
- $package = $operation->getPackage();
- $installer = $this->getInstaller($package->getType());
- $promise = $installer->install($repo, $package);
- $this->markForNotification($package);
- return $promise;
- }
- public function update(InstalledRepositoryInterface $repo, UpdateOperation $operation): ?PromiseInterface
- {
- $initial = $operation->getInitialPackage();
- $target = $operation->getTargetPackage();
- $initialType = $initial->getType();
- $targetType = $target->getType();
- if ($initialType === $targetType) {
- $installer = $this->getInstaller($initialType);
- $promise = $installer->update($repo, $initial, $target);
- $this->markForNotification($target);
- } else {
- $promise = $this->getInstaller($initialType)->uninstall($repo, $initial);
- if (!$promise instanceof PromiseInterface) {
- $promise = \React\Promise\resolve(null);
- }
- $installer = $this->getInstaller($targetType);
- $promise = $promise->then(static function () use ($installer, $repo, $target): PromiseInterface {
- $promise = $installer->install($repo, $target);
- if ($promise instanceof PromiseInterface) {
- return $promise;
- }
- return \React\Promise\resolve(null);
- });
- }
- return $promise;
- }
- public function uninstall(InstalledRepositoryInterface $repo, UninstallOperation $operation): ?PromiseInterface
- {
- $package = $operation->getPackage();
- $installer = $this->getInstaller($package->getType());
- return $installer->uninstall($repo, $package);
- }
- public function markAliasInstalled(InstalledRepositoryInterface $repo, MarkAliasInstalledOperation $operation): void
- {
- $package = $operation->getPackage();
- if (!$repo->hasPackage($package)) {
- $repo->addPackage(clone $package);
- }
- }
- public function markAliasUninstalled(InstalledRepositoryInterface $repo, MarkAliasUninstalledOperation $operation): void
- {
- $package = $operation->getPackage();
- $repo->removePackage($package);
- }
- public function getInstallPath(PackageInterface $package): string
- {
- $installer = $this->getInstaller($package->getType());
- return $installer->getInstallPath($package);
- }
- public function setOutputProgress(bool $outputProgress): void
- {
- $this->outputProgress = $outputProgress;
- }
- public function notifyInstalls(IOInterface $io): void
- {
- $promises = [];
- try {
- foreach ($this->notifiablePackages as $repoUrl => $packages) {
- if (strpos($repoUrl, '%package%')) {
- foreach ($packages as $package) {
- $url = str_replace('%package%', $package->getPrettyName(), $repoUrl);
- $params = [
- 'version' => $package->getPrettyVersion(),
- 'version_normalized' => $package->getVersion(),
- ];
- $opts = [
- 'retry-auth-failure' => false,
- 'http' => [
- 'method' => 'POST',
- 'header' => ['Content-type: application/x-www-form-urlencoded'],
- 'content' => http_build_query($params, '', '&'),
- 'timeout' => 3,
- ],
- ];
- $promises[] = $this->loop->getHttpDownloader()->add($url, $opts);
- }
- continue;
- }
- $postData = ['downloads' => []];
- foreach ($packages as $package) {
- $packageNotification = [
- 'name' => $package->getPrettyName(),
- 'version' => $package->getVersion(),
- ];
- if (strpos($repoUrl, 'packagist.org/') !== false) {
- if (isset(FileDownloader::$downloadMetadata[$package->getName()])) {
- $packageNotification['downloaded'] = FileDownloader::$downloadMetadata[$package->getName()];
- } else {
- $packageNotification['downloaded'] = false;
- }
- }
- $postData['downloads'][] = $packageNotification;
- }
- $opts = [
- 'retry-auth-failure' => false,
- 'http' => [
- 'method' => 'POST',
- 'header' => ['Content-Type: application/json'],
- 'content' => json_encode($postData),
- 'timeout' => 6,
- ],
- ];
- $promises[] = $this->loop->getHttpDownloader()->add($repoUrl, $opts);
- }
- $this->loop->wait($promises);
- } catch (\Exception $e) {
- }
- $this->reset();
- }
- private function markForNotification(PackageInterface $package): void
- {
- if ($package->getNotificationUrl()) {
- $this->notifiablePackages[$package->getNotificationUrl()][$package->getName()] = $package;
- }
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Installer;
- use Composer\Composer;
- use Composer\DependencyResolver\Transaction;
- use Composer\EventDispatcher\Event;
- use Composer\IO\IOInterface;
- class InstallerEvent extends Event
- {
- private $composer;
- private $io;
- private $devMode;
- private $executeOperations;
- private $transaction;
- public function __construct(string $eventName, Composer $composer, IOInterface $io, bool $devMode, bool $executeOperations, Transaction $transaction)
- {
- parent::__construct($eventName);
- $this->composer = $composer;
- $this->io = $io;
- $this->devMode = $devMode;
- $this->executeOperations = $executeOperations;
- $this->transaction = $transaction;
- }
- public function getComposer(): Composer
- {
- return $this->composer;
- }
- public function getIO(): IOInterface
- {
- return $this->io;
- }
- public function isDevMode(): bool
- {
- return $this->devMode;
- }
- public function isExecutingOperations(): bool
- {
- return $this->executeOperations;
- }
- public function getTransaction(): ?Transaction
- {
- return $this->transaction;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Installer;
- class InstallerEvents
- {
- public const PRE_OPERATIONS_EXEC = 'pre-operations-exec';
- }
- <?php declare(strict_types=1);
- namespace Composer\Installer;
- use Composer\Package\PackageInterface;
- use Composer\Repository\InstalledRepositoryInterface;
- use InvalidArgumentException;
- use React\Promise\PromiseInterface;
- interface InstallerInterface
- {
- public function supports(string $packageType);
- public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package);
- public function download(PackageInterface $package, ?PackageInterface $prevPackage = null);
- public function prepare(string $type, PackageInterface $package, ?PackageInterface $prevPackage = null);
- public function install(InstalledRepositoryInterface $repo, PackageInterface $package);
- public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target);
- public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package);
- public function cleanup(string $type, PackageInterface $package, ?PackageInterface $prevPackage = null);
- public function getInstallPath(PackageInterface $package);
- }
- <?php declare(strict_types=1);
- namespace Composer\Installer;
- use Composer\Composer;
- use Composer\IO\IOInterface;
- use Composer\PartialComposer;
- use Composer\Pcre\Preg;
- use Composer\Repository\InstalledRepositoryInterface;
- use Composer\Package\PackageInterface;
- use Composer\Util\Filesystem;
- use Composer\Util\Silencer;
- use Composer\Util\Platform;
- use React\Promise\PromiseInterface;
- use Composer\Downloader\DownloadManager;
- class LibraryInstaller implements InstallerInterface, BinaryPresenceInterface
- {
- protected $composer;
- protected $vendorDir;
- protected $downloadManager;
- protected $io;
- protected $type;
- protected $filesystem;
- protected $binaryInstaller;
- public function __construct(IOInterface $io, PartialComposer $composer, ?string $type = 'library', ?Filesystem $filesystem = null, ?BinaryInstaller $binaryInstaller = null)
- {
- $this->composer = $composer;
- $this->downloadManager = $composer instanceof Composer ? $composer->getDownloadManager() : null;
- $this->io = $io;
- $this->type = $type;
- $this->filesystem = $filesystem ?: new Filesystem();
- $this->vendorDir = rtrim($composer->getConfig()->get('vendor-dir'), '/');
- $this->binaryInstaller = $binaryInstaller ?: new BinaryInstaller($this->io, rtrim($composer->getConfig()->get('bin-dir'), '/'), $composer->getConfig()->get('bin-compat'), $this->filesystem, $this->vendorDir);
- }
- public function supports(string $packageType)
- {
- return $packageType === $this->type || null === $this->type;
- }
- public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
- {
- if (!$repo->hasPackage($package)) {
- return false;
- }
- $installPath = $this->getInstallPath($package);
- if (Filesystem::isReadable($installPath)) {
- return true;
- }
- if (Platform::isWindows() && $this->filesystem->isJunction($installPath)) {
- return true;
- }
- if (is_link($installPath)) {
- if (realpath($installPath) === false) {
- return false;
- }
- return true;
- }
- return false;
- }
- public function download(PackageInterface $package, ?PackageInterface $prevPackage = null)
- {
- $this->initializeVendorDir();
- $downloadPath = $this->getInstallPath($package);
- return $this->getDownloadManager()->download($package, $downloadPath, $prevPackage);
- }
- public function prepare($type, PackageInterface $package, ?PackageInterface $prevPackage = null)
- {
- $this->initializeVendorDir();
- $downloadPath = $this->getInstallPath($package);
- return $this->getDownloadManager()->prepare($type, $package, $downloadPath, $prevPackage);
- }
- public function cleanup($type, PackageInterface $package, ?PackageInterface $prevPackage = null)
- {
- $this->initializeVendorDir();
- $downloadPath = $this->getInstallPath($package);
- return $this->getDownloadManager()->cleanup($type, $package, $downloadPath, $prevPackage);
- }
- public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
- {
- $this->initializeVendorDir();
- $downloadPath = $this->getInstallPath($package);
- if (!Filesystem::isReadable($downloadPath) && $repo->hasPackage($package)) {
- $this->binaryInstaller->removeBinaries($package);
- }
- $promise = $this->installCode($package);
- if (!$promise instanceof PromiseInterface) {
- $promise = \React\Promise\resolve(null);
- }
- $binaryInstaller = $this->binaryInstaller;
- $installPath = $this->getInstallPath($package);
- return $promise->then(static function () use ($binaryInstaller, $installPath, $package, $repo): void {
- $binaryInstaller->installBinaries($package, $installPath);
- if (!$repo->hasPackage($package)) {
- $repo->addPackage(clone $package);
- }
- });
- }
- public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
- {
- if (!$repo->hasPackage($initial)) {
- throw new \InvalidArgumentException('Package is not installed: '.$initial);
- }
- $this->initializeVendorDir();
- $this->binaryInstaller->removeBinaries($initial);
- $promise = $this->updateCode($initial, $target);
- if (!$promise instanceof PromiseInterface) {
- $promise = \React\Promise\resolve(null);
- }
- $binaryInstaller = $this->binaryInstaller;
- $installPath = $this->getInstallPath($target);
- return $promise->then(static function () use ($binaryInstaller, $installPath, $target, $initial, $repo): void {
- $binaryInstaller->installBinaries($target, $installPath);
- $repo->removePackage($initial);
- if (!$repo->hasPackage($target)) {
- $repo->addPackage(clone $target);
- }
- });
- }
- public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
- {
- if (!$repo->hasPackage($package)) {
- throw new \InvalidArgumentException('Package is not installed: '.$package);
- }
- $promise = $this->removeCode($package);
- if (!$promise instanceof PromiseInterface) {
- $promise = \React\Promise\resolve(null);
- }
- $binaryInstaller = $this->binaryInstaller;
- $downloadPath = $this->getPackageBasePath($package);
- $filesystem = $this->filesystem;
- return $promise->then(static function () use ($binaryInstaller, $filesystem, $downloadPath, $package, $repo): void {
- $binaryInstaller->removeBinaries($package);
- $repo->removePackage($package);
- if (strpos($package->getName(), '/')) {
- $packageVendorDir = dirname($downloadPath);
- if (is_dir($packageVendorDir) && $filesystem->isDirEmpty($packageVendorDir)) {
- Silencer::call('rmdir', $packageVendorDir);
- }
- }
- });
- }
- public function getInstallPath(PackageInterface $package)
- {
- $this->initializeVendorDir();
- $basePath = ($this->vendorDir ? $this->vendorDir.'/' : '') . $package->getPrettyName();
- $targetDir = $package->getTargetDir();
- return $basePath . ($targetDir ? '/'.$targetDir : '');
- }
- public function ensureBinariesPresence(PackageInterface $package)
- {
- $this->binaryInstaller->installBinaries($package, $this->getInstallPath($package), false);
- }
- protected function getPackageBasePath(PackageInterface $package)
- {
- $installPath = $this->getInstallPath($package);
- $targetDir = $package->getTargetDir();
- if ($targetDir) {
- return Preg::replace('{/*'.str_replace('/', '/+', preg_quote($targetDir)).'/?$}', '', $installPath);
- }
- return $installPath;
- }
- protected function installCode(PackageInterface $package)
- {
- $downloadPath = $this->getInstallPath($package);
- return $this->getDownloadManager()->install($package, $downloadPath);
- }
- protected function updateCode(PackageInterface $initial, PackageInterface $target)
- {
- $initialDownloadPath = $this->getInstallPath($initial);
- $targetDownloadPath = $this->getInstallPath($target);
- if ($targetDownloadPath !== $initialDownloadPath) {
- if (strpos($initialDownloadPath, $targetDownloadPath) === 0
- || strpos($targetDownloadPath, $initialDownloadPath) === 0
- ) {
- $promise = $this->removeCode($initial);
- if (!$promise instanceof PromiseInterface) {
- $promise = \React\Promise\resolve(null);
- }
- return $promise->then(function () use ($target): PromiseInterface {
- $promise = $this->installCode($target);
- if ($promise instanceof PromiseInterface) {
- return $promise;
- }
- return \React\Promise\resolve(null);
- });
- }
- $this->filesystem->rename($initialDownloadPath, $targetDownloadPath);
- }
- return $this->getDownloadManager()->update($initial, $target, $targetDownloadPath);
- }
- protected function removeCode(PackageInterface $package)
- {
- $downloadPath = $this->getPackageBasePath($package);
- return $this->getDownloadManager()->remove($package, $downloadPath);
- }
- protected function initializeVendorDir()
- {
- $this->filesystem->ensureDirectoryExists($this->vendorDir);
- $this->vendorDir = realpath($this->vendorDir);
- }
- protected function getDownloadManager(): DownloadManager
- {
- assert($this->downloadManager instanceof DownloadManager, new \LogicException(self::class.' should be initialized with a fully loaded Composer instance to be able to install/... packages'));
- return $this->downloadManager;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Installer;
- use Composer\Repository\InstalledRepositoryInterface;
- use Composer\Package\PackageInterface;
- use Composer\IO\IOInterface;
- use Composer\DependencyResolver\Operation\UpdateOperation;
- use Composer\DependencyResolver\Operation\InstallOperation;
- use Composer\DependencyResolver\Operation\UninstallOperation;
- class MetapackageInstaller implements InstallerInterface
- {
- private $io;
- public function __construct(IOInterface $io)
- {
- $this->io = $io;
- }
- public function supports(string $packageType)
- {
- return $packageType === 'metapackage';
- }
- public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
- {
- return $repo->hasPackage($package);
- }
- public function download(PackageInterface $package, ?PackageInterface $prevPackage = null)
- {
- return \React\Promise\resolve(null);
- }
- public function prepare($type, PackageInterface $package, ?PackageInterface $prevPackage = null)
- {
- return \React\Promise\resolve(null);
- }
- public function cleanup($type, PackageInterface $package, ?PackageInterface $prevPackage = null)
- {
- return \React\Promise\resolve(null);
- }
- public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
- {
- $this->io->writeError(" - " . InstallOperation::format($package));
- $repo->addPackage(clone $package);
- return \React\Promise\resolve(null);
- }
- public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
- {
- if (!$repo->hasPackage($initial)) {
- throw new \InvalidArgumentException('Package is not installed: '.$initial);
- }
- $this->io->writeError(" - " . UpdateOperation::format($initial, $target));
- $repo->removePackage($initial);
- $repo->addPackage(clone $target);
- return \React\Promise\resolve(null);
- }
- public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
- {
- if (!$repo->hasPackage($package)) {
- throw new \InvalidArgumentException('Package is not installed: '.$package);
- }
- $this->io->writeError(" - " . UninstallOperation::format($package));
- $repo->removePackage($package);
- return \React\Promise\resolve(null);
- }
- public function getInstallPath(PackageInterface $package)
- {
- return '';
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Installer;
- use Composer\Repository\InstalledRepositoryInterface;
- use Composer\Package\PackageInterface;
- class NoopInstaller implements InstallerInterface
- {
- public function supports(string $packageType)
- {
- return true;
- }
- public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
- {
- return $repo->hasPackage($package);
- }
- public function download(PackageInterface $package, ?PackageInterface $prevPackage = null)
- {
- return \React\Promise\resolve(null);
- }
- public function prepare($type, PackageInterface $package, ?PackageInterface $prevPackage = null)
- {
- return \React\Promise\resolve(null);
- }
- public function cleanup($type, PackageInterface $package, ?PackageInterface $prevPackage = null)
- {
- return \React\Promise\resolve(null);
- }
- public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
- {
- if (!$repo->hasPackage($package)) {
- $repo->addPackage(clone $package);
- }
- return \React\Promise\resolve(null);
- }
- public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
- {
- if (!$repo->hasPackage($initial)) {
- throw new \InvalidArgumentException('Package is not installed: '.$initial);
- }
- $repo->removePackage($initial);
- if (!$repo->hasPackage($target)) {
- $repo->addPackage(clone $target);
- }
- return \React\Promise\resolve(null);
- }
- public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
- {
- if (!$repo->hasPackage($package)) {
- throw new \InvalidArgumentException('Package is not installed: '.$package);
- }
- $repo->removePackage($package);
- return \React\Promise\resolve(null);
- }
- public function getInstallPath(PackageInterface $package)
- {
- $targetDir = $package->getTargetDir();
- return $package->getPrettyName() . ($targetDir ? '/'.$targetDir : '');
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Installer;
- use Composer\Composer;
- use Composer\IO\IOInterface;
- use Composer\DependencyResolver\Operation\OperationInterface;
- use Composer\Repository\RepositoryInterface;
- use Composer\EventDispatcher\Event;
- class PackageEvent extends Event
- {
- private $composer;
- private $io;
- private $devMode;
- private $localRepo;
- private $operations;
- private $operation;
- public function __construct(string $eventName, Composer $composer, IOInterface $io, bool $devMode, RepositoryInterface $localRepo, array $operations, OperationInterface $operation)
- {
- parent::__construct($eventName);
- $this->composer = $composer;
- $this->io = $io;
- $this->devMode = $devMode;
- $this->localRepo = $localRepo;
- $this->operations = $operations;
- $this->operation = $operation;
- }
- public function getComposer(): Composer
- {
- return $this->composer;
- }
- public function getIO(): IOInterface
- {
- return $this->io;
- }
- public function isDevMode(): bool
- {
- return $this->devMode;
- }
- public function getLocalRepo(): RepositoryInterface
- {
- return $this->localRepo;
- }
- public function getOperations(): array
- {
- return $this->operations;
- }
- public function getOperation(): OperationInterface
- {
- return $this->operation;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Installer;
- class PackageEvents
- {
- public const PRE_PACKAGE_INSTALL = 'pre-package-install';
- public const POST_PACKAGE_INSTALL = 'post-package-install';
- public const PRE_PACKAGE_UPDATE = 'pre-package-update';
- public const POST_PACKAGE_UPDATE = 'post-package-update';
- public const PRE_PACKAGE_UNINSTALL = 'pre-package-uninstall';
- public const POST_PACKAGE_UNINSTALL = 'post-package-uninstall';
- }
- <?php declare(strict_types=1);
- namespace Composer\Installer;
- use Composer\Composer;
- use Composer\IO\IOInterface;
- use Composer\PartialComposer;
- use Composer\Repository\InstalledRepositoryInterface;
- use Composer\Package\PackageInterface;
- use Composer\Plugin\PluginManager;
- use Composer\Util\Filesystem;
- use Composer\Util\Platform;
- use React\Promise\PromiseInterface;
- class PluginInstaller extends LibraryInstaller
- {
- public function __construct(IOInterface $io, PartialComposer $composer, ?Filesystem $fs = null, ?BinaryInstaller $binaryInstaller = null)
- {
- parent::__construct($io, $composer, 'composer-plugin', $fs, $binaryInstaller);
- }
- public function supports(string $packageType)
- {
- return $packageType === 'composer-plugin' || $packageType === 'composer-installer';
- }
- public function prepare($type, PackageInterface $package, ?PackageInterface $prevPackage = null)
- {
- if (($type === 'install' || $type === 'update') && !$this->getPluginManager()->arePluginsDisabled('local')) {
- $this->getPluginManager()->isPluginAllowed($package->getName(), false);
- }
- return parent::prepare($type, $package, $prevPackage);
- }
- public function download(PackageInterface $package, ?PackageInterface $prevPackage = null)
- {
- $extra = $package->getExtra();
- if (empty($extra['class'])) {
- throw new \UnexpectedValueException('Error while installing '.$package->getPrettyName().', composer-plugin packages should have a class defined in their extra key to be usable.');
- }
- return parent::download($package, $prevPackage);
- }
- public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
- {
- $promise = parent::install($repo, $package);
- if (!$promise instanceof PromiseInterface) {
- $promise = \React\Promise\resolve(null);
- }
- return $promise->then(function () use ($package, $repo): void {
- try {
- Platform::workaroundFilesystemIssues();
- $this->getPluginManager()->registerPackage($package, true);
- } catch (\Exception $e) {
- $this->rollbackInstall($e, $repo, $package);
- }
- });
- }
- public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
- {
- $promise = parent::update($repo, $initial, $target);
- if (!$promise instanceof PromiseInterface) {
- $promise = \React\Promise\resolve(null);
- }
- return $promise->then(function () use ($initial, $target, $repo): void {
- try {
- Platform::workaroundFilesystemIssues();
- $this->getPluginManager()->deactivatePackage($initial);
- $this->getPluginManager()->registerPackage($target, true);
- } catch (\Exception $e) {
- $this->rollbackInstall($e, $repo, $target);
- }
- });
- }
- public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
- {
- $this->getPluginManager()->uninstallPackage($package);
- return parent::uninstall($repo, $package);
- }
- private function rollbackInstall(\Exception $e, InstalledRepositoryInterface $repo, PackageInterface $package): void
- {
- $this->io->writeError('Plugin initialization failed ('.$e->getMessage().'), uninstalling plugin');
- parent::uninstall($repo, $package);
- throw $e;
- }
- protected function getPluginManager(): PluginManager
- {
- assert($this->composer instanceof Composer, new \LogicException(self::class.' should be initialized with a fully loaded Composer instance.'));
- $pluginManager = $this->composer->getPluginManager();
- return $pluginManager;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Installer;
- use React\Promise\PromiseInterface;
- use Composer\Package\PackageInterface;
- use Composer\Downloader\DownloadManager;
- use Composer\Repository\InstalledRepositoryInterface;
- use Composer\Util\Filesystem;
- class ProjectInstaller implements InstallerInterface
- {
- private $installPath;
- private $downloadManager;
- private $filesystem;
- public function __construct(string $installPath, DownloadManager $dm, Filesystem $fs)
- {
- $this->installPath = rtrim(strtr($installPath, '\\', '/'), '/').'/';
- $this->downloadManager = $dm;
- $this->filesystem = $fs;
- }
- public function supports(string $packageType): bool
- {
- return true;
- }
- public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package): bool
- {
- return false;
- }
- public function download(PackageInterface $package, ?PackageInterface $prevPackage = null): ?PromiseInterface
- {
- $installPath = $this->installPath;
- if (file_exists($installPath) && !$this->filesystem->isDirEmpty($installPath)) {
- throw new \InvalidArgumentException("Project directory $installPath is not empty.");
- }
- if (!is_dir($installPath)) {
- mkdir($installPath, 0777, true);
- }
- return $this->downloadManager->download($package, $installPath, $prevPackage);
- }
- public function prepare($type, PackageInterface $package, ?PackageInterface $prevPackage = null): ?PromiseInterface
- {
- return $this->downloadManager->prepare($type, $package, $this->installPath, $prevPackage);
- }
- public function cleanup($type, PackageInterface $package, ?PackageInterface $prevPackage = null): ?PromiseInterface
- {
- return $this->downloadManager->cleanup($type, $package, $this->installPath, $prevPackage);
- }
- public function install(InstalledRepositoryInterface $repo, PackageInterface $package): ?PromiseInterface
- {
- return $this->downloadManager->install($package, $this->installPath);
- }
- public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target): ?PromiseInterface
- {
- throw new \InvalidArgumentException("not supported");
- }
- public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package): ?PromiseInterface
- {
- throw new \InvalidArgumentException("not supported");
- }
- public function getInstallPath(PackageInterface $package): string
- {
- return $this->installPath;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Installer;
- use Composer\IO\IOInterface;
- use Composer\Package\PackageInterface;
- use Composer\Pcre\Preg;
- use Composer\Repository\InstalledRepository;
- use Symfony\Component\Console\Formatter\OutputFormatter;
- class SuggestedPackagesReporter
- {
- public const MODE_LIST = 1;
- public const MODE_BY_PACKAGE = 2;
- public const MODE_BY_SUGGESTION = 4;
- protected $suggestedPackages = [];
- private $io;
- public function __construct(IOInterface $io)
- {
- $this->io = $io;
- }
- public function getPackages(): array
- {
- return $this->suggestedPackages;
- }
- public function addPackage(string $source, string $target, string $reason): SuggestedPackagesReporter
- {
- $this->suggestedPackages[] = [
- 'source' => $source,
- 'target' => $target,
- 'reason' => $reason,
- ];
- return $this;
- }
- public function addSuggestionsFromPackage(PackageInterface $package): SuggestedPackagesReporter
- {
- $source = $package->getPrettyName();
- foreach ($package->getSuggests() as $target => $reason) {
- $this->addPackage(
- $source,
- $target,
- $reason
- );
- }
- return $this;
- }
- public function output(int $mode, ?InstalledRepository $installedRepo = null, ?PackageInterface $onlyDependentsOf = null): void
- {
- $suggestedPackages = $this->getFilteredSuggestions($installedRepo, $onlyDependentsOf);
- $suggesters = [];
- $suggested = [];
- foreach ($suggestedPackages as $suggestion) {
- $suggesters[$suggestion['source']][$suggestion['target']] = $suggestion['reason'];
- $suggested[$suggestion['target']][$suggestion['source']] = $suggestion['reason'];
- }
- ksort($suggesters);
- ksort($suggested);
- if ($mode & self::MODE_LIST) {
- foreach (array_keys($suggested) as $name) {
- $this->io->write(sprintf('<info>%s</info>', $name));
- }
- return;
- }
- if ($mode & self::MODE_BY_PACKAGE) {
- foreach ($suggesters as $suggester => $suggestions) {
- $this->io->write(sprintf('<comment>%s</comment> suggests:', $suggester));
- foreach ($suggestions as $suggestion => $reason) {
- $this->io->write(sprintf(' - <info>%s</info>' . ($reason ? ': %s' : ''), $suggestion, $this->escapeOutput($reason)));
- }
- $this->io->write('');
- }
- }
- if ($mode & self::MODE_BY_SUGGESTION) {
- if ($mode & self::MODE_BY_PACKAGE) {
- $this->io->write(str_repeat('-', 78));
- }
- foreach ($suggested as $suggestion => $suggesters) {
- $this->io->write(sprintf('<comment>%s</comment> is suggested by:', $suggestion));
- foreach ($suggesters as $suggester => $reason) {
- $this->io->write(sprintf(' - <info>%s</info>' . ($reason ? ': %s' : ''), $suggester, $this->escapeOutput($reason)));
- }
- $this->io->write('');
- }
- }
- if ($onlyDependentsOf) {
- $allSuggestedPackages = $this->getFilteredSuggestions($installedRepo);
- $diff = count($allSuggestedPackages) - count($suggestedPackages);
- if ($diff) {
- $this->io->write('<info>'.$diff.' additional suggestions</info> by transitive dependencies can be shown with <info>--all</info>');
- }
- }
- }
- public function outputMinimalistic(?InstalledRepository $installedRepo = null, ?PackageInterface $onlyDependentsOf = null): void
- {
- $suggestedPackages = $this->getFilteredSuggestions($installedRepo, $onlyDependentsOf);
- if ($suggestedPackages) {
- $this->io->writeError('<info>'.count($suggestedPackages).' package suggestions were added by new dependencies, use `composer suggest` to see details.</info>');
- }
- }
- private function getFilteredSuggestions(?InstalledRepository $installedRepo = null, ?PackageInterface $onlyDependentsOf = null): array
- {
- $suggestedPackages = $this->getPackages();
- $installedNames = [];
- if (null !== $installedRepo && !empty($suggestedPackages)) {
- foreach ($installedRepo->getPackages() as $package) {
- $installedNames = array_merge(
- $installedNames,
- $package->getNames()
- );
- }
- }
- $sourceFilter = [];
- if ($onlyDependentsOf) {
- $sourceFilter = array_map(static function ($link): string {
- return $link->getTarget();
- }, array_merge($onlyDependentsOf->getRequires(), $onlyDependentsOf->getDevRequires()));
- $sourceFilter[] = $onlyDependentsOf->getName();
- }
- $suggestions = [];
- foreach ($suggestedPackages as $suggestion) {
- if (in_array($suggestion['target'], $installedNames) || ($sourceFilter && !in_array($suggestion['source'], $sourceFilter))) {
- continue;
- }
- $suggestions[] = $suggestion;
- }
- return $suggestions;
- }
- private function escapeOutput(string $string): string
- {
- return OutputFormatter::escape(
- $this->removeControlCharacters($string)
- );
- }
- private function removeControlCharacters(string $string): string
- {
- return Preg::replace(
- '/[[:cntrl:]]/',
- '',
- str_replace("\n", ' ', $string)
- );
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Json;
- use Composer\Pcre\Preg;
- use JsonSchema\Validator;
- use Seld\JsonLint\JsonParser;
- use Seld\JsonLint\ParsingException;
- use Composer\Util\HttpDownloader;
- use Composer\IO\IOInterface;
- use Composer\Downloader\TransportException;
- class JsonFile
- {
- public const LAX_SCHEMA = 1;
- public const STRICT_SCHEMA = 2;
- public const AUTH_SCHEMA = 3;
- public const JSON_UNESCAPED_SLASHES = 64;
- public const JSON_PRETTY_PRINT = 128;
- public const JSON_UNESCAPED_UNICODE = 256;
- public const COMPOSER_SCHEMA_PATH = __DIR__ . '/../../../res/composer-schema.json';
- private $path;
- private $httpDownloader;
- private $io;
- public function __construct(string $path, ?HttpDownloader $httpDownloader = null, ?IOInterface $io = null)
- {
- $this->path = $path;
- if (null === $httpDownloader && Preg::isMatch('{^https?://}i', $path)) {
- throw new \InvalidArgumentException('http urls require a HttpDownloader instance to be passed');
- }
- $this->httpDownloader = $httpDownloader;
- $this->io = $io;
- }
- public function getPath(): string
- {
- return $this->path;
- }
- public function exists(): bool
- {
- return is_file($this->path);
- }
- public function read()
- {
- try {
- if ($this->httpDownloader) {
- $json = $this->httpDownloader->get($this->path)->getBody();
- } else {
- if ($this->io && $this->io->isDebug()) {
- $realpathInfo = '';
- $realpath = realpath($this->path);
- if (false !== $realpath && $realpath !== $this->path) {
- $realpathInfo = ' (' . $realpath . ')';
- }
- $this->io->writeError('Reading ' . $this->path . $realpathInfo);
- }
- $json = file_get_contents($this->path);
- }
- } catch (TransportException $e) {
- throw new \RuntimeException($e->getMessage(), 0, $e);
- } catch (\Exception $e) {
- throw new \RuntimeException('Could not read '.$this->path."\n\n".$e->getMessage());
- }
- if ($json === false) {
- throw new \RuntimeException('Could not read '.$this->path);
- }
- return static::parseJson($json, $this->path);
- }
- public function write(array $hash, int $options = JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE)
- {
- if ($this->path === 'php://memory') {
- file_put_contents($this->path, static::encode($hash, $options));
- return;
- }
- $dir = dirname($this->path);
- if (!is_dir($dir)) {
- if (file_exists($dir)) {
- throw new \UnexpectedValueException(
- realpath($dir).' exists and is not a directory.'
- );
- }
- if (!@mkdir($dir, 0777, true)) {
- throw new \UnexpectedValueException(
- $dir.' does not exist and could not be created.'
- );
- }
- }
- $retries = 3;
- while ($retries--) {
- try {
- $this->filePutContentsIfModified($this->path, static::encode($hash, $options). ($options & JSON_PRETTY_PRINT ? "\n" : ''));
- break;
- } catch (\Exception $e) {
- if ($retries > 0) {
- usleep(500000);
- continue;
- }
- throw $e;
- }
- }
- }
- private function filePutContentsIfModified(string $path, string $content)
- {
- $currentContent = @file_get_contents($path);
- if (false === $currentContent || $currentContent !== $content) {
- return file_put_contents($path, $content);
- }
- return 0;
- }
- public function validateSchema(int $schema = self::STRICT_SCHEMA, ?string $schemaFile = null): bool
- {
- $content = file_get_contents($this->path);
- $data = json_decode($content);
- if (null === $data && 'null' !== $content) {
- self::validateSyntax($content, $this->path);
- }
- return self::validateJsonSchema($this->path, $data, $schema, $schemaFile);
- }
- public static function validateJsonSchema(string $source, $data, int $schema, ?string $schemaFile = null): bool
- {
- $isComposerSchemaFile = false;
- if (null === $schemaFile) {
- $isComposerSchemaFile = true;
- $schemaFile = self::COMPOSER_SCHEMA_PATH;
- }
- if (false === strpos($schemaFile, '://')) {
- $schemaFile = 'file://' . $schemaFile;
- }
- $schemaData = (object) ['$ref' => $schemaFile];
- if ($schema === self::LAX_SCHEMA) {
- $schemaData->additionalProperties = true;
- $schemaData->required = [];
- } elseif ($schema === self::STRICT_SCHEMA && $isComposerSchemaFile) {
- $schemaData->additionalProperties = false;
- $schemaData->required = ['name', 'description'];
- } elseif ($schema === self::AUTH_SCHEMA && $isComposerSchemaFile) {
- $schemaData = (object) ['$ref' => $schemaFile.'#/properties/config', '$schema' => "https://json-schema.org/draft-04/schema#"];
- }
- $validator = new Validator();
- $validator->check($data, $schemaData);
- if (!$validator->isValid()) {
- $errors = [];
- foreach ((array) $validator->getErrors() as $error) {
- $errors[] = ($error['property'] ? $error['property'].' : ' : '').$error['message'];
- }
- throw new JsonValidationException('"'.$source.'" does not match the expected JSON schema', $errors);
- }
- return true;
- }
- public static function encode($data, int $options = 448)
- {
- $json = json_encode($data, $options);
- if (false === $json) {
- self::throwEncodeError(json_last_error());
- }
- return $json;
- }
- private static function throwEncodeError(int $code): void
- {
- switch ($code) {
- case JSON_ERROR_DEPTH:
- $msg = 'Maximum stack depth exceeded';
- break;
- case JSON_ERROR_STATE_MISMATCH:
- $msg = 'Underflow or the modes mismatch';
- break;
- case JSON_ERROR_CTRL_CHAR:
- $msg = 'Unexpected control character found';
- break;
- case JSON_ERROR_UTF8:
- $msg = 'Malformed UTF-8 characters, possibly incorrectly encoded';
- break;
- default:
- $msg = 'Unknown error';
- }
- throw new \RuntimeException('JSON encoding failed: '.$msg);
- }
- public static function parseJson(?string $json, ?string $file = null)
- {
- if (null === $json) {
- return null;
- }
- $data = json_decode($json, true);
- if (null === $data && JSON_ERROR_NONE !== json_last_error()) {
- self::validateSyntax($json, $file);
- }
- return $data;
- }
- protected static function validateSyntax(string $json, ?string $file = null): bool
- {
- $parser = new JsonParser();
- $result = $parser->lint($json);
- if (null === $result) {
- if (defined('JSON_ERROR_UTF8') && JSON_ERROR_UTF8 === json_last_error()) {
- throw new \UnexpectedValueException('"'.$file.'" is not UTF-8, could not parse as JSON');
- }
- return true;
- }
- throw new ParsingException('"'.$file.'" does not contain valid JSON'."\n".$result->getMessage(), $result->getDetails());
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Json;
- use Composer\Pcre\Preg;
- class JsonFormatter
- {
- public static function format(string $json, bool $unescapeUnicode, bool $unescapeSlashes): string
- {
- $result = '';
- $pos = 0;
- $strLen = strlen($json);
- $indentStr = ' ';
- $newLine = "\n";
- $outOfQuotes = true;
- $buffer = '';
- $noescape = true;
- for ($i = 0; $i < $strLen; $i++) {
- $char = substr($json, $i, 1);
- if ('"' === $char && $noescape) {
- $outOfQuotes = !$outOfQuotes;
- }
- if (!$outOfQuotes) {
- $buffer .= $char;
- $noescape = '\\' === $char ? !$noescape : true;
- continue;
- }
- if ('' !== $buffer) {
- if ($unescapeSlashes) {
- $buffer = str_replace('\\/', '/', $buffer);
- }
- if ($unescapeUnicode && function_exists('mb_convert_encoding')) {
- $buffer = Preg::replaceCallback('/(\\\\+)u([0-9a-f]{4})/i', static function ($match) {
- $l = strlen($match[1]);
- if ($l % 2) {
- $code = hexdec($match[2]);
- if (0xD800 <= $code && 0xDFFF >= $code) {
- return $match[0];
- }
- return str_repeat('\\', $l - 1) . mb_convert_encoding(
- pack('H*', $match[2]),
- 'UTF-8',
- 'UCS-2BE'
- );
- }
- return $match[0];
- }, $buffer);
- }
- $result .= $buffer.$char;
- $buffer = '';
- continue;
- }
- if (':' === $char) {
- $char .= ' ';
- } elseif ('}' === $char || ']' === $char) {
- $pos--;
- $prevChar = substr($json, $i - 1, 1);
- if ('{' !== $prevChar && '[' !== $prevChar) {
- $result .= $newLine;
- $result .= str_repeat($indentStr, $pos);
- } else {
- $result = rtrim($result);
- }
- }
- $result .= $char;
- if (',' === $char || '{' === $char || '[' === $char) {
- $result .= $newLine;
- if ('{' === $char || '[' === $char) {
- $pos++;
- }
- $result .= str_repeat($indentStr, $pos);
- }
- }
- return $result;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Json;
- use Composer\Pcre\Preg;
- use Composer\Repository\PlatformRepository;
- class JsonManipulator
- {
- private static $DEFINES = '(?(DEFINE)
- (?<number> -? (?= [1-9]|0(?!\d) ) \d++ (\.\d++)? ([eE] [+-]?+ \d++)? )
- (?<boolean> true | false | null )
- (?<string> " ([^"\\\\]*+ | \\\\ ["\\\\bfnrt\/] | \\\\ u [0-9A-Fa-f]{4} )* " )
- (?<array> \[ (?: (?&json) \s*+ (?: , (?&json) \s*+ )*+ )?+ \s*+ \] )
- (?<pair> \s*+ (?&string) \s*+ : (?&json) \s*+ )
- (?<object> \{ (?: (?&pair) (?: , (?&pair) )*+ )?+ \s*+ \} )
- (?<json> \s*+ (?: (?&number) | (?&boolean) | (?&string) | (?&array) | (?&object) ) )
- )';
- private $contents;
- private $newline;
- private $indent;
- public function __construct(string $contents)
- {
- $contents = trim($contents);
- if ($contents === '') {
- $contents = '{}';
- }
- if (!Preg::isMatch('#^\{(.*)\}$#s', $contents)) {
- throw new \InvalidArgumentException('The json file must be an object ({})');
- }
- $this->newline = false !== strpos($contents, "\r\n") ? "\r\n" : "\n";
- $this->contents = $contents === '{}' ? '{' . $this->newline . '}' : $contents;
- $this->detectIndenting();
- }
- public function getContents(): string
- {
- return $this->contents . $this->newline;
- }
- public function addLink(string $type, string $package, string $constraint, bool $sortPackages = false): bool
- {
- $decoded = JsonFile::parseJson($this->contents);
- if (!isset($decoded[$type])) {
- return $this->addMainKey($type, [$package => $constraint]);
- }
- $regex = '{'.self::$DEFINES.'^(?P<start>\s*\{\s*(?:(?&string)\s*:\s*(?&json)\s*,\s*)*?)'.
- '(?P<property>'.preg_quote(JsonFile::encode($type)).'\s*:\s*)(?P<value>(?&json))(?P<end>.*)}sx';
- if (!Preg::isMatch($regex, $this->contents, $matches)) {
- return false;
- }
- $links = $matches['value'];
- $packageRegex = str_replace('/', '\\\\?/', preg_quote($package));
- $regex = '{'.self::$DEFINES.'"(?P<package>'.$packageRegex.')"(\s*:\s*)(?&string)}ix';
- if (Preg::isMatch($regex, $links, $packageMatches)) {
- $existingPackage = $packageMatches['package'];
- $packageRegex = str_replace('/', '\\\\?/', preg_quote($existingPackage));
- $links = Preg::replaceCallback('{'.self::$DEFINES.'"'.$packageRegex.'"(?P<separator>\s*:\s*)(?&string)}ix', static function ($m) use ($existingPackage, $constraint): string {
- return JsonFile::encode(str_replace('\\/', '/', $existingPackage)) . $m['separator'] . '"' . $constraint . '"';
- }, $links);
- } else {
- if (Preg::isMatch('#^\s*\{\s*\S+.*?(\s*\}\s*)$#s', $links, $match)) {
- $links = Preg::replace(
- '{'.preg_quote($match[1]).'$}',
- addcslashes(',' . $this->newline . $this->indent . $this->indent . JsonFile::encode($package).': '.JsonFile::encode($constraint) . $match[1], '\\$'),
- $links
- );
- } else {
- $links = '{' . $this->newline .
- $this->indent . $this->indent . JsonFile::encode($package).': '.JsonFile::encode($constraint) . $this->newline .
- $this->indent . '}';
- }
- }
- if (true === $sortPackages) {
- $requirements = json_decode($links, true);
- $this->sortPackages($requirements);
- $links = $this->format($requirements);
- }
- $this->contents = $matches['start'] . $matches['property'] . $links . $matches['end'];
- return true;
- }
- private function sortPackages(array &$packages = []): void
- {
- $prefix = static function ($requirement): string {
- if (PlatformRepository::isPlatformPackage($requirement)) {
- return Preg::replace(
- [
- '/^php/',
- '/^hhvm/',
- '/^ext/',
- '/^lib/',
- '/^\D/',
- ],
- [
- '0-$0',
- '1-$0',
- '2-$0',
- '3-$0',
- '4-$0',
- ],
- $requirement
- );
- }
- return '5-'.$requirement;
- };
- uksort($packages, static function ($a, $b) use ($prefix): int {
- return strnatcmp($prefix($a), $prefix($b));
- });
- }
- public function addRepository(string $name, $config, bool $append = true): bool
- {
- return $this->addSubNode('repositories', $name, $config, $append);
- }
- public function removeRepository(string $name): bool
- {
- return $this->removeSubNode('repositories', $name);
- }
- public function addConfigSetting(string $name, $value): bool
- {
- return $this->addSubNode('config', $name, $value);
- }
- public function removeConfigSetting(string $name): bool
- {
- return $this->removeSubNode('config', $name);
- }
- public function addProperty(string $name, $value): bool
- {
- if (strpos($name, 'suggest.') === 0) {
- return $this->addSubNode('suggest', substr($name, 8), $value);
- }
- if (strpos($name, 'extra.') === 0) {
- return $this->addSubNode('extra', substr($name, 6), $value);
- }
- if (strpos($name, 'scripts.') === 0) {
- return $this->addSubNode('scripts', substr($name, 8), $value);
- }
- return $this->addMainKey($name, $value);
- }
- public function removeProperty(string $name): bool
- {
- if (strpos($name, 'suggest.') === 0) {
- return $this->removeSubNode('suggest', substr($name, 8));
- }
- if (strpos($name, 'extra.') === 0) {
- return $this->removeSubNode('extra', substr($name, 6));
- }
- if (strpos($name, 'scripts.') === 0) {
- return $this->removeSubNode('scripts', substr($name, 8));
- }
- return $this->removeMainKey($name);
- }
- public function addSubNode(string $mainNode, string $name, $value, bool $append = true): bool
- {
- $decoded = JsonFile::parseJson($this->contents);
- $subName = null;
- if (in_array($mainNode, ['config', 'extra', 'scripts']) && false !== strpos($name, '.')) {
- [$name, $subName] = explode('.', $name, 2);
- }
- if (!isset($decoded[$mainNode])) {
- if ($subName !== null) {
- $this->addMainKey($mainNode, [$name => [$subName => $value]]);
- } else {
- $this->addMainKey($mainNode, [$name => $value]);
- }
- return true;
- }
- $nodeRegex = '{'.self::$DEFINES.'^(?P<start> \s* \{ \s* (?: (?&string) \s* : (?&json) \s* , \s* )*?'.
- preg_quote(JsonFile::encode($mainNode)).'\s*:\s*)(?P<content>(?&object))(?P<end>.*)}sx';
- try {
- if (!Preg::isMatch($nodeRegex, $this->contents, $match)) {
- return false;
- }
- } catch (\RuntimeException $e) {
- if ($e->getCode() === PREG_BACKTRACK_LIMIT_ERROR) {
- return false;
- }
- throw $e;
- }
- $children = $match['content'];
- if (!@json_decode($children)) {
- return false;
- }
- $childRegex = '{'.self::$DEFINES.'(?P<start>"'.preg_quote($name).'"\s*:\s*)(?P<content>(?&json))(?P<end>,?)}x';
- if (Preg::isMatch($childRegex, $children, $matches)) {
- $children = Preg::replaceCallback($childRegex, function ($matches) use ($subName, $value): string {
- if ($subName !== null) {
- $curVal = json_decode($matches['content'], true);
- if (!is_array($curVal)) {
- $curVal = [];
- }
- $curVal[$subName] = $value;
- $value = $curVal;
- }
- return $matches['start'] . $this->format($value, 1) . $matches['end'];
- }, $children);
- } else {
- Preg::match('#^{ (?P<leadingspace>\s*?) (?P<content>\S+.*?)? (?P<trailingspace>\s*) }$#sx', $children, $match);
- $whitespace = '';
- if (!empty($match['trailingspace'])) {
- $whitespace = $match['trailingspace'];
- }
- if (!empty($match['content'])) {
- if ($subName !== null) {
- $value = [$subName => $value];
- }
- if ($append) {
- $children = Preg::replace(
- '#'.$whitespace.'}$#',
- addcslashes(',' . $this->newline . $this->indent . $this->indent . JsonFile::encode($name).': '.$this->format($value, 1) . $whitespace . '}', '\\$'),
- $children
- );
- } else {
- $whitespace = '';
- if (!empty($match['leadingspace'])) {
- $whitespace = $match['leadingspace'];
- }
- $children = Preg::replace(
- '#^{'.$whitespace.'#',
- addcslashes('{' . $whitespace . JsonFile::encode($name).': '.$this->format($value, 1) . ',' . $this->newline . $this->indent . $this->indent, '\\$'),
- $children
- );
- }
- } else {
- if ($subName !== null) {
- $value = [$subName => $value];
- }
- $children = '{' . $this->newline . $this->indent . $this->indent . JsonFile::encode($name).': '.$this->format($value, 1) . $whitespace . '}';
- }
- }
- $this->contents = Preg::replaceCallback($nodeRegex, static function ($m) use ($children): string {
- return $m['start'] . $children . $m['end'];
- }, $this->contents);
- return true;
- }
- public function removeSubNode(string $mainNode, string $name): bool
- {
- $decoded = JsonFile::parseJson($this->contents);
- if (empty($decoded[$mainNode])) {
- return true;
- }
- $nodeRegex = '{'.self::$DEFINES.'^(?P<start> \s* \{ \s* (?: (?&string) \s* : (?&json) \s* , \s* )*?'.
- preg_quote(JsonFile::encode($mainNode)).'\s*:\s*)(?P<content>(?&object))(?P<end>.*)}sx';
- try {
- if (!Preg::isMatch($nodeRegex, $this->contents, $match)) {
- return false;
- }
- } catch (\RuntimeException $e) {
- if ($e->getCode() === PREG_BACKTRACK_LIMIT_ERROR) {
- return false;
- }
- throw $e;
- }
- $children = $match['content'];
- if (!@json_decode($children, true)) {
- return false;
- }
- $subName = null;
- if (in_array($mainNode, ['config', 'extra', 'scripts']) && false !== strpos($name, '.')) {
- [$name, $subName] = explode('.', $name, 2);
- }
- if (!isset($decoded[$mainNode][$name]) || ($subName && !isset($decoded[$mainNode][$name][$subName]))) {
- return true;
- }
- $keyRegex = str_replace('/', '\\\\?/', preg_quote($name));
- if (Preg::isMatch('{"'.$keyRegex.'"\s*:}i', $children)) {
- if (Preg::isMatchAll('{'.self::$DEFINES.'"'.$keyRegex.'"\s*:\s*(?:(?&json))}x', $children, $matches)) {
- $bestMatch = '';
- foreach ($matches[0] as $match) {
- if (strlen($bestMatch) < strlen($match)) {
- $bestMatch = $match;
- }
- }
- $childrenClean = Preg::replace('{,\s*'.preg_quote($bestMatch).'}i', '', $children, -1, $count);
- if (1 !== $count) {
- $childrenClean = Preg::replace('{'.preg_quote($bestMatch).'\s*,?\s*}i', '', $childrenClean, -1, $count);
- if (1 !== $count) {
- return false;
- }
- }
- }
- } else {
- $childrenClean = $children;
- }
- if (!isset($childrenClean)) {
- throw new \InvalidArgumentException("JsonManipulator: \$childrenClean is not defined. Please report at https://github.com/composer/composer/issues/new.");
- }
- unset($match);
- Preg::match('#^{ \s*? (?P<content>\S+.*?)? (?P<trailingspace>\s*) }$#sx', $childrenClean, $match);
- if (empty($match['content'])) {
- $newline = $this->newline;
- $indent = $this->indent;
- $this->contents = Preg::replaceCallback($nodeRegex, static function ($matches) use ($indent, $newline): string {
- return $matches['start'] . '{' . $newline . $indent . '}' . $matches['end'];
- }, $this->contents);
- if ($subName !== null) {
- $curVal = json_decode($children, true);
- unset($curVal[$name][$subName]);
- $this->addSubNode($mainNode, $name, $curVal[$name]);
- }
- return true;
- }
- $this->contents = Preg::replaceCallback($nodeRegex, function ($matches) use ($name, $subName, $childrenClean): string {
- if ($subName !== null) {
- $curVal = json_decode($matches['content'], true);
- unset($curVal[$name][$subName]);
- $childrenClean = $this->format($curVal);
- }
- return $matches['start'] . $childrenClean . $matches['end'];
- }, $this->contents);
- return true;
- }
- public function addMainKey(string $key, $content): bool
- {
- $decoded = JsonFile::parseJson($this->contents);
- $content = $this->format($content);
- $regex = '{'.self::$DEFINES.'^(?P<start>\s*\{\s*(?:(?&string)\s*:\s*(?&json)\s*,\s*)*?)'.
- '(?P<key>'.preg_quote(JsonFile::encode($key)).'\s*:\s*(?&json))(?P<end>.*)}sx';
- if (isset($decoded[$key]) && Preg::isMatch($regex, $this->contents, $matches)) {
- if (!@json_decode('{'.$matches['key'].'}')) {
- return false;
- }
- $this->contents = $matches['start'] . JsonFile::encode($key).': '.$content . $matches['end'];
- return true;
- }
- if (Preg::isMatch('#[^{\s](\s*)\}$#', $this->contents, $match)) {
- $this->contents = Preg::replace(
- '#'.$match[1].'\}$#',
- addcslashes(',' . $this->newline . $this->indent . JsonFile::encode($key). ': '. $content . $this->newline . '}', '\\$'),
- $this->contents
- );
- return true;
- }
- $this->contents = Preg::replace(
- '#\}$#',
- addcslashes($this->indent . JsonFile::encode($key). ': '.$content . $this->newline . '}', '\\$'),
- $this->contents
- );
- return true;
- }
- public function removeMainKey(string $key): bool
- {
- $decoded = JsonFile::parseJson($this->contents);
- if (!array_key_exists($key, $decoded)) {
- return true;
- }
- $regex = '{'.self::$DEFINES.'^(?P<start>\s*\{\s*(?:(?&string)\s*:\s*(?&json)\s*,\s*)*?)'.
- '(?P<removal>'.preg_quote(JsonFile::encode($key)).'\s*:\s*(?&json))\s*,?\s*(?P<end>.*)}sx';
- if (Preg::isMatch($regex, $this->contents, $matches)) {
- if (!@json_decode('{'.$matches['removal'].'}')) {
- return false;
- }
- if (Preg::isMatch('#,\s*$#', $matches['start']) && Preg::isMatch('#^\}$#', $matches['end'])) {
- $matches['start'] = rtrim(Preg::replace('#,(\s*)$#', '$1', $matches['start']), $this->indent);
- }
- $this->contents = $matches['start'] . $matches['end'];
- if (Preg::isMatch('#^\{\s*\}\s*$#', $this->contents)) {
- $this->contents = "{\n}";
- }
- return true;
- }
- return false;
- }
- public function removeMainKeyIfEmpty(string $key): bool
- {
- $decoded = JsonFile::parseJson($this->contents);
- if (!array_key_exists($key, $decoded)) {
- return true;
- }
- if (is_array($decoded[$key]) && count($decoded[$key]) === 0) {
- return $this->removeMainKey($key);
- }
- return true;
- }
- public function format($data, int $depth = 0): string
- {
- if (is_array($data)) {
- reset($data);
- if (is_numeric(key($data))) {
- foreach ($data as $key => $val) {
- $data[$key] = $this->format($val, $depth + 1);
- }
- return '['.implode(', ', $data).']';
- }
- $out = '{' . $this->newline;
- $elems = [];
- foreach ($data as $key => $val) {
- $elems[] = str_repeat($this->indent, $depth + 2) . JsonFile::encode($key). ': '.$this->format($val, $depth + 1);
- }
- return $out . implode(','.$this->newline, $elems) . $this->newline . str_repeat($this->indent, $depth + 1) . '}';
- }
- return JsonFile::encode($data);
- }
- protected function detectIndenting(): void
- {
- if (Preg::isMatch('{^([ \t]+)"}m', $this->contents, $match)) {
- $this->indent = $match[1];
- } else {
- $this->indent = ' ';
- }
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Json;
- use Exception;
- class JsonValidationException extends Exception
- {
- protected $errors;
- public function __construct(string $message, array $errors = [], ?Exception $previous = null)
- {
- $this->errors = $errors;
- parent::__construct((string) $message, 0, $previous);
- }
- public function getErrors(): array
- {
- return $this->errors;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\PHPStan;
- use Composer\Config;
- use Composer\Json\JsonFile;
- use PhpParser\Node\Expr\MethodCall;
- use PHPStan\Analyser\Scope;
- use PHPStan\Reflection\MethodReflection;
- use PHPStan\Reflection\ParametersAcceptorSelector;
- use PHPStan\Type\ArrayType;
- use PHPStan\Type\BooleanType;
- use PHPStan\Type\Constant\ConstantArrayType;
- use PHPStan\Type\Constant\ConstantBooleanType;
- use PHPStan\Type\Constant\ConstantStringType;
- use PHPStan\Type\DynamicMethodReturnTypeExtension;
- use PHPStan\Type\IntegerRangeType;
- use PHPStan\Type\IntegerType;
- use PHPStan\Type\MixedType;
- use PHPStan\Type\StringType;
- use PHPStan\Type\Type;
- use PHPStan\Type\TypeCombinator;
- use PHPStan\Type\UnionType;
- final class ConfigReturnTypeExtension implements DynamicMethodReturnTypeExtension
- {
- private $properties = [];
- public function __construct()
- {
- $schema = JsonFile::parseJson((string) file_get_contents(__DIR__.'/../../../res/composer-schema.json'));
- foreach ($schema['properties']['config']['properties'] as $prop => $conf) {
- $type = $this->parseType($conf, $prop);
- $this->properties[$prop] = $type;
- }
- }
- public function getClass(): string
- {
- return Config::class;
- }
- public function isMethodSupported(MethodReflection $methodReflection): bool
- {
- return strtolower($methodReflection->getName()) === 'get';
- }
- public function getTypeFromMethodCall(MethodReflection $methodReflection, MethodCall $methodCall, Scope $scope): Type
- {
- $args = $methodCall->getArgs();
- if (count($args) < 1) {
- return ParametersAcceptorSelector::selectSingle($methodReflection->getVariants())->getReturnType();
- }
- $keyType = $scope->getType($args[0]->value);
- if ($keyType instanceof ConstantStringType) {
- if (isset($this->properties[$keyType->getValue()])) {
- return $this->properties[$keyType->getValue()];
- }
- }
- return ParametersAcceptorSelector::selectSingle($methodReflection->getVariants())->getReturnType();
- }
- private function parseType(array $def, string $path): Type
- {
- if (isset($def['type'])) {
- $types = [];
- foreach ((array) $def['type'] as $type) {
- switch ($type) {
- case 'integer':
- if (in_array($path, ['process-timeout', 'cache-ttl', 'cache-files-ttl', 'cache-files-maxsize'], true)) {
- $types[] = IntegerRangeType::createAllGreaterThanOrEqualTo(0);
- } else {
- $types[] = new IntegerType();
- }
- break;
- case 'string':
- if ($path === 'cache-files-maxsize') {
- } elseif ($path === 'discard-changes') {
- $types[] = new ConstantStringType('stash');
- } elseif ($path === 'use-parent-dir') {
- $types[] = new ConstantStringType('prompt');
- } elseif ($path === 'store-auths') {
- $types[] = new ConstantStringType('prompt');
- } elseif ($path === 'platform-check') {
- $types[] = new ConstantStringType('php-only');
- } elseif ($path === 'github-protocols') {
- $types[] = new UnionType([new ConstantStringType('git'), new ConstantStringType('https'), new ConstantStringType('ssh'), new ConstantStringType('http')]);
- } elseif (str_starts_with($path, 'preferred-install')) {
- $types[] = new UnionType([new ConstantStringType('source'), new ConstantStringType('dist'), new ConstantStringType('auto')]);
- } else {
- $types[] = new StringType();
- }
- break;
- case 'boolean':
- if ($path === 'platform.additionalProperties') {
- $types[] = new ConstantBooleanType(false);
- } else {
- $types[] = new BooleanType();
- }
- break;
- case 'object':
- $addlPropType = null;
- if (isset($def['additionalProperties'])) {
- $addlPropType = $this->parseType($def['additionalProperties'], $path.'.additionalProperties');
- }
- if (isset($def['properties'])) {
- $keyNames = [];
- $valTypes = [];
- $optionalKeys = [];
- $propIndex = 0;
- foreach ($def['properties'] as $propName => $propdef) {
- $keyNames[] = new ConstantStringType($propName);
- $valType = $this->parseType($propdef, $path.'.'.$propName);
- if (!isset($def['required']) || !in_array($propName, $def['required'], true)) {
- $valType = TypeCombinator::addNull($valType);
- $optionalKeys[] = $propIndex;
- }
- $valTypes[] = $valType;
- $propIndex++;
- }
- if ($addlPropType !== null) {
- $types[] = new ArrayType(TypeCombinator::union(new StringType(), ...$keyNames), TypeCombinator::union($addlPropType, ...$valTypes));
- } else {
- $types[] = new ConstantArrayType($keyNames, $valTypes, [0], $optionalKeys);
- }
- } else {
- $types[] = new ArrayType(new StringType(), $addlPropType ?? new MixedType());
- }
- break;
- case 'array':
- if (isset($def['items'])) {
- $valType = $this->parseType($def['items'], $path.'.items');
- } else {
- $valType = new MixedType();
- }
- $types[] = new ArrayType(new IntegerType(), $valType);
- break;
- default:
- $types[] = new MixedType();
- }
- }
- $type = TypeCombinator::union(...$types);
- } elseif (isset($def['enum'])) {
- $type = TypeCombinator::union(...array_map(static function (string $value): ConstantStringType {
- return new ConstantStringType($value);
- }, $def['enum']));
- } else {
- $type = new MixedType();
- }
- if ($path === 'allow-plugins' && time() < strtotime('2022-07-01')) {
- $type = TypeCombinator::addNull($type);
- }
- if (in_array($path, ['autoloader-suffix', 'gitlab-protocol'], true)) {
- $type = TypeCombinator::addNull($type);
- }
- return $type;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\PHPStan;
- use Composer\DependencyResolver\Rule;
- use Composer\Package\BasePackage;
- use Composer\Package\Link;
- use Composer\Semver\Constraint\ConstraintInterface;
- use PhpParser\Node\Expr\MethodCall;
- use PHPStan\Analyser\Scope;
- use PHPStan\Reflection\MethodReflection;
- use PHPStan\Type\Accessory\AccessoryNonEmptyStringType;
- use PHPStan\Type\Constant\ConstantArrayType;
- use PHPStan\Type\Constant\ConstantStringType;
- use PHPStan\Type\Constant\ConstantIntegerType;
- use PHPStan\Type\DynamicMethodReturnTypeExtension;
- use PHPStan\Type\IntegerType;
- use PHPStan\Type\StringType;
- use PHPStan\Type\Type;
- use PHPStan\Type\ObjectType;
- use PHPStan\Type\TypeCombinator;
- use PhpParser\Node\Identifier;
- final class RuleReasonDataReturnTypeExtension implements DynamicMethodReturnTypeExtension
- {
- public function getClass(): string
- {
- return Rule::class;
- }
- public function isMethodSupported(MethodReflection $methodReflection): bool
- {
- return strtolower($methodReflection->getName()) === 'getreasondata';
- }
- public function getTypeFromMethodCall(MethodReflection $methodReflection, MethodCall $methodCall, Scope $scope): Type
- {
- $reasonType = $scope->getType(new MethodCall($methodCall->var, new Identifier('getReason')));
- $types = [
- Rule::RULE_ROOT_REQUIRE => new ConstantArrayType([new ConstantStringType('packageName'), new ConstantStringType('constraint')], [new StringType, new ObjectType(ConstraintInterface::class)]),
- Rule::RULE_FIXED => new ConstantArrayType([new ConstantStringType('package')], [new ObjectType(BasePackage::class)]),
- Rule::RULE_PACKAGE_CONFLICT => new ObjectType(Link::class),
- Rule::RULE_PACKAGE_REQUIRES => new ObjectType(Link::class),
- Rule::RULE_PACKAGE_SAME_NAME => TypeCombinator::intersect(new StringType, new AccessoryNonEmptyStringType()),
- Rule::RULE_LEARNED => new IntegerType(),
- Rule::RULE_PACKAGE_ALIAS => new ObjectType(BasePackage::class),
- Rule::RULE_PACKAGE_INVERSE_ALIAS => new ObjectType(BasePackage::class),
- ];
- foreach ($types as $const => $type) {
- if ((new ConstantIntegerType($const))->isSuperTypeOf($reasonType)->yes()) {
- return $type;
- }
- }
- return TypeCombinator::union(...$types);
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Package;
- use Composer\Semver\Constraint\Constraint;
- use Composer\Package\Version\VersionParser;
- class AliasPackage extends BasePackage
- {
- protected $version;
- protected $prettyVersion;
- protected $dev;
- protected $rootPackageAlias = false;
- protected $stability;
- protected $hasSelfVersionRequires = false;
- protected $aliasOf;
- protected $requires;
- protected $devRequires;
- protected $conflicts;
- protected $provides;
- protected $replaces;
- public function __construct(BasePackage $aliasOf, string $version, string $prettyVersion)
- {
- parent::__construct($aliasOf->getName());
- $this->version = $version;
- $this->prettyVersion = $prettyVersion;
- $this->aliasOf = $aliasOf;
- $this->stability = VersionParser::parseStability($version);
- $this->dev = $this->stability === 'dev';
- foreach (Link::$TYPES as $type) {
- $links = $aliasOf->{'get' . ucfirst($type)}();
- $this->{$type} = $this->replaceSelfVersionDependencies($links, $type);
- }
- }
- public function getAliasOf()
- {
- return $this->aliasOf;
- }
- public function getVersion(): string
- {
- return $this->version;
- }
- public function getStability(): string
- {
- return $this->stability;
- }
- public function getPrettyVersion(): string
- {
- return $this->prettyVersion;
- }
- public function isDev(): bool
- {
- return $this->dev;
- }
- public function getRequires(): array
- {
- return $this->requires;
- }
- public function getConflicts(): array
- {
- return $this->conflicts;
- }
- public function getProvides(): array
- {
- return $this->provides;
- }
- public function getReplaces(): array
- {
- return $this->replaces;
- }
- public function getDevRequires(): array
- {
- return $this->devRequires;
- }
- public function setRootPackageAlias(bool $value): void
- {
- $this->rootPackageAlias = $value;
- }
- public function isRootPackageAlias(): bool
- {
- return $this->rootPackageAlias;
- }
- protected function replaceSelfVersionDependencies(array $links, $linkType): array
- {
- $prettyVersion = $this->prettyVersion;
- if ($prettyVersion === VersionParser::DEFAULT_BRANCH_ALIAS) {
- $prettyVersion = $this->aliasOf->getPrettyVersion();
- }
- if (\in_array($linkType, [Link::TYPE_CONFLICT, Link::TYPE_PROVIDE, Link::TYPE_REPLACE], true)) {
- $newLinks = [];
- foreach ($links as $link) {
- if ('self.version' === $link->getPrettyConstraint()) {
- $newLinks[] = new Link($link->getSource(), $link->getTarget(), $constraint = new Constraint('=', $this->version), $linkType, $prettyVersion);
- $constraint->setPrettyString($prettyVersion);
- }
- }
- $links = array_merge($links, $newLinks);
- } else {
- foreach ($links as $index => $link) {
- if ('self.version' === $link->getPrettyConstraint()) {
- if ($linkType === Link::TYPE_REQUIRE) {
- $this->hasSelfVersionRequires = true;
- }
- $links[$index] = new Link($link->getSource(), $link->getTarget(), $constraint = new Constraint('=', $this->version), $linkType, $prettyVersion);
- $constraint->setPrettyString($prettyVersion);
- }
- }
- }
- return $links;
- }
- public function hasSelfVersionRequires(): bool
- {
- return $this->hasSelfVersionRequires;
- }
- public function __toString(): string
- {
- return parent::__toString().' ('.($this->rootPackageAlias ? 'root ' : ''). 'alias of '.$this->aliasOf->getVersion().')';
- }
- public function getType(): string
- {
- return $this->aliasOf->getType();
- }
- public function getTargetDir(): ?string
- {
- return $this->aliasOf->getTargetDir();
- }
- public function getExtra(): array
- {
- return $this->aliasOf->getExtra();
- }
- public function setInstallationSource(?string $type): void
- {
- $this->aliasOf->setInstallationSource($type);
- }
- public function getInstallationSource(): ?string
- {
- return $this->aliasOf->getInstallationSource();
- }
- public function getSourceType(): ?string
- {
- return $this->aliasOf->getSourceType();
- }
- public function getSourceUrl(): ?string
- {
- return $this->aliasOf->getSourceUrl();
- }
- public function getSourceUrls(): array
- {
- return $this->aliasOf->getSourceUrls();
- }
- public function getSourceReference(): ?string
- {
- return $this->aliasOf->getSourceReference();
- }
- public function setSourceReference(?string $reference): void
- {
- $this->aliasOf->setSourceReference($reference);
- }
- public function setSourceMirrors(?array $mirrors): void
- {
- $this->aliasOf->setSourceMirrors($mirrors);
- }
- public function getSourceMirrors(): ?array
- {
- return $this->aliasOf->getSourceMirrors();
- }
- public function getDistType(): ?string
- {
- return $this->aliasOf->getDistType();
- }
- public function getDistUrl(): ?string
- {
- return $this->aliasOf->getDistUrl();
- }
- public function getDistUrls(): array
- {
- return $this->aliasOf->getDistUrls();
- }
- public function getDistReference(): ?string
- {
- return $this->aliasOf->getDistReference();
- }
- public function setDistReference(?string $reference): void
- {
- $this->aliasOf->setDistReference($reference);
- }
- public function getDistSha1Checksum(): ?string
- {
- return $this->aliasOf->getDistSha1Checksum();
- }
- public function setTransportOptions(array $options): void
- {
- $this->aliasOf->setTransportOptions($options);
- }
- public function getTransportOptions(): array
- {
- return $this->aliasOf->getTransportOptions();
- }
- public function setDistMirrors(?array $mirrors): void
- {
- $this->aliasOf->setDistMirrors($mirrors);
- }
- public function getDistMirrors(): ?array
- {
- return $this->aliasOf->getDistMirrors();
- }
- public function getAutoload(): array
- {
- return $this->aliasOf->getAutoload();
- }
- public function getDevAutoload(): array
- {
- return $this->aliasOf->getDevAutoload();
- }
- public function getIncludePaths(): array
- {
- return $this->aliasOf->getIncludePaths();
- }
- public function getReleaseDate(): ?\DateTimeInterface
- {
- return $this->aliasOf->getReleaseDate();
- }
- public function getBinaries(): array
- {
- return $this->aliasOf->getBinaries();
- }
- public function getSuggests(): array
- {
- return $this->aliasOf->getSuggests();
- }
- public function getNotificationUrl(): ?string
- {
- return $this->aliasOf->getNotificationUrl();
- }
- public function isDefaultBranch(): bool
- {
- return $this->aliasOf->isDefaultBranch();
- }
- public function setDistUrl(?string $url): void
- {
- $this->aliasOf->setDistUrl($url);
- }
- public function setDistType(?string $type): void
- {
- $this->aliasOf->setDistType($type);
- }
- public function setSourceDistReferences(string $reference): void
- {
- $this->aliasOf->setSourceDistReferences($reference);
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Package\Archiver;
- use FilterIterator;
- use PharData;
- class ArchivableFilesFilter extends FilterIterator
- {
- private $dirs = [];
- public function accept(): bool
- {
- $file = $this->getInnerIterator()->current();
- if ($file->isDir()) {
- $this->dirs[] = (string) $file;
- return false;
- }
- return true;
- }
- public function addEmptyDir(PharData $phar, string $sources): void
- {
- foreach ($this->dirs as $filepath) {
- $localname = str_replace($sources . "/", '', $filepath);
- $phar->addEmptyDir($localname);
- }
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Package\Archiver;
- use Composer\Pcre\Preg;
- use Composer\Util\Filesystem;
- use FilesystemIterator;
- use Symfony\Component\Finder\Finder;
- use Symfony\Component\Finder\SplFileInfo;
- class ArchivableFilesFinder extends \FilterIterator
- {
- protected $finder;
- public function __construct(string $sources, array $excludes, bool $ignoreFilters = false)
- {
- $fs = new Filesystem();
- $sources = $fs->normalizePath(realpath($sources));
- if ($ignoreFilters) {
- $filters = [];
- } else {
- $filters = [
- new GitExcludeFilter($sources),
- new ComposerExcludeFilter($sources, $excludes),
- ];
- }
- $this->finder = new Finder();
- $filter = static function (\SplFileInfo $file) use ($sources, $filters, $fs): bool {
- if ($file->isLink() && ($file->getRealPath() === false || strpos($file->getRealPath(), $sources) !== 0)) {
- return false;
- }
- $relativePath = Preg::replace(
- '#^'.preg_quote($sources, '#').'#',
- '',
- $fs->normalizePath($file->getRealPath())
- );
- $exclude = false;
- foreach ($filters as $filter) {
- $exclude = $filter->filter($relativePath, $exclude);
- }
- return !$exclude;
- };
- if (method_exists($filter, 'bindTo')) {
- $filter = $filter->bindTo(null);
- }
- $this->finder
- ->in($sources)
- ->filter($filter)
- ->ignoreVCS(true)
- ->ignoreDotFiles(false)
- ->sortByName();
- parent::__construct($this->finder->getIterator());
- }
- public function accept(): bool
- {
- $current = $this->getInnerIterator()->current();
- if (!$current->isDir()) {
- return true;
- }
- $iterator = new FilesystemIterator((string) $current, FilesystemIterator::SKIP_DOTS);
- return !$iterator->valid();
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Package\Archiver;
- use Composer\Downloader\DownloadManager;
- use Composer\Package\RootPackageInterface;
- use Composer\Pcre\Preg;
- use Composer\Util\Filesystem;
- use Composer\Util\Loop;
- use Composer\Util\SyncHelper;
- use Composer\Json\JsonFile;
- use Composer\Package\CompletePackageInterface;
- class ArchiveManager
- {
- protected $downloadManager;
- protected $loop;
- protected $archivers = [];
- protected $overwriteFiles = true;
- public function __construct(DownloadManager $downloadManager, Loop $loop)
- {
- $this->downloadManager = $downloadManager;
- $this->loop = $loop;
- }
- public function addArchiver(ArchiverInterface $archiver): void
- {
- $this->archivers[] = $archiver;
- }
- public function setOverwriteFiles(bool $overwriteFiles): self
- {
- $this->overwriteFiles = $overwriteFiles;
- return $this;
- }
- public function getPackageFilename(CompletePackageInterface $package): string
- {
- if ($package->getArchiveName()) {
- $baseName = $package->getArchiveName();
- } else {
- $baseName = Preg::replace('#[^a-z0-9-_]#i', '-', $package->getName());
- }
- $nameParts = [$baseName];
- if (null !== $package->getDistReference() && Preg::isMatch('{^[a-f0-9]{40}$}', $package->getDistReference())) {
- array_push($nameParts, $package->getDistReference(), $package->getDistType());
- } else {
- array_push($nameParts, $package->getPrettyVersion(), $package->getDistReference());
- }
- if ($package->getSourceReference()) {
- $nameParts[] = substr(sha1($package->getSourceReference()), 0, 6);
- }
- $name = implode('-', array_filter($nameParts, static function ($p): bool {
- return !empty($p);
- }));
- return str_replace('/', '-', $name);
- }
- public function archive(CompletePackageInterface $package, string $format, string $targetDir, ?string $fileName = null, bool $ignoreFilters = false): string
- {
- if (empty($format)) {
- throw new \InvalidArgumentException('Format must be specified');
- }
- $usableArchiver = null;
- foreach ($this->archivers as $archiver) {
- if ($archiver->supports($format, $package->getSourceType())) {
- $usableArchiver = $archiver;
- break;
- }
- }
- if (null === $usableArchiver) {
- throw new \RuntimeException(sprintf('No archiver found to support %s format', $format));
- }
- $filesystem = new Filesystem();
- if ($package instanceof RootPackageInterface) {
- $sourcePath = realpath('.');
- } else {
- $sourcePath = sys_get_temp_dir().'/composer_archive'.uniqid();
- $filesystem->ensureDirectoryExists($sourcePath);
- try {
- $promise = $this->downloadManager->download($package, $sourcePath);
- SyncHelper::await($this->loop, $promise);
- $promise = $this->downloadManager->install($package, $sourcePath);
- SyncHelper::await($this->loop, $promise);
- } catch (\Exception $e) {
- $filesystem->removeDirectory($sourcePath);
- throw $e;
- }
- if (file_exists($composerJsonPath = $sourcePath.'/composer.json')) {
- $jsonFile = new JsonFile($composerJsonPath);
- $jsonData = $jsonFile->read();
- if (!empty($jsonData['archive']['name'])) {
- $package->setArchiveName($jsonData['archive']['name']);
- }
- if (!empty($jsonData['archive']['exclude'])) {
- $package->setArchiveExcludes($jsonData['archive']['exclude']);
- }
- }
- }
- if (null === $fileName) {
- $packageName = $this->getPackageFilename($package);
- } else {
- $packageName = $fileName;
- }
- $filesystem->ensureDirectoryExists($targetDir);
- $target = realpath($targetDir).'/'.$packageName.'.'.$format;
- $filesystem->ensureDirectoryExists(dirname($target));
- if (!$this->overwriteFiles && file_exists($target)) {
- return $target;
- }
- $tempTarget = sys_get_temp_dir().'/composer_archive'.uniqid().'.'.$format;
- $filesystem->ensureDirectoryExists(dirname($tempTarget));
- $archivePath = $usableArchiver->archive($sourcePath, $tempTarget, $format, $package->getArchiveExcludes(), $ignoreFilters);
- $filesystem->rename($archivePath, $target);
- if (!$package instanceof RootPackageInterface) {
- $filesystem->removeDirectory($sourcePath);
- }
- $filesystem->remove($tempTarget);
- return $target;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Package\Archiver;
- interface ArchiverInterface
- {
- public function archive(string $sources, string $target, string $format, array $excludes = [], bool $ignoreFilters = false): string;
- public function supports(string $format, ?string $sourceType): bool;
- }
- <?php declare(strict_types=1);
- namespace Composer\Package\Archiver;
- use Composer\Pcre\Preg;
- use Symfony\Component\Finder;
- abstract class BaseExcludeFilter
- {
- protected $sourcePath;
- protected $excludePatterns;
- public function __construct(string $sourcePath)
- {
- $this->sourcePath = $sourcePath;
- $this->excludePatterns = [];
- }
- public function filter(string $relativePath, bool $exclude): bool
- {
- foreach ($this->excludePatterns as $patternData) {
- [$pattern, $negate, $stripLeadingSlash] = $patternData;
- if ($stripLeadingSlash) {
- $path = substr($relativePath, 1);
- } else {
- $path = $relativePath;
- }
- try {
- if (Preg::isMatch($pattern, $path)) {
- $exclude = !$negate;
- }
- } catch (\RuntimeException $e) {
- }
- }
- return $exclude;
- }
- protected function parseLines(array $lines, callable $lineParser): array
- {
- return array_filter(
- array_map(
- static function ($line) use ($lineParser) {
- $line = trim($line);
- if (!$line || 0 === strpos($line, '#')) {
- return null;
- }
- return $lineParser($line);
- },
- $lines
- ),
- static function ($pattern): bool {
- return $pattern !== null;
- }
- );
- }
- protected function generatePatterns(array $rules): array
- {
- $patterns = [];
- foreach ($rules as $rule) {
- $patterns[] = $this->generatePattern($rule);
- }
- return $patterns;
- }
- protected function generatePattern(string $rule): array
- {
- $negate = false;
- $pattern = '';
- if ($rule !== '' && $rule[0] === '!') {
- $negate = true;
- $rule = ltrim($rule, '!');
- }
- $firstSlashPosition = strpos($rule, '/');
- if (0 === $firstSlashPosition) {
- $pattern = '^/';
- } elseif (false === $firstSlashPosition || strlen($rule) - 1 === $firstSlashPosition) {
- $pattern = '/';
- }
- $rule = trim($rule, '/');
- $rule = substr(Finder\Glob::toRegex($rule), 2, -2);
- return ['{'.$pattern.$rule.'(?=$|/)}', $negate, false];
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Package\Archiver;
- class ComposerExcludeFilter extends BaseExcludeFilter
- {
- public function __construct(string $sourcePath, array $excludeRules)
- {
- parent::__construct($sourcePath);
- $this->excludePatterns = $this->generatePatterns($excludeRules);
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Package\Archiver;
- use Composer\Pcre\Preg;
- class GitExcludeFilter extends BaseExcludeFilter
- {
- public function __construct(string $sourcePath)
- {
- parent::__construct($sourcePath);
- if (file_exists($sourcePath.'/.gitattributes')) {
- $this->excludePatterns = array_merge(
- $this->excludePatterns,
- $this->parseLines(
- file($sourcePath.'/.gitattributes'),
- [$this, 'parseGitAttributesLine']
- )
- );
- }
- }
- public function parseGitAttributesLine(string $line): ?array
- {
- $parts = Preg::split('#\s+#', $line);
- if (count($parts) === 2 && $parts[1] === 'export-ignore') {
- return $this->generatePattern($parts[0]);
- }
- if (count($parts) === 2 && $parts[1] === '-export-ignore') {
- return $this->generatePattern('!'.$parts[0]);
- }
- return null;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Package\Archiver;
- class PharArchiver implements ArchiverInterface
- {
- protected static $formats = [
- 'zip' => \Phar::ZIP,
- 'tar' => \Phar::TAR,
- 'tar.gz' => \Phar::TAR,
- 'tar.bz2' => \Phar::TAR,
- ];
- protected static $compressFormats = [
- 'tar.gz' => \Phar::GZ,
- 'tar.bz2' => \Phar::BZ2,
- ];
- public function archive(string $sources, string $target, string $format, array $excludes = [], bool $ignoreFilters = false): string
- {
- $sources = realpath($sources);
- if (file_exists($target)) {
- unlink($target);
- }
- try {
- $filename = substr($target, 0, strrpos($target, $format) - 1);
- if (isset(static::$compressFormats[$format])) {
- $target = $filename . '.tar';
- }
- $phar = new \PharData(
- $target,
- \FilesystemIterator::KEY_AS_PATHNAME | \FilesystemIterator::CURRENT_AS_FILEINFO,
- '',
- static::$formats[$format]
- );
- $files = new ArchivableFilesFinder($sources, $excludes, $ignoreFilters);
- $filesOnly = new ArchivableFilesFilter($files);
- $phar->buildFromIterator($filesOnly, $sources);
- $filesOnly->addEmptyDir($phar, $sources);
- if (isset(static::$compressFormats[$format])) {
- if (!$phar->canCompress(static::$compressFormats[$format])) {
- throw new \RuntimeException(sprintf('Can not compress to %s format', $format));
- }
- unlink($target);
- $phar->compress(static::$compressFormats[$format]);
- $target = $filename . '.' . $format;
- }
- return $target;
- } catch (\UnexpectedValueException $e) {
- $message = sprintf(
- "Could not create archive '%s' from '%s': %s",
- $target,
- $sources,
- $e->getMessage()
- );
- throw new \RuntimeException($message, $e->getCode(), $e);
- }
- }
- public function supports(string $format, ?string $sourceType): bool
- {
- return isset(static::$formats[$format]);
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Package\Archiver;
- use ZipArchive;
- use Composer\Util\Filesystem;
- class ZipArchiver implements ArchiverInterface
- {
- protected static $formats = [
- 'zip' => true,
- ];
- public function archive(string $sources, string $target, string $format, array $excludes = [], bool $ignoreFilters = false): string
- {
- $fs = new Filesystem();
- $sources = $fs->normalizePath($sources);
- $zip = new ZipArchive();
- $res = $zip->open($target, ZipArchive::CREATE);
- if ($res === true) {
- $files = new ArchivableFilesFinder($sources, $excludes, $ignoreFilters);
- foreach ($files as $file) {
- $filepath = strtr($file->getPath()."/".$file->getFilename(), '\\', '/');
- $localname = $filepath;
- if (strpos($localname, $sources . '/') === 0) {
- $localname = substr($localname, strlen($sources . '/'));
- }
- if ($file->isDir()) {
- $zip->addEmptyDir($localname);
- } else {
- $zip->addFile($filepath, $localname);
- }
- if (method_exists($zip, 'setExternalAttributesName')) {
- $perms = fileperms($filepath);
- $zip->setExternalAttributesName($localname, ZipArchive::OPSYS_UNIX, $perms << 16);
- }
- }
- if ($zip->close()) {
- return $target;
- }
- }
- $message = sprintf(
- "Could not create archive '%s' from '%s': %s",
- $target,
- $sources,
- $zip->getStatusString()
- );
- throw new \RuntimeException($message);
- }
- public function supports(string $format, ?string $sourceType): bool
- {
- return isset(static::$formats[$format]) && $this->compressionAvailable();
- }
- private function compressionAvailable(): bool
- {
- return class_exists('ZipArchive');
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Package;
- use Composer\Repository\RepositoryInterface;
- use Composer\Repository\PlatformRepository;
- abstract class BasePackage implements PackageInterface
- {
- public static $supportedLinkTypes = [
- 'require' => ['description' => 'requires', 'method' => Link::TYPE_REQUIRE],
- 'conflict' => ['description' => 'conflicts', 'method' => Link::TYPE_CONFLICT],
- 'provide' => ['description' => 'provides', 'method' => Link::TYPE_PROVIDE],
- 'replace' => ['description' => 'replaces', 'method' => Link::TYPE_REPLACE],
- 'require-dev' => ['description' => 'requires (for development)', 'method' => Link::TYPE_DEV_REQUIRE],
- ];
- public const STABILITY_STABLE = 0;
- public const STABILITY_RC = 5;
- public const STABILITY_BETA = 10;
- public const STABILITY_ALPHA = 15;
- public const STABILITY_DEV = 20;
- public static $stabilities = [
- 'stable' => self::STABILITY_STABLE,
- 'RC' => self::STABILITY_RC,
- 'beta' => self::STABILITY_BETA,
- 'alpha' => self::STABILITY_ALPHA,
- 'dev' => self::STABILITY_DEV,
- ];
- public $id;
- protected $name;
- protected $prettyName;
- protected $repository = null;
- public function __construct(string $name)
- {
- $this->prettyName = $name;
- $this->name = strtolower($name);
- $this->id = -1;
- }
- public function getName(): string
- {
- return $this->name;
- }
- public function getPrettyName(): string
- {
- return $this->prettyName;
- }
- public function getNames($provides = true): array
- {
- $names = [
- $this->getName() => true,
- ];
- if ($provides) {
- foreach ($this->getProvides() as $link) {
- $names[$link->getTarget()] = true;
- }
- }
- foreach ($this->getReplaces() as $link) {
- $names[$link->getTarget()] = true;
- }
- return array_keys($names);
- }
- public function setId(int $id): void
- {
- $this->id = $id;
- }
- public function getId(): int
- {
- return $this->id;
- }
- public function setRepository(RepositoryInterface $repository): void
- {
- if ($this->repository && $repository !== $this->repository) {
- throw new \LogicException(sprintf(
- 'Package "%s" cannot be added to repository "%s" as it is already in repository "%s".',
- $this->getPrettyName(),
- $repository->getRepoName(),
- $this->repository->getRepoName()
- ));
- }
- $this->repository = $repository;
- }
- public function getRepository(): ?RepositoryInterface
- {
- return $this->repository;
- }
- public function isPlatform(): bool
- {
- return $this->getRepository() instanceof PlatformRepository;
- }
- public function getUniqueName(): string
- {
- return $this->getName().'-'.$this->getVersion();
- }
- public function equals(PackageInterface $package): bool
- {
- $self = $this;
- if ($this instanceof AliasPackage) {
- $self = $this->getAliasOf();
- }
- if ($package instanceof AliasPackage) {
- $package = $package->getAliasOf();
- }
- return $package === $self;
- }
- public function __toString(): string
- {
- return $this->getUniqueName();
- }
- public function getPrettyString(): string
- {
- return $this->getPrettyName().' '.$this->getPrettyVersion();
- }
- public function getFullPrettyVersion(bool $truncate = true, int $displayMode = PackageInterface::DISPLAY_SOURCE_REF_IF_DEV): string
- {
- if ($displayMode === PackageInterface::DISPLAY_SOURCE_REF_IF_DEV &&
- (!$this->isDev() || !\in_array($this->getSourceType(), ['hg', 'git']))
- ) {
- return $this->getPrettyVersion();
- }
- switch ($displayMode) {
- case PackageInterface::DISPLAY_SOURCE_REF_IF_DEV:
- case PackageInterface::DISPLAY_SOURCE_REF:
- $reference = $this->getSourceReference();
- break;
- case PackageInterface::DISPLAY_DIST_REF:
- $reference = $this->getDistReference();
- break;
- default:
- throw new \UnexpectedValueException('Display mode '.$displayMode.' is not supported');
- }
- if (null === $reference) {
- return $this->getPrettyVersion();
- }
- if ($truncate && \strlen($reference) === 40 && $this->getSourceType() !== 'svn') {
- return $this->getPrettyVersion() . ' ' . substr($reference, 0, 7);
- }
- return $this->getPrettyVersion() . ' ' . $reference;
- }
- public function getStabilityPriority(): int
- {
- return self::$stabilities[$this->getStability()];
- }
- public function __clone()
- {
- $this->repository = null;
- $this->id = -1;
- }
- public static function packageNameToRegexp(string $allowPattern, string $wrap = '{^%s$}i'): string
- {
- $cleanedAllowPattern = str_replace('\\*', '.*', preg_quote($allowPattern));
- return sprintf($wrap, $cleanedAllowPattern);
- }
- public static function packageNamesToRegexp(array $packageNames, string $wrap = '{^(?:%s)$}iD'): string
- {
- $packageNames = array_map(
- static function ($packageName): string {
- return BasePackage::packageNameToRegexp($packageName, '%s');
- },
- $packageNames
- );
- return sprintf($wrap, implode('|', $packageNames));
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Package\Comparer;
- use Composer\Util\Platform;
- class Comparer
- {
- private $source;
- private $update;
- private $changed;
- public function setSource(string $source): void
- {
- $this->source = $source;
- }
- public function setUpdate(string $update): void
- {
- $this->update = $update;
- }
- public function getChanged(bool $explicated = false)
- {
- $changed = $this->changed;
- if (!count($changed)) {
- return false;
- }
- if ($explicated) {
- foreach ($changed as $sectionKey => $itemSection) {
- foreach ($itemSection as $itemKey => $item) {
- $changed[$sectionKey][$itemKey] = $item.' ('.$sectionKey.')';
- }
- }
- }
- return $changed;
- }
- public function getChangedAsString(bool $toString = false, bool $explicated = false): string
- {
- $changed = $this->getChanged($explicated);
- if (false === $changed) {
- return '';
- }
- $strings = [];
- foreach ($changed as $sectionKey => $itemSection) {
- foreach ($itemSection as $itemKey => $item) {
- $strings[] = $item."\r\n";
- }
- }
- return trim(implode("\r\n", $strings));
- }
- public function doCompare(): void
- {
- $source = [];
- $destination = [];
- $this->changed = [];
- $currentDirectory = Platform::getCwd();
- chdir($this->source);
- $source = $this->doTree('.', $source);
- if (!is_array($source)) {
- return;
- }
- chdir($currentDirectory);
- chdir($this->update);
- $destination = $this->doTree('.', $destination);
- if (!is_array($destination)) {
- exit;
- }
- chdir($currentDirectory);
- foreach ($source as $dir => $value) {
- foreach ($value as $file => $hash) {
- if (isset($destination[$dir][$file])) {
- if ($hash !== $destination[$dir][$file]) {
- $this->changed['changed'][] = $dir.'/'.$file;
- }
- } else {
- $this->changed['removed'][] = $dir.'/'.$file;
- }
- }
- }
- foreach ($destination as $dir => $value) {
- foreach ($value as $file => $hash) {
- if (!isset($source[$dir][$file])) {
- $this->changed['added'][] = $dir.'/'.$file;
- }
- }
- }
- }
- private function doTree(string $dir, array &$array)
- {
- if ($dh = opendir($dir)) {
- while ($file = readdir($dh)) {
- if ($file !== '.' && $file !== '..') {
- if (is_link($dir.'/'.$file)) {
- $array[$dir][$file] = readlink($dir.'/'.$file);
- } elseif (is_dir($dir.'/'.$file)) {
- if (!count($array)) {
- $array[0] = 'Temp';
- }
- if (!$this->doTree($dir.'/'.$file, $array)) {
- return false;
- }
- } elseif (is_file($dir.'/'.$file) && filesize($dir.'/'.$file)) {
- $array[$dir][$file] = md5_file($dir.'/'.$file);
- }
- }
- }
- if (count($array) > 1 && isset($array['0'])) {
- unset($array['0']);
- }
- return $array;
- }
- return false;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Package;
- class CompleteAliasPackage extends AliasPackage implements CompletePackageInterface
- {
- protected $aliasOf;
- public function __construct(CompletePackage $aliasOf, string $version, string $prettyVersion)
- {
- parent::__construct($aliasOf, $version, $prettyVersion);
- }
- public function getAliasOf()
- {
- return $this->aliasOf;
- }
- public function getScripts(): array
- {
- return $this->aliasOf->getScripts();
- }
- public function setScripts(array $scripts): void
- {
- $this->aliasOf->setScripts($scripts);
- }
- public function getRepositories(): array
- {
- return $this->aliasOf->getRepositories();
- }
- public function setRepositories(array $repositories): void
- {
- $this->aliasOf->setRepositories($repositories);
- }
- public function getLicense(): array
- {
- return $this->aliasOf->getLicense();
- }
- public function setLicense(array $license): void
- {
- $this->aliasOf->setLicense($license);
- }
- public function getKeywords(): array
- {
- return $this->aliasOf->getKeywords();
- }
- public function setKeywords(array $keywords): void
- {
- $this->aliasOf->setKeywords($keywords);
- }
- public function getDescription(): ?string
- {
- return $this->aliasOf->getDescription();
- }
- public function setDescription(?string $description): void
- {
- $this->aliasOf->setDescription($description);
- }
- public function getHomepage(): ?string
- {
- return $this->aliasOf->getHomepage();
- }
- public function setHomepage(?string $homepage): void
- {
- $this->aliasOf->setHomepage($homepage);
- }
- public function getAuthors(): array
- {
- return $this->aliasOf->getAuthors();
- }
- public function setAuthors(array $authors): void
- {
- $this->aliasOf->setAuthors($authors);
- }
- public function getSupport(): array
- {
- return $this->aliasOf->getSupport();
- }
- public function setSupport(array $support): void
- {
- $this->aliasOf->setSupport($support);
- }
- public function getFunding(): array
- {
- return $this->aliasOf->getFunding();
- }
- public function setFunding(array $funding): void
- {
- $this->aliasOf->setFunding($funding);
- }
- public function isAbandoned(): bool
- {
- return $this->aliasOf->isAbandoned();
- }
- public function getReplacementPackage(): ?string
- {
- return $this->aliasOf->getReplacementPackage();
- }
- public function setAbandoned($abandoned): void
- {
- $this->aliasOf->setAbandoned($abandoned);
- }
- public function getArchiveName(): ?string
- {
- return $this->aliasOf->getArchiveName();
- }
- public function setArchiveName(?string $name): void
- {
- $this->aliasOf->setArchiveName($name);
- }
- public function getArchiveExcludes(): array
- {
- return $this->aliasOf->getArchiveExcludes();
- }
- public function setArchiveExcludes(array $excludes): void
- {
- $this->aliasOf->setArchiveExcludes($excludes);
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Package;
- class CompletePackage extends Package implements CompletePackageInterface
- {
- protected $repositories = [];
- protected $license = [];
- protected $keywords = [];
- protected $authors = [];
- protected $description = null;
- protected $homepage = null;
- protected $scripts = [];
- protected $support = [];
- protected $funding = [];
- protected $abandoned = false;
- protected $archiveName = null;
- protected $archiveExcludes = [];
- public function setScripts(array $scripts): void
- {
- $this->scripts = $scripts;
- }
- public function getScripts(): array
- {
- return $this->scripts;
- }
- public function setRepositories(array $repositories): void
- {
- $this->repositories = $repositories;
- }
- public function getRepositories(): array
- {
- return $this->repositories;
- }
- public function setLicense(array $license): void
- {
- $this->license = $license;
- }
- public function getLicense(): array
- {
- return $this->license;
- }
- public function setKeywords(array $keywords): void
- {
- $this->keywords = $keywords;
- }
- public function getKeywords(): array
- {
- return $this->keywords;
- }
- public function setAuthors(array $authors): void
- {
- $this->authors = $authors;
- }
- public function getAuthors(): array
- {
- return $this->authors;
- }
- public function setDescription(?string $description): void
- {
- $this->description = $description;
- }
- public function getDescription(): ?string
- {
- return $this->description;
- }
- public function setHomepage(?string $homepage): void
- {
- $this->homepage = $homepage;
- }
- public function getHomepage(): ?string
- {
- return $this->homepage;
- }
- public function setSupport(array $support): void
- {
- $this->support = $support;
- }
- public function getSupport(): array
- {
- return $this->support;
- }
- public function setFunding(array $funding): void
- {
- $this->funding = $funding;
- }
- public function getFunding(): array
- {
- return $this->funding;
- }
- public function isAbandoned(): bool
- {
- return (bool) $this->abandoned;
- }
- public function setAbandoned($abandoned): void
- {
- $this->abandoned = $abandoned;
- }
- public function getReplacementPackage(): ?string
- {
- return \is_string($this->abandoned) ? $this->abandoned : null;
- }
- public function setArchiveName(?string $name): void
- {
- $this->archiveName = $name;
- }
- public function getArchiveName(): ?string
- {
- return $this->archiveName;
- }
- public function setArchiveExcludes(array $excludes): void
- {
- $this->archiveExcludes = $excludes;
- }
- public function getArchiveExcludes(): array
- {
- return $this->archiveExcludes;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Package;
- interface CompletePackageInterface extends PackageInterface
- {
- public function getScripts(): array;
- public function setScripts(array $scripts): void;
- public function getRepositories(): array;
- public function setRepositories(array $repositories): void;
- public function getLicense(): array;
- public function setLicense(array $license): void;
- public function getKeywords(): array;
- public function setKeywords(array $keywords): void;
- public function getDescription(): ?string;
- public function setDescription(string $description): void;
- public function getHomepage(): ?string;
- public function setHomepage(string $homepage): void;
- public function getAuthors(): array;
- public function setAuthors(array $authors): void;
- public function getSupport(): array;
- public function setSupport(array $support): void;
- public function getFunding(): array;
- public function setFunding(array $funding): void;
- public function isAbandoned(): bool;
- public function getReplacementPackage(): ?string;
- public function setAbandoned($abandoned): void;
- public function getArchiveName(): ?string;
- public function setArchiveName(string $name): void;
- public function getArchiveExcludes(): array;
- public function setArchiveExcludes(array $excludes): void;
- }
- <?php declare(strict_types=1);
- namespace Composer\Package\Dumper;
- use Composer\Package\BasePackage;
- use Composer\Package\PackageInterface;
- use Composer\Package\CompletePackageInterface;
- use Composer\Package\RootPackageInterface;
- class ArrayDumper
- {
- public function dump(PackageInterface $package): array
- {
- $keys = [
- 'binaries' => 'bin',
- 'type',
- 'extra',
- 'installationSource' => 'installation-source',
- 'autoload',
- 'devAutoload' => 'autoload-dev',
- 'notificationUrl' => 'notification-url',
- 'includePaths' => 'include-path',
- ];
- $data = [];
- $data['name'] = $package->getPrettyName();
- $data['version'] = $package->getPrettyVersion();
- $data['version_normalized'] = $package->getVersion();
- if ($package->getTargetDir()) {
- $data['target-dir'] = $package->getTargetDir();
- }
- if ($package->getSourceType()) {
- $data['source']['type'] = $package->getSourceType();
- $data['source']['url'] = $package->getSourceUrl();
- if (null !== ($value = $package->getSourceReference())) {
- $data['source']['reference'] = $value;
- }
- if ($mirrors = $package->getSourceMirrors()) {
- $data['source']['mirrors'] = $mirrors;
- }
- }
- if ($package->getDistType()) {
- $data['dist']['type'] = $package->getDistType();
- $data['dist']['url'] = $package->getDistUrl();
- if (null !== ($value = $package->getDistReference())) {
- $data['dist']['reference'] = $value;
- }
- if (null !== ($value = $package->getDistSha1Checksum())) {
- $data['dist']['shasum'] = $value;
- }
- if ($mirrors = $package->getDistMirrors()) {
- $data['dist']['mirrors'] = $mirrors;
- }
- }
- foreach (BasePackage::$supportedLinkTypes as $type => $opts) {
- if ($links = $package->{'get'.ucfirst($opts['method'])}()) {
- foreach ($links as $link) {
- $data[$type][$link->getTarget()] = $link->getPrettyConstraint();
- }
- ksort($data[$type]);
- }
- }
- if ($packages = $package->getSuggests()) {
- ksort($packages);
- $data['suggest'] = $packages;
- }
- if ($package->getReleaseDate() instanceof \DateTimeInterface) {
- $data['time'] = $package->getReleaseDate()->format(DATE_RFC3339);
- }
- if ($package->isDefaultBranch()) {
- $data['default-branch'] = true;
- }
- $data = $this->dumpValues($package, $keys, $data);
- if ($package instanceof CompletePackageInterface) {
- if ($package->getArchiveName()) {
- $data['archive']['name'] = $package->getArchiveName();
- }
- if ($package->getArchiveExcludes()) {
- $data['archive']['exclude'] = $package->getArchiveExcludes();
- }
- $keys = [
- 'scripts',
- 'license',
- 'authors',
- 'description',
- 'homepage',
- 'keywords',
- 'repositories',
- 'support',
- 'funding',
- ];
- $data = $this->dumpValues($package, $keys, $data);
- if (isset($data['keywords']) && \is_array($data['keywords'])) {
- sort($data['keywords']);
- }
- if ($package->isAbandoned()) {
- $data['abandoned'] = $package->getReplacementPackage() ?: true;
- }
- }
- if ($package instanceof RootPackageInterface) {
- $minimumStability = $package->getMinimumStability();
- if ($minimumStability) {
- $data['minimum-stability'] = $minimumStability;
- }
- }
- if (\count($package->getTransportOptions()) > 0) {
- $data['transport-options'] = $package->getTransportOptions();
- }
- return $data;
- }
- private function dumpValues(PackageInterface $package, array $keys, array $data): array
- {
- foreach ($keys as $method => $key) {
- if (is_numeric($method)) {
- $method = $key;
- }
- $getter = 'get'.ucfirst($method);
- $value = $package->{$getter}();
- if (null !== $value && !(\is_array($value) && 0 === \count($value))) {
- $data[$key] = $value;
- }
- }
- return $data;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Package;
- use Composer\Semver\Constraint\ConstraintInterface;
- class Link
- {
- public const TYPE_REQUIRE = 'requires';
- public const TYPE_DEV_REQUIRE = 'devRequires';
- public const TYPE_PROVIDE = 'provides';
- public const TYPE_CONFLICT = 'conflicts';
- public const TYPE_REPLACE = 'replaces';
- public const TYPE_DOES_NOT_REQUIRE = 'does not require';
- private const TYPE_UNKNOWN = 'relates to';
- public static $TYPES = [
- self::TYPE_REQUIRE,
- self::TYPE_DEV_REQUIRE,
- self::TYPE_PROVIDE,
- self::TYPE_CONFLICT,
- self::TYPE_REPLACE,
- ];
- protected $source;
- protected $target;
- protected $constraint;
- protected $description;
- protected $prettyConstraint;
- public function __construct(
- string $source,
- string $target,
- ConstraintInterface $constraint,
- $description = self::TYPE_UNKNOWN,
- ?string $prettyConstraint = null
- ) {
- $this->source = strtolower($source);
- $this->target = strtolower($target);
- $this->constraint = $constraint;
- $this->description = self::TYPE_DEV_REQUIRE === $description ? 'requires (for development)' : $description;
- $this->prettyConstraint = $prettyConstraint;
- }
- public function getDescription(): string
- {
- return $this->description;
- }
- public function getSource(): string
- {
- return $this->source;
- }
- public function getTarget(): string
- {
- return $this->target;
- }
- public function getConstraint(): ConstraintInterface
- {
- return $this->constraint;
- }
- public function getPrettyConstraint(): string
- {
- if (null === $this->prettyConstraint) {
- throw new \UnexpectedValueException(sprintf('Link %s has been misconfigured and had no prettyConstraint given.', $this));
- }
- return $this->prettyConstraint;
- }
- public function __toString(): string
- {
- return $this->source.' '.$this->description.' '.$this->target.' ('.$this->constraint.')';
- }
- public function getPrettyString(PackageInterface $sourcePackage): string
- {
- return $sourcePackage->getPrettyString().' '.$this->description.' '.$this->target.' '.$this->constraint->getPrettyString();
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Package\Loader;
- use Composer\Package\BasePackage;
- use Composer\Package\CompleteAliasPackage;
- use Composer\Package\CompletePackage;
- use Composer\Package\RootPackage;
- use Composer\Package\PackageInterface;
- use Composer\Package\CompletePackageInterface;
- use Composer\Package\Link;
- use Composer\Package\RootAliasPackage;
- use Composer\Package\Version\VersionParser;
- use Composer\Pcre\Preg;
- class ArrayLoader implements LoaderInterface
- {
- protected $versionParser;
- protected $loadOptions;
- public function __construct(?VersionParser $parser = null, bool $loadOptions = false)
- {
- if (!$parser) {
- $parser = new VersionParser;
- }
- $this->versionParser = $parser;
- $this->loadOptions = $loadOptions;
- }
- public function load(array $config, string $class = 'Composer\Package\CompletePackage'): BasePackage
- {
- if ($class !== 'Composer\Package\CompletePackage' && $class !== 'Composer\Package\RootPackage') {
- trigger_error('The $class arg is deprecated, please reach out to Composer maintainers ASAP if you still need this.', E_USER_DEPRECATED);
- }
- $package = $this->createObject($config, $class);
- foreach (BasePackage::$supportedLinkTypes as $type => $opts) {
- if (!isset($config[$type]) || !is_array($config[$type])) {
- continue;
- }
- $method = 'set'.ucfirst($opts['method']);
- $package->{$method}(
- $this->parseLinks(
- $package->getName(),
- $package->getPrettyVersion(),
- $opts['method'],
- $config[$type]
- )
- );
- }
- $package = $this->configureObject($package, $config);
- return $package;
- }
- public function loadPackages(array $versions): array
- {
- $packages = [];
- $linkCache = [];
- foreach ($versions as $version) {
- $package = $this->createObject($version, 'Composer\Package\CompletePackage');
- $this->configureCachedLinks($linkCache, $package, $version);
- $package = $this->configureObject($package, $version);
- $packages[] = $package;
- }
- return $packages;
- }
- private function createObject(array $config, string $class): CompletePackage
- {
- if (!isset($config['name'])) {
- throw new \UnexpectedValueException('Unknown package has no name defined ('.json_encode($config).').');
- }
- if (!isset($config['version']) || !is_scalar($config['version'])) {
- throw new \UnexpectedValueException('Package '.$config['name'].' has no version defined.');
- }
- if (!is_string($config['version'])) {
- $config['version'] = (string) $config['version'];
- }
- if (isset($config['version_normalized']) && is_string($config['version_normalized'])) {
- $version = $config['version_normalized'];
- if ($version === VersionParser::DEFAULT_BRANCH_ALIAS) {
- $version = $this->versionParser->normalize($config['version']);
- }
- } else {
- $version = $this->versionParser->normalize($config['version']);
- }
- return new $class($config['name'], $version, $config['version']);
- }
- private function configureObject(PackageInterface $package, array $config): BasePackage
- {
- if (!$package instanceof CompletePackage) {
- throw new \LogicException('ArrayLoader expects instances of the Composer\Package\CompletePackage class to function correctly');
- }
- $package->setType(isset($config['type']) ? strtolower($config['type']) : 'library');
- if (isset($config['target-dir'])) {
- $package->setTargetDir($config['target-dir']);
- }
- if (isset($config['extra']) && \is_array($config['extra'])) {
- $package->setExtra($config['extra']);
- }
- if (isset($config['bin'])) {
- if (!\is_array($config['bin'])) {
- $config['bin'] = [$config['bin']];
- }
- foreach ($config['bin'] as $key => $bin) {
- $config['bin'][$key] = ltrim($bin, '/');
- }
- $package->setBinaries($config['bin']);
- }
- if (isset($config['installation-source'])) {
- $package->setInstallationSource($config['installation-source']);
- }
- if (isset($config['default-branch']) && $config['default-branch'] === true) {
- $package->setIsDefaultBranch(true);
- }
- if (isset($config['source'])) {
- if (!isset($config['source']['type'], $config['source']['url'], $config['source']['reference'])) {
- throw new \UnexpectedValueException(sprintf(
- "Package %s's source key should be specified as {\"type\": ..., \"url\": ..., \"reference\": ...},\n%s given.",
- $config['name'],
- json_encode($config['source'])
- ));
- }
- $package->setSourceType($config['source']['type']);
- $package->setSourceUrl($config['source']['url']);
- $package->setSourceReference(isset($config['source']['reference']) ? (string) $config['source']['reference'] : null);
- if (isset($config['source']['mirrors'])) {
- $package->setSourceMirrors($config['source']['mirrors']);
- }
- }
- if (isset($config['dist'])) {
- if (!isset($config['dist']['type'], $config['dist']['url'])) {
- throw new \UnexpectedValueException(sprintf(
- "Package %s's dist key should be specified as ".
- "{\"type\": ..., \"url\": ..., \"reference\": ..., \"shasum\": ...},\n%s given.",
- $config['name'],
- json_encode($config['dist'])
- ));
- }
- $package->setDistType($config['dist']['type']);
- $package->setDistUrl($config['dist']['url']);
- $package->setDistReference(isset($config['dist']['reference']) ? (string) $config['dist']['reference'] : null);
- $package->setDistSha1Checksum($config['dist']['shasum'] ?? null);
- if (isset($config['dist']['mirrors'])) {
- $package->setDistMirrors($config['dist']['mirrors']);
- }
- }
- if (isset($config['suggest']) && \is_array($config['suggest'])) {
- foreach ($config['suggest'] as $target => $reason) {
- if ('self.version' === trim($reason)) {
- $config['suggest'][$target] = $package->getPrettyVersion();
- }
- }
- $package->setSuggests($config['suggest']);
- }
- if (isset($config['autoload'])) {
- $package->setAutoload($config['autoload']);
- }
- if (isset($config['autoload-dev'])) {
- $package->setDevAutoload($config['autoload-dev']);
- }
- if (isset($config['include-path'])) {
- $package->setIncludePaths($config['include-path']);
- }
- if (!empty($config['time'])) {
- $time = Preg::isMatch('/^\d++$/D', $config['time']) ? '@'.$config['time'] : $config['time'];
- try {
- $date = new \DateTime($time, new \DateTimeZone('UTC'));
- $package->setReleaseDate($date);
- } catch (\Exception $e) {
- }
- }
- if (!empty($config['notification-url'])) {
- $package->setNotificationUrl($config['notification-url']);
- }
- if ($package instanceof CompletePackageInterface) {
- if (!empty($config['archive']['name'])) {
- $package->setArchiveName($config['archive']['name']);
- }
- if (!empty($config['archive']['exclude'])) {
- $package->setArchiveExcludes($config['archive']['exclude']);
- }
- if (isset($config['scripts']) && \is_array($config['scripts'])) {
- foreach ($config['scripts'] as $event => $listeners) {
- $config['scripts'][$event] = (array) $listeners;
- }
- foreach (['composer', 'php', 'putenv'] as $reserved) {
- if (isset($config['scripts'][$reserved])) {
- trigger_error('The `'.$reserved.'` script name is reserved for internal use, please avoid defining it', E_USER_DEPRECATED);
- }
- }
- $package->setScripts($config['scripts']);
- }
- if (!empty($config['description']) && \is_string($config['description'])) {
- $package->setDescription($config['description']);
- }
- if (!empty($config['homepage']) && \is_string($config['homepage'])) {
- $package->setHomepage($config['homepage']);
- }
- if (!empty($config['keywords']) && \is_array($config['keywords'])) {
- $package->setKeywords($config['keywords']);
- }
- if (!empty($config['license'])) {
- $package->setLicense(\is_array($config['license']) ? $config['license'] : [$config['license']]);
- }
- if (!empty($config['authors']) && \is_array($config['authors'])) {
- $package->setAuthors($config['authors']);
- }
- if (isset($config['support'])) {
- $package->setSupport($config['support']);
- }
- if (!empty($config['funding']) && \is_array($config['funding'])) {
- $package->setFunding($config['funding']);
- }
- if (isset($config['abandoned'])) {
- $package->setAbandoned($config['abandoned']);
- }
- }
- if ($this->loadOptions && isset($config['transport-options'])) {
- $package->setTransportOptions($config['transport-options']);
- }
- if ($aliasNormalized = $this->getBranchAlias($config)) {
- $prettyAlias = Preg::replace('{(\.9{7})+}', '.x', $aliasNormalized);
- if ($package instanceof RootPackage) {
- return new RootAliasPackage($package, $aliasNormalized, $prettyAlias);
- }
- return new CompleteAliasPackage($package, $aliasNormalized, $prettyAlias);
- }
- return $package;
- }
- private function configureCachedLinks(array &$linkCache, PackageInterface $package, array $config): void
- {
- $name = $package->getName();
- $prettyVersion = $package->getPrettyVersion();
- foreach (BasePackage::$supportedLinkTypes as $type => $opts) {
- if (isset($config[$type])) {
- $method = 'set'.ucfirst($opts['method']);
- $links = [];
- foreach ($config[$type] as $prettyTarget => $constraint) {
- $target = strtolower($prettyTarget);
- if ($target === $name) {
- continue;
- }
- if ($constraint === 'self.version') {
- $links[$target] = $this->createLink($name, $prettyVersion, $opts['method'], $target, $constraint);
- } else {
- if (!isset($linkCache[$name][$type][$target][$constraint])) {
- $linkCache[$name][$type][$target][$constraint] = [$target, $this->createLink($name, $prettyVersion, $opts['method'], $target, $constraint)];
- }
- [$target, $link] = $linkCache[$name][$type][$target][$constraint];
- $links[$target] = $link;
- }
- }
- $package->{$method}($links);
- }
- }
- }
- public function parseLinks(string $source, string $sourceVersion, string $description, array $links): array
- {
- $res = [];
- foreach ($links as $target => $constraint) {
- if (!is_string($constraint)) {
- continue;
- }
- $target = strtolower((string) $target);
- $res[$target] = $this->createLink($source, $sourceVersion, $description, $target, $constraint);
- }
- return $res;
- }
- private function createLink(string $source, string $sourceVersion, string $description, string $target, string $prettyConstraint): Link
- {
- if (!\is_string($prettyConstraint)) {
- throw new \UnexpectedValueException('Link constraint in '.$source.' '.$description.' > '.$target.' should be a string, got '.\gettype($prettyConstraint) . ' (' . var_export($prettyConstraint, true) . ')');
- }
- if ('self.version' === $prettyConstraint) {
- $parsedConstraint = $this->versionParser->parseConstraints($sourceVersion);
- } else {
- $parsedConstraint = $this->versionParser->parseConstraints($prettyConstraint);
- }
- return new Link($source, $target, $parsedConstraint, $description, $prettyConstraint);
- }
- public function getBranchAlias(array $config): ?string
- {
- if (!isset($config['version']) || !is_scalar($config['version'])) {
- throw new \UnexpectedValueException('no/invalid version defined');
- }
- if (!is_string($config['version'])) {
- $config['version'] = (string) $config['version'];
- }
- if (strpos($config['version'], 'dev-') !== 0 && '-dev' !== substr($config['version'], -4)) {
- return null;
- }
- if (isset($config['extra']['branch-alias']) && \is_array($config['extra']['branch-alias'])) {
- foreach ($config['extra']['branch-alias'] as $sourceBranch => $targetBranch) {
- $sourceBranch = (string) $sourceBranch;
- if ('-dev' !== substr($targetBranch, -4)) {
- continue;
- }
- if ($targetBranch === VersionParser::DEFAULT_BRANCH_ALIAS) {
- $validatedTargetBranch = VersionParser::DEFAULT_BRANCH_ALIAS;
- } else {
- $validatedTargetBranch = $this->versionParser->normalizeBranch(substr($targetBranch, 0, -4));
- }
- if ('-dev' !== substr($validatedTargetBranch, -4)) {
- continue;
- }
- if (strtolower($config['version']) !== strtolower($sourceBranch)) {
- continue;
- }
- if (($sourcePrefix = $this->versionParser->parseNumericAliasPrefix($sourceBranch))
- && ($targetPrefix = $this->versionParser->parseNumericAliasPrefix($targetBranch))
- && (stripos($targetPrefix, $sourcePrefix) !== 0)
- ) {
- continue;
- }
- return $validatedTargetBranch;
- }
- }
- if (
- isset($config['default-branch'])
- && $config['default-branch'] === true
- && false === $this->versionParser->parseNumericAliasPrefix($config['version'])
- ) {
- return VersionParser::DEFAULT_BRANCH_ALIAS;
- }
- return null;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Package\Loader;
- class InvalidPackageException extends \Exception
- {
- private $errors;
- private $warnings;
- private $data;
- public function __construct(array $errors, array $warnings, array $data)
- {
- $this->errors = $errors;
- $this->warnings = $warnings;
- $this->data = $data;
- parent::__construct("Invalid package information: \n".implode("\n", array_merge($errors, $warnings)));
- }
- public function getData(): array
- {
- return $this->data;
- }
- public function getErrors(): array
- {
- return $this->errors;
- }
- public function getWarnings(): array
- {
- return $this->warnings;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Package\Loader;
- use Composer\Json\JsonFile;
- use Composer\Package\BasePackage;
- use Composer\Package\CompletePackage;
- use Composer\Package\CompleteAliasPackage;
- use Composer\Package\RootPackage;
- use Composer\Package\RootAliasPackage;
- class JsonLoader
- {
- private $loader;
- public function __construct(LoaderInterface $loader)
- {
- $this->loader = $loader;
- }
- public function load($json): BasePackage
- {
- if ($json instanceof JsonFile) {
- $config = $json->read();
- } elseif (file_exists($json)) {
- $config = JsonFile::parseJson(file_get_contents($json), $json);
- } elseif (is_string($json)) {
- $config = JsonFile::parseJson($json);
- } else {
- throw new \InvalidArgumentException(sprintf(
- "JsonLoader: Unknown \$json parameter %s. Please report at https://github.com/composer/composer/issues/new.",
- gettype($json)
- ));
- }
- return $this->loader->load($config);
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Package\Loader;
- use Composer\Package\CompletePackage;
- use Composer\Package\CompleteAliasPackage;
- use Composer\Package\RootAliasPackage;
- use Composer\Package\RootPackage;
- use Composer\Package\BasePackage;
- interface LoaderInterface
- {
- public function load(array $config, string $class = 'Composer\Package\CompletePackage'): BasePackage;
- }
- <?php declare(strict_types=1);
- namespace Composer\Package\Loader;
- use Composer\Package\BasePackage;
- use Composer\Config;
- use Composer\IO\IOInterface;
- use Composer\Package\RootAliasPackage;
- use Composer\Pcre\Preg;
- use Composer\Repository\RepositoryFactory;
- use Composer\Package\Version\VersionGuesser;
- use Composer\Package\Version\VersionParser;
- use Composer\Package\RootPackage;
- use Composer\Repository\RepositoryManager;
- use Composer\Util\Platform;
- use Composer\Util\ProcessExecutor;
- class RootPackageLoader extends ArrayLoader
- {
- private $manager;
- private $config;
- private $versionGuesser;
- public function __construct(RepositoryManager $manager, Config $config, ?VersionParser $parser = null, ?VersionGuesser $versionGuesser = null, ?IOInterface $io = null)
- {
- parent::__construct($parser);
- $this->manager = $manager;
- $this->config = $config;
- $this->versionGuesser = $versionGuesser ?: new VersionGuesser($config, new ProcessExecutor($io), $this->versionParser);
- }
- public function load(array $config, string $class = 'Composer\Package\RootPackage', ?string $cwd = null): BasePackage
- {
- if ($class !== 'Composer\Package\RootPackage') {
- trigger_error('The $class arg is deprecated, please reach out to Composer maintainers ASAP if you still need this.', E_USER_DEPRECATED);
- }
- if (!isset($config['name'])) {
- $config['name'] = '__root__';
- } elseif ($err = ValidatingArrayLoader::hasPackageNamingError($config['name'])) {
- throw new \RuntimeException('Your package name '.$err);
- }
- $autoVersioned = false;
- if (!isset($config['version'])) {
- $commit = null;
- if (Platform::getEnv('COMPOSER_ROOT_VERSION')) {
- $config['version'] = Platform::getEnv('COMPOSER_ROOT_VERSION');
- } else {
- $versionData = $this->versionGuesser->guessVersion($config, $cwd ?? Platform::getCwd(true));
- if ($versionData) {
- $config['version'] = $versionData['pretty_version'];
- $config['version_normalized'] = $versionData['version'];
- $commit = $versionData['commit'];
- }
- }
- if (!isset($config['version'])) {
- $config['version'] = '1.0.0';
- $autoVersioned = true;
- }
- if ($commit) {
- $config['source'] = [
- 'type' => '',
- 'url' => '',
- 'reference' => $commit,
- ];
- $config['dist'] = [
- 'type' => '',
- 'url' => '',
- 'reference' => $commit,
- ];
- }
- }
- $package = parent::load($config, $class);
- if ($package instanceof RootAliasPackage) {
- $realPackage = $package->getAliasOf();
- } else {
- $realPackage = $package;
- }
- if (!$realPackage instanceof RootPackage) {
- throw new \LogicException('Expecting a Composer\Package\RootPackage at this point');
- }
- if ($autoVersioned) {
- $realPackage->replaceVersion($realPackage->getVersion(), RootPackage::DEFAULT_PRETTY_VERSION);
- }
- if (isset($config['minimum-stability'])) {
- $realPackage->setMinimumStability(VersionParser::normalizeStability($config['minimum-stability']));
- }
- $aliases = [];
- $stabilityFlags = [];
- $references = [];
- foreach (['require', 'require-dev'] as $linkType) {
- if (isset($config[$linkType])) {
- $linkInfo = BasePackage::$supportedLinkTypes[$linkType];
- $method = 'get'.ucfirst($linkInfo['method']);
- $links = [];
- foreach ($realPackage->{$method}() as $link) {
- $links[$link->getTarget()] = $link->getConstraint()->getPrettyString();
- }
- $aliases = $this->extractAliases($links, $aliases);
- $stabilityFlags = self::extractStabilityFlags($links, $realPackage->getMinimumStability(), $stabilityFlags);
- $references = self::extractReferences($links, $references);
- if (isset($links[$config['name']])) {
- throw new \RuntimeException(sprintf('Root package \'%s\' cannot require itself in its composer.json' . PHP_EOL .
- 'Did you accidentally name your root package after an external package?', $config['name']));
- }
- }
- }
- foreach (array_keys(BasePackage::$supportedLinkTypes) as $linkType) {
- if (isset($config[$linkType])) {
- foreach ($config[$linkType] as $linkName => $constraint) {
- if ($err = ValidatingArrayLoader::hasPackageNamingError($linkName, true)) {
- throw new \RuntimeException($linkType.'.'.$err);
- }
- }
- }
- }
- $realPackage->setAliases($aliases);
- $realPackage->setStabilityFlags($stabilityFlags);
- $realPackage->setReferences($references);
- if (isset($config['prefer-stable'])) {
- $realPackage->setPreferStable((bool) $config['prefer-stable']);
- }
- if (isset($config['config'])) {
- $realPackage->setConfig($config['config']);
- }
- $repos = RepositoryFactory::defaultRepos(null, $this->config, $this->manager);
- foreach ($repos as $repo) {
- $this->manager->addRepository($repo);
- }
- $realPackage->setRepositories($this->config->getRepositories());
- return $package;
- }
- private function extractAliases(array $requires, array $aliases): array
- {
- foreach ($requires as $reqName => $reqVersion) {
- if (Preg::isMatch('{^([^,\s#]+)(?:#[^ ]+)? +as +([^,\s]+)$}', $reqVersion, $match)) {
- $aliases[] = [
- 'package' => strtolower($reqName),
- 'version' => $this->versionParser->normalize($match[1], $reqVersion),
- 'alias' => $match[2],
- 'alias_normalized' => $this->versionParser->normalize($match[2], $reqVersion),
- ];
- } elseif (strpos($reqVersion, ' as ') !== false) {
- throw new \UnexpectedValueException('Invalid alias definition in "'.$reqName.'": "'.$reqVersion.'". Aliases should be in the form "exact-version as other-exact-version".');
- }
- }
- return $aliases;
- }
- public static function extractStabilityFlags(array $requires, string $minimumStability, array $stabilityFlags): array
- {
- $stabilities = BasePackage::$stabilities;
- $minimumStability = $stabilities[$minimumStability];
- foreach ($requires as $reqName => $reqVersion) {
- $constraints = [];
- $orSplit = Preg::split('{\s*\|\|?\s*}', trim($reqVersion));
- foreach ($orSplit as $orConstraint) {
- $andSplit = Preg::split('{(?<!^|as|[=>< ,]) *(?<!-)[, ](?!-) *(?!,|as|$)}', $orConstraint);
- foreach ($andSplit as $andConstraint) {
- $constraints[] = $andConstraint;
- }
- }
- $matched = false;
- foreach ($constraints as $constraint) {
- if (Preg::isMatch('{^[^@]*?@('.implode('|', array_keys($stabilities)).')$}i', $constraint, $match)) {
- $name = strtolower($reqName);
- $stability = $stabilities[VersionParser::normalizeStability($match[1])];
- if (isset($stabilityFlags[$name]) && $stabilityFlags[$name] > $stability) {
- continue;
- }
- $stabilityFlags[$name] = $stability;
- $matched = true;
- }
- }
- if ($matched) {
- continue;
- }
- foreach ($constraints as $constraint) {
- $reqVersion = Preg::replace('{^([^,\s@]+) as .+$}', '$1', $constraint);
- if (Preg::isMatch('{^[^,\s@]+$}', $reqVersion) && 'stable' !== ($stabilityName = VersionParser::parseStability($reqVersion))) {
- $name = strtolower($reqName);
- $stability = $stabilities[$stabilityName];
- if ((isset($stabilityFlags[$name]) && $stabilityFlags[$name] > $stability) || ($minimumStability > $stability)) {
- continue;
- }
- $stabilityFlags[$name] = $stability;
- }
- }
- }
- return $stabilityFlags;
- }
- public static function extractReferences(array $requires, array $references): array
- {
- foreach ($requires as $reqName => $reqVersion) {
- $reqVersion = Preg::replace('{^([^,\s@]+) as .+$}', '$1', $reqVersion);
- if (Preg::isMatch('{^[^,\s@]+?#([a-f0-9]+)$}', $reqVersion, $match) && 'dev' === VersionParser::parseStability($reqVersion)) {
- $name = strtolower($reqName);
- $references[$name] = $match[1];
- }
- }
- return $references;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Package\Loader;
- use Composer\Package\BasePackage;
- use Composer\Pcre\Preg;
- use Composer\Semver\Constraint\Constraint;
- use Composer\Package\Version\VersionParser;
- use Composer\Repository\PlatformRepository;
- use Composer\Spdx\SpdxLicenses;
- class ValidatingArrayLoader implements LoaderInterface
- {
- public const CHECK_ALL = 3;
- public const CHECK_UNBOUND_CONSTRAINTS = 1;
- public const CHECK_STRICT_CONSTRAINTS = 2;
- private $loader;
- private $versionParser;
- private $errors;
- private $warnings;
- private $config;
- private $flags;
- public function __construct(LoaderInterface $loader, bool $strictName = true, ?VersionParser $parser = null, int $flags = 0)
- {
- $this->loader = $loader;
- $this->versionParser = $parser ?: new VersionParser();
- $this->flags = $flags;
- if ($strictName !== true) {
- 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);
- }
- }
- public function load(array $config, string $class = 'Composer\Package\CompletePackage'): BasePackage
- {
- $this->errors = [];
- $this->warnings = [];
- $this->config = $config;
- $this->validateString('name', true);
- if ($err = self::hasPackageNamingError($config['name'])) {
- $this->errors[] = 'name : '.$err;
- }
- if (!empty($this->config['version'])) {
- if (!is_scalar($this->config['version'])) {
- $this->validateString('version');
- } else {
- if (!is_string($this->config['version'])) {
- $this->config['version'] = (string) $this->config['version'];
- }
- try {
- $this->versionParser->normalize($this->config['version']);
- } catch (\Exception $e) {
- $this->errors[] = 'version : invalid value ('.$this->config['version'].'): '.$e->getMessage();
- unset($this->config['version']);
- }
- }
- }
- if (!empty($this->config['config']['platform'])) {
- foreach ((array) $this->config['config']['platform'] as $key => $platform) {
- if (false === $platform) {
- continue;
- }
- if (!is_string($platform)) {
- $this->errors[] = 'config.platform.' . $key . ' : invalid value ('.gettype($platform).' '.var_export($platform, true).'): expected string or false';
- continue;
- }
- try {
- $this->versionParser->normalize($platform);
- } catch (\Exception $e) {
- $this->errors[] = 'config.platform.' . $key . ' : invalid value ('.$platform.'): '.$e->getMessage();
- }
- }
- }
- $this->validateRegex('type', '[A-Za-z0-9-]+');
- $this->validateString('target-dir');
- $this->validateArray('extra');
- if (isset($this->config['bin'])) {
- if (is_string($this->config['bin'])) {
- $this->validateString('bin');
- } else {
- $this->validateFlatArray('bin');
- }
- }
- $this->validateArray('scripts');
- $this->validateString('description');
- $this->validateUrl('homepage');
- $this->validateFlatArray('keywords', '[\p{N}\p{L} ._-]+');
- $releaseDate = null;
- $this->validateString('time');
- if (!empty($this->config['time'])) {
- try {
- $releaseDate = new \DateTime($this->config['time'], new \DateTimeZone('UTC'));
- } catch (\Exception $e) {
- $this->errors[] = 'time : invalid value ('.$this->config['time'].'): '.$e->getMessage();
- unset($this->config['time']);
- }
- }
- if (isset($this->config['license']) && (!$releaseDate || $releaseDate->getTimestamp() >= strtotime('-8days'))) {
- if (is_array($this->config['license']) || is_string($this->config['license'])) {
- $licenses = (array) $this->config['license'];
- $licenseValidator = new SpdxLicenses();
- foreach ($licenses as $license) {
- if ('proprietary' === $license) {
- continue;
- }
- $licenseToValidate = str_replace('proprietary', 'MIT', $license);
- if (!$licenseValidator->validate($licenseToValidate)) {
- if ($licenseValidator->validate(trim($licenseToValidate))) {
- $this->warnings[] = sprintf(
- 'License %s must not contain extra spaces, make sure to trim it.',
- json_encode($license)
- );
- } else {
- $this->warnings[] = sprintf(
- 'License %s is not a valid SPDX license identifier, see https://spdx.org/licenses/ if you use an open license.' . PHP_EOL .
- 'If the software is closed-source, you may use "proprietary" as license.',
- json_encode($license)
- );
- }
- }
- }
- }
- }
- if ($this->validateArray('authors') && !empty($this->config['authors'])) {
- foreach ($this->config['authors'] as $key => $author) {
- if (!is_array($author)) {
- $this->errors[] = 'authors.'.$key.' : should be an array, '.gettype($author).' given';
- unset($this->config['authors'][$key]);
- continue;
- }
- foreach (['homepage', 'email', 'name', 'role'] as $authorData) {
- if (isset($author[$authorData]) && !is_string($author[$authorData])) {
- $this->errors[] = 'authors.'.$key.'.'.$authorData.' : invalid value, must be a string';
- unset($this->config['authors'][$key][$authorData]);
- }
- }
- if (isset($author['homepage']) && !$this->filterUrl($author['homepage'])) {
- $this->warnings[] = 'authors.'.$key.'.homepage : invalid value ('.$author['homepage'].'), must be an http/https URL';
- unset($this->config['authors'][$key]['homepage']);
- }
- if (isset($author['email']) && !filter_var($author['email'], FILTER_VALIDATE_EMAIL)) {
- $this->warnings[] = 'authors.'.$key.'.email : invalid value ('.$author['email'].'), must be a valid email address';
- unset($this->config['authors'][$key]['email']);
- }
- if (empty($this->config['authors'][$key])) {
- unset($this->config['authors'][$key]);
- }
- }
- if (empty($this->config['authors'])) {
- unset($this->config['authors']);
- }
- }
- if ($this->validateArray('support') && !empty($this->config['support'])) {
- foreach (['issues', 'forum', 'wiki', 'source', 'email', 'irc', 'docs', 'rss', 'chat'] as $key) {
- if (isset($this->config['support'][$key]) && !is_string($this->config['support'][$key])) {
- $this->errors[] = 'support.'.$key.' : invalid value, must be a string';
- unset($this->config['support'][$key]);
- }
- }
- if (isset($this->config['support']['email']) && !filter_var($this->config['support']['email'], FILTER_VALIDATE_EMAIL)) {
- $this->warnings[] = 'support.email : invalid value ('.$this->config['support']['email'].'), must be a valid email address';
- unset($this->config['support']['email']);
- }
- if (isset($this->config['support']['irc']) && !$this->filterUrl($this->config['support']['irc'], ['irc', 'ircs'])) {
- $this->warnings[] = 'support.irc : invalid value ('.$this->config['support']['irc'].'), must be a irc://<server>/<channel> or ircs:// URL';
- unset($this->config['support']['irc']);
- }
- foreach (['issues', 'forum', 'wiki', 'source', 'docs', 'chat'] as $key) {
- if (isset($this->config['support'][$key]) && !$this->filterUrl($this->config['support'][$key])) {
- $this->warnings[] = 'support.'.$key.' : invalid value ('.$this->config['support'][$key].'), must be an http/https URL';
- unset($this->config['support'][$key]);
- }
- }
- if (empty($this->config['support'])) {
- unset($this->config['support']);
- }
- }
- if ($this->validateArray('funding') && !empty($this->config['funding'])) {
- foreach ($this->config['funding'] as $key => $fundingOption) {
- if (!is_array($fundingOption)) {
- $this->errors[] = 'funding.'.$key.' : should be an array, '.gettype($fundingOption).' given';
- unset($this->config['funding'][$key]);
- continue;
- }
- foreach (['type', 'url'] as $fundingData) {
- if (isset($fundingOption[$fundingData]) && !is_string($fundingOption[$fundingData])) {
- $this->errors[] = 'funding.'.$key.'.'.$fundingData.' : invalid value, must be a string';
- unset($this->config['funding'][$key][$fundingData]);
- }
- }
- if (isset($fundingOption['url']) && !$this->filterUrl($fundingOption['url'])) {
- $this->warnings[] = 'funding.'.$key.'.url : invalid value ('.$fundingOption['url'].'), must be an http/https URL';
- unset($this->config['funding'][$key]['url']);
- }
- if (empty($this->config['funding'][$key])) {
- unset($this->config['funding'][$key]);
- }
- }
- if (empty($this->config['funding'])) {
- unset($this->config['funding']);
- }
- }
- $unboundConstraint = new Constraint('=', '10000000-dev');
- $stableConstraint = new Constraint('=', '1.0.0');
- foreach (array_keys(BasePackage::$supportedLinkTypes) as $linkType) {
- if ($this->validateArray($linkType) && isset($this->config[$linkType])) {
- foreach ($this->config[$linkType] as $package => $constraint) {
- $package = (string) $package;
- if (0 === strcasecmp($package, $this->config['name'])) {
- $this->errors[] = $linkType.'.'.$package.' : a package cannot set a '.$linkType.' on itself';
- unset($this->config[$linkType][$package]);
- continue;
- }
- if ($err = self::hasPackageNamingError($package, true)) {
- $this->warnings[] = $linkType.'.'.$err;
- } elseif (!Preg::isMatch('{^[A-Za-z0-9_./-]+$}', $package)) {
- $this->errors[] = $linkType.'.'.$package.' : invalid key, package names must be strings containing only [A-Za-z0-9_./-]';
- }
- if (!is_string($constraint)) {
- $this->errors[] = $linkType.'.'.$package.' : invalid value, must be a string containing a version constraint';
- unset($this->config[$linkType][$package]);
- } elseif ('self.version' !== $constraint) {
- try {
- $linkConstraint = $this->versionParser->parseConstraints($constraint);
- } catch (\Exception $e) {
- $this->errors[] = $linkType.'.'.$package.' : invalid version constraint ('.$e->getMessage().')';
- unset($this->config[$linkType][$package]);
- continue;
- }
- if (
- ($this->flags & self::CHECK_UNBOUND_CONSTRAINTS)
- && 'require' === $linkType
- && $linkConstraint->matches($unboundConstraint)
- && !PlatformRepository::isPlatformPackage($package)
- ) {
- $this->warnings[] = $linkType.'.'.$package.' : unbound version constraints ('.$constraint.') should be avoided';
- } elseif (
- ($this->flags & self::CHECK_STRICT_CONSTRAINTS)
- && 'require' === $linkType
- && $linkConstraint instanceof Constraint && in_array($linkConstraint->getOperator(), ['==', '='], true)
- && (new Constraint('>=', '1.0.0.0-dev'))->matches($linkConstraint)
- ) {
- $this->warnings[] = $linkType.'.'.$package.' : exact version constraints ('.$constraint.') should be avoided if the package follows semantic versioning';
- }
- }
- if ($linkType === 'conflict' && isset($this->config['replace']) && $keys = array_intersect_key($this->config['replace'], $this->config['conflict'])) {
- $this->errors[] = $linkType.'.'.$package.' : you cannot conflict with a package that is also replaced, as replace already creates an implicit conflict rule';
- unset($this->config[$linkType][$package]);
- }
- }
- }
- }
- if ($this->validateArray('suggest') && !empty($this->config['suggest'])) {
- foreach ($this->config['suggest'] as $package => $description) {
- if (!is_string($description)) {
- $this->errors[] = 'suggest.'.$package.' : invalid value, must be a string describing why the package is suggested';
- unset($this->config['suggest'][$package]);
- }
- }
- }
- if ($this->validateString('minimum-stability') && !empty($this->config['minimum-stability'])) {
- if (!isset(BasePackage::$stabilities[strtolower($this->config['minimum-stability'])]) && $this->config['minimum-stability'] !== 'RC') {
- $this->errors[] = 'minimum-stability : invalid value ('.$this->config['minimum-stability'].'), must be one of '.implode(', ', array_keys(BasePackage::$stabilities));
- unset($this->config['minimum-stability']);
- }
- }
- if ($this->validateArray('autoload') && !empty($this->config['autoload'])) {
- $types = ['psr-0', 'psr-4', 'classmap', 'files', 'exclude-from-classmap'];
- foreach ($this->config['autoload'] as $type => $typeConfig) {
- if (!in_array($type, $types)) {
- $this->errors[] = 'autoload : invalid value ('.$type.'), must be one of '.implode(', ', $types);
- unset($this->config['autoload'][$type]);
- }
- if ($type === 'psr-4') {
- foreach ($typeConfig as $namespace => $dirs) {
- if ($namespace !== '' && '\\' !== substr($namespace, -1)) {
- $this->errors[] = 'autoload.psr-4 : invalid value ('.$namespace.'), namespaces must end with a namespace separator, should be '.$namespace.'\\\\';
- }
- }
- }
- }
- }
- if (!empty($this->config['autoload']['psr-4']) && !empty($this->config['target-dir'])) {
- $this->errors[] = 'target-dir : this can not be used together with the autoload.psr-4 setting, remove target-dir to upgrade to psr-4';
- unset($this->config['autoload']['psr-4']);
- }
- foreach (['source', 'dist'] as $srcType) {
- if ($this->validateArray($srcType) && !empty($this->config[$srcType])) {
- if (!isset($this->config[$srcType]['type'])) {
- $this->errors[] = $srcType . '.type : must be present';
- }
- if (!isset($this->config[$srcType]['url'])) {
- $this->errors[] = $srcType . '.url : must be present';
- }
- if ($srcType === 'source' && !isset($this->config[$srcType]['reference'])) {
- $this->errors[] = $srcType . '.reference : must be present';
- }
- if (isset($this->config[$srcType]['type']) && !is_string($this->config[$srcType]['type'])) {
- $this->errors[] = $srcType . '.type : should be a string, '.gettype($this->config[$srcType]['type']).' given';
- }
- if (isset($this->config[$srcType]['url']) && !is_string($this->config[$srcType]['url'])) {
- $this->errors[] = $srcType . '.url : should be a string, '.gettype($this->config[$srcType]['url']).' given';
- }
- if (isset($this->config[$srcType]['reference']) && !is_string($this->config[$srcType]['reference']) && !is_int($this->config[$srcType]['reference'])) {
- $this->errors[] = $srcType . '.reference : should be a string or int, '.gettype($this->config[$srcType]['reference']).' given';
- }
- if (isset($this->config[$srcType]['reference']) && Preg::isMatch('{^\s*-}', (string) $this->config[$srcType]['reference'])) {
- $this->errors[] = $srcType . '.reference : must not start with a "-", "'.$this->config[$srcType]['reference'].'" given';
- }
- if (isset($this->config[$srcType]['url']) && Preg::isMatch('{^\s*-}', (string) $this->config[$srcType]['url'])) {
- $this->errors[] = $srcType . '.url : must not start with a "-", "'.$this->config[$srcType]['url'].'" given';
- }
- }
- }
- $this->validateFlatArray('include-path');
- $this->validateArray('transport-options');
- if (isset($this->config['extra']['branch-alias'])) {
- if (!is_array($this->config['extra']['branch-alias'])) {
- $this->errors[] = 'extra.branch-alias : must be an array of versions => aliases';
- } else {
- foreach ($this->config['extra']['branch-alias'] as $sourceBranch => $targetBranch) {
- if (!is_string($targetBranch)) {
- $this->warnings[] = 'extra.branch-alias.'.$sourceBranch.' : the target branch ('.json_encode($targetBranch).') must be a string, "'.gettype($targetBranch).'" received.';
- unset($this->config['extra']['branch-alias'][$sourceBranch]);
- continue;
- }
- if ('-dev' !== substr($targetBranch, -4)) {
- $this->warnings[] = 'extra.branch-alias.'.$sourceBranch.' : the target branch ('.$targetBranch.') must end in -dev';
- unset($this->config['extra']['branch-alias'][$sourceBranch]);
- continue;
- }
- $validatedTargetBranch = $this->versionParser->normalizeBranch(substr($targetBranch, 0, -4));
- if ('-dev' !== substr($validatedTargetBranch, -4)) {
- $this->warnings[] = 'extra.branch-alias.'.$sourceBranch.' : the target branch ('.$targetBranch.') must be a parseable number like 2.0-dev';
- unset($this->config['extra']['branch-alias'][$sourceBranch]);
- continue;
- }
- if (($sourcePrefix = $this->versionParser->parseNumericAliasPrefix($sourceBranch))
- && ($targetPrefix = $this->versionParser->parseNumericAliasPrefix($targetBranch))
- && (stripos($targetPrefix, $sourcePrefix) !== 0)
- ) {
- $this->warnings[] = 'extra.branch-alias.'.$sourceBranch.' : the target branch ('.$targetBranch.') is not a valid numeric alias for this version';
- unset($this->config['extra']['branch-alias'][$sourceBranch]);
- }
- }
- }
- }
- if ($this->errors) {
- throw new InvalidPackageException($this->errors, $this->warnings, $config);
- }
- $package = $this->loader->load($this->config, $class);
- $this->config = [];
- return $package;
- }
- public function getWarnings(): array
- {
- return $this->warnings;
- }
- public function getErrors(): array
- {
- return $this->errors;
- }
- public static function hasPackageNamingError(string $name, bool $isLink = false): ?string
- {
- if (PlatformRepository::isPlatformPackage($name)) {
- return null;
- }
- if (!Preg::isMatch('{^[a-z0-9](?:[_.-]?[a-z0-9]++)*+/[a-z0-9](?:(?:[_.]|-{1,2})?[a-z0-9]++)*+$}iD', $name)) {
- 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]+)*$".';
- }
- $reservedNames = ['nul', 'con', 'prn', 'aux', 'com1', 'com2', 'com3', 'com4', 'com5', 'com6', 'com7', 'com8', 'com9', 'lpt1', 'lpt2', 'lpt3', 'lpt4', 'lpt5', 'lpt6', 'lpt7', 'lpt8', 'lpt9'];
- $bits = explode('/', strtolower($name));
- if (in_array($bits[0], $reservedNames, true) || in_array($bits[1], $reservedNames, true)) {
- return $name.' is reserved, package and vendor names can not match any of: '.implode(', ', $reservedNames).'.';
- }
- if (Preg::isMatch('{\.json$}', $name)) {
- return $name.' is invalid, package names can not end in .json, consider renaming it or perhaps using a -json suffix instead.';
- }
- if (Preg::isMatch('{[A-Z]}', $name)) {
- if ($isLink) {
- return $name.' is invalid, it should not contain uppercase characters. Please use '.strtolower($name).' instead.';
- }
- $suggestName = Preg::replace('{(?:([a-z])([A-Z])|([A-Z])([A-Z][a-z]))}', '\\1\\3-\\2\\4', $name);
- $suggestName = strtolower($suggestName);
- return $name.' is invalid, it should not contain uppercase characters. We suggest using '.$suggestName.' instead.';
- }
- return null;
- }
- private function validateRegex(string $property, string $regex, bool $mandatory = false): bool
- {
- if (!$this->validateString($property, $mandatory)) {
- return false;
- }
- if (!Preg::isMatch('{^'.$regex.'$}u', $this->config[$property])) {
- $message = $property.' : invalid value ('.$this->config[$property].'), must match '.$regex;
- if ($mandatory) {
- $this->errors[] = $message;
- } else {
- $this->warnings[] = $message;
- }
- unset($this->config[$property]);
- return false;
- }
- return true;
- }
- private function validateString(string $property, bool $mandatory = false): bool
- {
- if (isset($this->config[$property]) && !is_string($this->config[$property])) {
- $this->errors[] = $property.' : should be a string, '.gettype($this->config[$property]).' given';
- unset($this->config[$property]);
- return false;
- }
- if (!isset($this->config[$property]) || trim($this->config[$property]) === '') {
- if ($mandatory) {
- $this->errors[] = $property.' : must be present';
- }
- unset($this->config[$property]);
- return false;
- }
- return true;
- }
- private function validateArray(string $property, bool $mandatory = false): bool
- {
- if (isset($this->config[$property]) && !is_array($this->config[$property])) {
- $this->errors[] = $property.' : should be an array, '.gettype($this->config[$property]).' given';
- unset($this->config[$property]);
- return false;
- }
- if (!isset($this->config[$property]) || !count($this->config[$property])) {
- if ($mandatory) {
- $this->errors[] = $property.' : must be present and contain at least one element';
- }
- unset($this->config[$property]);
- return false;
- }
- return true;
- }
- private function validateFlatArray(string $property, ?string $regex = null, bool $mandatory = false): bool
- {
- if (!$this->validateArray($property, $mandatory)) {
- return false;
- }
- $pass = true;
- foreach ($this->config[$property] as $key => $value) {
- if (!is_string($value) && !is_numeric($value)) {
- $this->errors[] = $property.'.'.$key.' : must be a string or int, '.gettype($value).' given';
- unset($this->config[$property][$key]);
- $pass = false;
- continue;
- }
- if ($regex && !Preg::isMatch('{^'.$regex.'$}u', $value)) {
- $this->warnings[] = $property.'.'.$key.' : invalid value ('.$value.'), must match '.$regex;
- unset($this->config[$property][$key]);
- $pass = false;
- }
- }
- return $pass;
- }
- private function validateUrl(string $property, bool $mandatory = false): bool
- {
- if (!$this->validateString($property, $mandatory)) {
- return false;
- }
- if (!$this->filterUrl($this->config[$property])) {
- $this->warnings[] = $property.' : invalid value ('.$this->config[$property].'), must be an http/https URL';
- unset($this->config[$property]);
- return false;
- }
- return true;
- }
- private function filterUrl($value, array $schemes = ['http', 'https']): bool
- {
- if ($value === '') {
- return true;
- }
- $bits = parse_url($value);
- if (empty($bits['scheme']) || empty($bits['host'])) {
- return false;
- }
- if (!in_array($bits['scheme'], $schemes, true)) {
- return false;
- }
- return true;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Package;
- use Composer\Json\JsonFile;
- use Composer\Installer\InstallationManager;
- use Composer\Pcre\Preg;
- use Composer\Repository\LockArrayRepository;
- use Composer\Util\ProcessExecutor;
- use Composer\Package\Dumper\ArrayDumper;
- use Composer\Package\Loader\ArrayLoader;
- use Composer\Package\Version\VersionParser;
- use Composer\Plugin\PluginInterface;
- use Composer\Util\Git as GitUtil;
- use Composer\IO\IOInterface;
- use Seld\JsonLint\ParsingException;
- class Locker
- {
- private $lockFile;
- private $installationManager;
- private $hash;
- private $contentHash;
- private $loader;
- private $dumper;
- private $process;
- private $lockDataCache = null;
- private $virtualFileWritten = false;
- public function __construct(IOInterface $io, JsonFile $lockFile, InstallationManager $installationManager, string $composerFileContents, ?ProcessExecutor $process = null)
- {
- $this->lockFile = $lockFile;
- $this->installationManager = $installationManager;
- $this->hash = md5($composerFileContents);
- $this->contentHash = self::getContentHash($composerFileContents);
- $this->loader = new ArrayLoader(null, true);
- $this->dumper = new ArrayDumper();
- $this->process = $process ?? new ProcessExecutor($io);
- }
- public static function getContentHash(string $composerFileContents): string
- {
- $content = JsonFile::parseJson($composerFileContents, 'composer.json');
- $relevantKeys = [
- 'name',
- 'version',
- 'require',
- 'require-dev',
- 'conflict',
- 'replace',
- 'provide',
- 'minimum-stability',
- 'prefer-stable',
- 'repositories',
- 'extra',
- ];
- $relevantContent = [];
- foreach (array_intersect($relevantKeys, array_keys($content)) as $key) {
- $relevantContent[$key] = $content[$key];
- }
- if (isset($content['config']['platform'])) {
- $relevantContent['config']['platform'] = $content['config']['platform'];
- }
- ksort($relevantContent);
- return md5(JsonFile::encode($relevantContent, 0));
- }
- public function isLocked(): bool
- {
- if (!$this->virtualFileWritten && !$this->lockFile->exists()) {
- return false;
- }
- $data = $this->getLockData();
- return isset($data['packages']);
- }
- public function isFresh(): bool
- {
- $lock = $this->lockFile->read();
- if (!empty($lock['content-hash'])) {
- return $this->contentHash === $lock['content-hash'];
- }
- if (!empty($lock['hash'])) {
- return $this->hash === $lock['hash'];
- }
- return false;
- }
- public function getLockedRepository(bool $withDevReqs = false): LockArrayRepository
- {
- $lockData = $this->getLockData();
- $packages = new LockArrayRepository();
- $lockedPackages = $lockData['packages'];
- if ($withDevReqs) {
- if (isset($lockData['packages-dev'])) {
- $lockedPackages = array_merge($lockedPackages, $lockData['packages-dev']);
- } else {
- 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.');
- }
- }
- if (empty($lockedPackages)) {
- return $packages;
- }
- if (isset($lockedPackages[0]['name'])) {
- $packageByName = [];
- foreach ($lockedPackages as $info) {
- $package = $this->loader->load($info);
- $packages->addPackage($package);
- $packageByName[$package->getName()] = $package;
- if ($package instanceof AliasPackage) {
- $packageByName[$package->getAliasOf()->getName()] = $package->getAliasOf();
- }
- }
- if (isset($lockData['aliases'])) {
- foreach ($lockData['aliases'] as $alias) {
- if (isset($packageByName[$alias['package']])) {
- $aliasPkg = new CompleteAliasPackage($packageByName[$alias['package']], $alias['alias_normalized'], $alias['alias']);
- $aliasPkg->setRootPackageAlias(true);
- $packages->addPackage($aliasPkg);
- }
- }
- }
- return $packages;
- }
- throw new \RuntimeException('Your composer.lock is invalid. Run "composer update" to generate a new one.');
- }
- public function getDevPackageNames(): array
- {
- $names = [];
- $lockData = $this->getLockData();
- if (isset($lockData['packages-dev'])) {
- foreach ($lockData['packages-dev'] as $package) {
- $names[] = strtolower($package['name']);
- }
- }
- return $names;
- }
- public function getPlatformRequirements(bool $withDevReqs = false): array
- {
- $lockData = $this->getLockData();
- $requirements = [];
- if (!empty($lockData['platform'])) {
- $requirements = $this->loader->parseLinks(
- '__root__',
- '1.0.0',
- Link::TYPE_REQUIRE,
- $lockData['platform'] ?? []
- );
- }
- if ($withDevReqs && !empty($lockData['platform-dev'])) {
- $devRequirements = $this->loader->parseLinks(
- '__root__',
- '1.0.0',
- Link::TYPE_REQUIRE,
- $lockData['platform-dev'] ?? []
- );
- $requirements = array_merge($requirements, $devRequirements);
- }
- return $requirements;
- }
- public function getMinimumStability(): string
- {
- $lockData = $this->getLockData();
- return $lockData['minimum-stability'] ?? 'stable';
- }
- public function getStabilityFlags(): array
- {
- $lockData = $this->getLockData();
- return $lockData['stability-flags'] ?? [];
- }
- public function getPreferStable(): ?bool
- {
- $lockData = $this->getLockData();
- return $lockData['prefer-stable'] ?? null;
- }
- public function getPreferLowest(): ?bool
- {
- $lockData = $this->getLockData();
- return $lockData['prefer-lowest'] ?? null;
- }
- public function getPlatformOverrides(): array
- {
- $lockData = $this->getLockData();
- return $lockData['platform-overrides'] ?? [];
- }
- public function getAliases(): array
- {
- $lockData = $this->getLockData();
- return $lockData['aliases'] ?? [];
- }
- public function getPluginApi()
- {
- $lockData = $this->getLockData();
- return $lockData['plugin-api-version'] ?? '1.1.0';
- }
- public function getLockData(): array
- {
- if (null !== $this->lockDataCache) {
- return $this->lockDataCache;
- }
- if (!$this->lockFile->exists()) {
- throw new \LogicException('No lockfile found. Unable to read locked packages');
- }
- return $this->lockDataCache = $this->lockFile->read();
- }
- 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
- {
- $aliases = array_map(static function ($alias): array {
- if (in_array($alias['version'], ['dev-master', 'dev-trunk', 'dev-default'], true)) {
- $alias['version'] = VersionParser::DEFAULT_BRANCH_ALIAS;
- }
- return $alias;
- }, $aliases);
- $lock = [
- '_readme' => ['This file locks the dependencies of your project to a known state',
- 'Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies',
- 'This file is @gener'.'ated automatically', ],
- 'content-hash' => $this->contentHash,
- 'packages' => null,
- 'packages-dev' => null,
- 'aliases' => $aliases,
- 'minimum-stability' => $minimumStability,
- 'stability-flags' => $stabilityFlags,
- 'prefer-stable' => $preferStable,
- 'prefer-lowest' => $preferLowest,
- ];
- $lock['packages'] = $this->lockPackages($packages);
- if (null !== $devPackages) {
- $lock['packages-dev'] = $this->lockPackages($devPackages);
- }
- $lock['platform'] = $platformReqs;
- $lock['platform-dev'] = $platformDevReqs;
- if (\count($platformOverrides) > 0) {
- $lock['platform-overrides'] = $platformOverrides;
- }
- $lock['plugin-api-version'] = PluginInterface::PLUGIN_API_VERSION;
- try {
- $isLocked = $this->isLocked();
- } catch (ParsingException $e) {
- $isLocked = false;
- }
- if (!$isLocked || $lock !== $this->getLockData()) {
- if ($write) {
- $this->lockFile->write($lock);
- $this->lockDataCache = null;
- $this->virtualFileWritten = false;
- } else {
- $this->virtualFileWritten = true;
- $this->lockDataCache = JsonFile::parseJson(JsonFile::encode($lock));
- }
- return true;
- }
- return false;
- }
- private function lockPackages(array $packages): array
- {
- $locked = [];
- foreach ($packages as $package) {
- if ($package instanceof AliasPackage) {
- continue;
- }
- $name = $package->getPrettyName();
- $version = $package->getPrettyVersion();
- if (!$name || !$version) {
- throw new \LogicException(sprintf(
- 'Package "%s" has no version or name and can not be locked',
- $package
- ));
- }
- $spec = $this->dumper->dump($package);
- unset($spec['version_normalized']);
- $time = $spec['time'] ?? null;
- unset($spec['time']);
- if ($package->isDev() && $package->getInstallationSource() === 'source') {
- $time = $this->getPackageTime($package) ?: $time;
- }
- if (null !== $time) {
- $spec['time'] = $time;
- }
- unset($spec['installation-source']);
- $locked[] = $spec;
- }
- usort($locked, static function ($a, $b) {
- $comparison = strcmp($a['name'], $b['name']);
- if (0 !== $comparison) {
- return $comparison;
- }
- return strcmp($a['version'], $b['version']);
- });
- return $locked;
- }
- private function getPackageTime(PackageInterface $package): ?string
- {
- if (!function_exists('proc_open')) {
- return null;
- }
- $path = realpath($this->installationManager->getInstallPath($package));
- $sourceType = $package->getSourceType();
- $datetime = null;
- if ($path && in_array($sourceType, ['git', 'hg'])) {
- $sourceRef = $package->getSourceReference() ?: $package->getDistReference();
- switch ($sourceType) {
- case 'git':
- GitUtil::cleanEnv();
- if (0 === $this->process->execute('git log -n1 --pretty=%ct '.ProcessExecutor::escape($sourceRef).GitUtil::getNoShowSignatureFlag($this->process), $output, $path) && Preg::isMatch('{^\s*\d+\s*$}', $output)) {
- $datetime = new \DateTime('@'.trim($output), new \DateTimeZone('UTC'));
- }
- break;
- case 'hg':
- if (0 === $this->process->execute('hg log --template "{date|hgdate}" -r '.ProcessExecutor::escape($sourceRef), $output, $path) && Preg::isMatch('{^\s*(\d+)\s*}', $output, $match)) {
- $datetime = new \DateTime('@'.$match[1], new \DateTimeZone('UTC'));
- }
- break;
- }
- }
- return $datetime ? $datetime->format(DATE_RFC3339) : null;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Package;
- use Composer\Package\Version\VersionParser;
- use Composer\Pcre\Preg;
- use Composer\Util\ComposerMirror;
- class Package extends BasePackage
- {
- protected $type;
- protected $targetDir;
- protected $installationSource;
- protected $sourceType;
- protected $sourceUrl;
- protected $sourceReference;
- protected $sourceMirrors;
- protected $distType;
- protected $distUrl;
- protected $distReference;
- protected $distSha1Checksum;
- protected $distMirrors;
- protected $version;
- protected $prettyVersion;
- protected $releaseDate;
- protected $extra = [];
- protected $binaries = [];
- protected $dev;
- protected $stability;
- protected $notificationUrl;
- protected $requires = [];
- protected $conflicts = [];
- protected $provides = [];
- protected $replaces = [];
- protected $devRequires = [];
- protected $suggests = [];
- protected $autoload = [];
- protected $devAutoload = [];
- protected $includePaths = [];
- protected $isDefaultBranch = false;
- protected $transportOptions = [];
- public function __construct(string $name, string $version, string $prettyVersion)
- {
- parent::__construct($name);
- $this->version = $version;
- $this->prettyVersion = $prettyVersion;
- $this->stability = VersionParser::parseStability($version);
- $this->dev = $this->stability === 'dev';
- }
- public function isDev(): bool
- {
- return $this->dev;
- }
- public function setType(string $type): void
- {
- $this->type = $type;
- }
- public function getType(): string
- {
- return $this->type ?: 'library';
- }
- public function getStability(): string
- {
- return $this->stability;
- }
- public function setTargetDir(?string $targetDir): void
- {
- $this->targetDir = $targetDir;
- }
- public function getTargetDir(): ?string
- {
- if (null === $this->targetDir) {
- return null;
- }
- return ltrim(Preg::replace('{ (?:^|[\\\\/]+) \.\.? (?:[\\\\/]+|$) (?:\.\.? (?:[\\\\/]+|$) )*}x', '/', $this->targetDir), '/');
- }
- public function setExtra(array $extra): void
- {
- $this->extra = $extra;
- }
- public function getExtra(): array
- {
- return $this->extra;
- }
- public function setBinaries(array $binaries): void
- {
- $this->binaries = $binaries;
- }
- public function getBinaries(): array
- {
- return $this->binaries;
- }
- public function setInstallationSource(?string $type): void
- {
- $this->installationSource = $type;
- }
- public function getInstallationSource(): ?string
- {
- return $this->installationSource;
- }
- public function setSourceType(?string $type): void
- {
- $this->sourceType = $type;
- }
- public function getSourceType(): ?string
- {
- return $this->sourceType;
- }
- public function setSourceUrl(?string $url): void
- {
- $this->sourceUrl = $url;
- }
- public function getSourceUrl(): ?string
- {
- return $this->sourceUrl;
- }
- public function setSourceReference(?string $reference): void
- {
- $this->sourceReference = $reference;
- }
- public function getSourceReference(): ?string
- {
- return $this->sourceReference;
- }
- public function setSourceMirrors(?array $mirrors): void
- {
- $this->sourceMirrors = $mirrors;
- }
- public function getSourceMirrors(): ?array
- {
- return $this->sourceMirrors;
- }
- public function getSourceUrls(): array
- {
- return $this->getUrls($this->sourceUrl, $this->sourceMirrors, $this->sourceReference, $this->sourceType, 'source');
- }
- public function setDistType(?string $type): void
- {
- $this->distType = $type;
- }
- public function getDistType(): ?string
- {
- return $this->distType;
- }
- public function setDistUrl(?string $url): void
- {
- $this->distUrl = $url;
- }
- public function getDistUrl(): ?string
- {
- return $this->distUrl;
- }
- public function setDistReference(?string $reference): void
- {
- $this->distReference = $reference;
- }
- public function getDistReference(): ?string
- {
- return $this->distReference;
- }
- public function setDistSha1Checksum(?string $sha1checksum): void
- {
- $this->distSha1Checksum = $sha1checksum;
- }
- public function getDistSha1Checksum(): ?string
- {
- return $this->distSha1Checksum;
- }
- public function setDistMirrors(?array $mirrors): void
- {
- $this->distMirrors = $mirrors;
- }
- public function getDistMirrors(): ?array
- {
- return $this->distMirrors;
- }
- public function getDistUrls(): array
- {
- return $this->getUrls($this->distUrl, $this->distMirrors, $this->distReference, $this->distType, 'dist');
- }
- public function getTransportOptions(): array
- {
- return $this->transportOptions;
- }
- public function setTransportOptions(array $options): void
- {
- $this->transportOptions = $options;
- }
- public function getVersion(): string
- {
- return $this->version;
- }
- public function getPrettyVersion(): string
- {
- return $this->prettyVersion;
- }
- public function setReleaseDate(?\DateTimeInterface $releaseDate): void
- {
- $this->releaseDate = $releaseDate;
- }
- public function getReleaseDate(): ?\DateTimeInterface
- {
- return $this->releaseDate;
- }
- public function setRequires(array $requires): void
- {
- if (isset($requires[0])) {
- $requires = $this->convertLinksToMap($requires, 'setRequires');
- }
- $this->requires = $requires;
- }
- public function getRequires(): array
- {
- return $this->requires;
- }
- public function setConflicts(array $conflicts): void
- {
- if (isset($conflicts[0])) {
- $conflicts = $this->convertLinksToMap($conflicts, 'setConflicts');
- }
- $this->conflicts = $conflicts;
- }
- public function getConflicts(): array
- {
- return $this->conflicts;
- }
- public function setProvides(array $provides): void
- {
- if (isset($provides[0])) {
- $provides = $this->convertLinksToMap($provides, 'setProvides');
- }
- $this->provides = $provides;
- }
- public function getProvides(): array
- {
- return $this->provides;
- }
- public function setReplaces(array $replaces): void
- {
- if (isset($replaces[0])) {
- $replaces = $this->convertLinksToMap($replaces, 'setReplaces');
- }
- $this->replaces = $replaces;
- }
- public function getReplaces(): array
- {
- return $this->replaces;
- }
- public function setDevRequires(array $devRequires): void
- {
- if (isset($devRequires[0])) {
- $devRequires = $this->convertLinksToMap($devRequires, 'setDevRequires');
- }
- $this->devRequires = $devRequires;
- }
- public function getDevRequires(): array
- {
- return $this->devRequires;
- }
- public function setSuggests(array $suggests): void
- {
- $this->suggests = $suggests;
- }
- public function getSuggests(): array
- {
- return $this->suggests;
- }
- public function setAutoload(array $autoload): void
- {
- $this->autoload = $autoload;
- }
- public function getAutoload(): array
- {
- return $this->autoload;
- }
- public function setDevAutoload(array $devAutoload): void
- {
- $this->devAutoload = $devAutoload;
- }
- public function getDevAutoload(): array
- {
- return $this->devAutoload;
- }
- public function setIncludePaths(array $includePaths): void
- {
- $this->includePaths = $includePaths;
- }
- public function getIncludePaths(): array
- {
- return $this->includePaths;
- }
- public function setNotificationUrl(string $notificationUrl): void
- {
- $this->notificationUrl = $notificationUrl;
- }
- public function getNotificationUrl(): ?string
- {
- return $this->notificationUrl;
- }
- public function setIsDefaultBranch(bool $defaultBranch): void
- {
- $this->isDefaultBranch = $defaultBranch;
- }
- public function isDefaultBranch(): bool
- {
- return $this->isDefaultBranch;
- }
- public function setSourceDistReferences(string $reference): void
- {
- $this->setSourceReference($reference);
- if (
- $this->getDistUrl() !== null
- && Preg::isMatch('{^https?://(?:(?:www\.)?bitbucket\.org|(api\.)?github\.com|(?:www\.)?gitlab\.com)/}i', $this->getDistUrl())
- ) {
- $this->setDistReference($reference);
- $this->setDistUrl(Preg::replace('{(?<=/|sha=)[a-f0-9]{40}(?=/|$)}i', $reference, $this->getDistUrl()));
- } elseif ($this->getDistReference()) {
- $this->setDistReference($reference);
- }
- }
- public function replaceVersion(string $version, string $prettyVersion): void
- {
- $this->version = $version;
- $this->prettyVersion = $prettyVersion;
- $this->stability = VersionParser::parseStability($version);
- $this->dev = $this->stability === 'dev';
- }
- protected function getUrls(?string $url, ?array $mirrors, ?string $ref, ?string $type, string $urlType): array
- {
- if (!$url) {
- return [];
- }
- if ($urlType === 'dist' && false !== strpos($url, '%')) {
- $url = ComposerMirror::processUrl($url, $this->name, $this->version, $ref, $type, $this->prettyVersion);
- }
- $urls = [$url];
- if ($mirrors) {
- foreach ($mirrors as $mirror) {
- if ($urlType === 'dist') {
- $mirrorUrl = ComposerMirror::processUrl($mirror['url'], $this->name, $this->version, $ref, $type, $this->prettyVersion);
- } elseif ($urlType === 'source' && $type === 'git') {
- $mirrorUrl = ComposerMirror::processGitUrl($mirror['url'], $this->name, $url, $type);
- } elseif ($urlType === 'source' && $type === 'hg') {
- $mirrorUrl = ComposerMirror::processHgUrl($mirror['url'], $this->name, $url, $type);
- } else {
- continue;
- }
- if (!\in_array($mirrorUrl, $urls)) {
- $func = $mirror['preferred'] ? 'array_unshift' : 'array_push';
- $func($urls, $mirrorUrl);
- }
- }
- }
- return $urls;
- }
- private function convertLinksToMap(array $links, string $source): array
- {
- 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.');
- $newLinks = [];
- foreach ($links as $link) {
- $newLinks[$link->getTarget()] = $link;
- }
- return $newLinks;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Package;
- use Composer\Repository\RepositoryInterface;
- interface PackageInterface
- {
- public const DISPLAY_SOURCE_REF_IF_DEV = 0;
- public const DISPLAY_SOURCE_REF = 1;
- public const DISPLAY_DIST_REF = 2;
- public function getName(): string;
- public function getPrettyName(): string;
- public function getNames(bool $provides = true): array;
- public function setId(int $id): void;
- public function getId(): int;
- public function isDev(): bool;
- public function getType(): string;
- public function getTargetDir(): ?string;
- public function getExtra(): array;
- public function setInstallationSource(?string $type): void;
- public function getInstallationSource(): ?string;
- public function getSourceType(): ?string;
- public function getSourceUrl(): ?string;
- public function getSourceUrls(): array;
- public function getSourceReference(): ?string;
- public function getSourceMirrors(): ?array;
- public function setSourceMirrors(?array $mirrors): void;
- public function getDistType(): ?string;
- public function getDistUrl(): ?string;
- public function getDistUrls(): array;
- public function getDistReference(): ?string;
- public function getDistSha1Checksum(): ?string;
- public function getDistMirrors(): ?array;
- public function setDistMirrors(?array $mirrors): void;
- public function getVersion(): string;
- public function getPrettyVersion(): string;
- public function getFullPrettyVersion(bool $truncate = true, int $displayMode = self::DISPLAY_SOURCE_REF_IF_DEV): string;
- public function getReleaseDate(): ?\DateTimeInterface;
- public function getStability(): string;
- public function getRequires(): array;
- public function getConflicts(): array;
- public function getProvides(): array;
- public function getReplaces(): array;
- public function getDevRequires(): array;
- public function getSuggests(): array;
- public function getAutoload(): array;
- public function getDevAutoload(): array;
- public function getIncludePaths(): array;
- public function setRepository(RepositoryInterface $repository): void;
- public function getRepository(): ?RepositoryInterface;
- public function getBinaries(): array;
- public function getUniqueName(): string;
- public function getNotificationUrl(): ?string;
- public function __toString(): string;
- public function getPrettyString(): string;
- public function isDefaultBranch(): bool;
- public function getTransportOptions(): array;
- public function setTransportOptions(array $options): void;
- public function setSourceReference(?string $reference): void;
- public function setDistUrl(?string $url): void;
- public function setDistType(?string $type): void;
- public function setDistReference(?string $reference): void;
- public function setSourceDistReferences(string $reference): void;
- }
- <?php declare(strict_types=1);
- namespace Composer\Package;
- class RootAliasPackage extends CompleteAliasPackage implements RootPackageInterface
- {
- protected $aliasOf;
- public function __construct(RootPackage $aliasOf, string $version, string $prettyVersion)
- {
- parent::__construct($aliasOf, $version, $prettyVersion);
- }
- public function getAliasOf()
- {
- return $this->aliasOf;
- }
- public function getAliases(): array
- {
- return $this->aliasOf->getAliases();
- }
- public function getMinimumStability(): string
- {
- return $this->aliasOf->getMinimumStability();
- }
- public function getStabilityFlags(): array
- {
- return $this->aliasOf->getStabilityFlags();
- }
- public function getReferences(): array
- {
- return $this->aliasOf->getReferences();
- }
- public function getPreferStable(): bool
- {
- return $this->aliasOf->getPreferStable();
- }
- public function getConfig(): array
- {
- return $this->aliasOf->getConfig();
- }
- public function setRequires(array $requires): void
- {
- $this->requires = $this->replaceSelfVersionDependencies($requires, Link::TYPE_REQUIRE);
- $this->aliasOf->setRequires($requires);
- }
- public function setDevRequires(array $devRequires): void
- {
- $this->devRequires = $this->replaceSelfVersionDependencies($devRequires, Link::TYPE_DEV_REQUIRE);
- $this->aliasOf->setDevRequires($devRequires);
- }
- public function setConflicts(array $conflicts): void
- {
- $this->conflicts = $this->replaceSelfVersionDependencies($conflicts, Link::TYPE_CONFLICT);
- $this->aliasOf->setConflicts($conflicts);
- }
- public function setProvides(array $provides): void
- {
- $this->provides = $this->replaceSelfVersionDependencies($provides, Link::TYPE_PROVIDE);
- $this->aliasOf->setProvides($provides);
- }
- public function setReplaces(array $replaces): void
- {
- $this->replaces = $this->replaceSelfVersionDependencies($replaces, Link::TYPE_REPLACE);
- $this->aliasOf->setReplaces($replaces);
- }
- public function setAutoload(array $autoload): void
- {
- $this->aliasOf->setAutoload($autoload);
- }
- public function setDevAutoload(array $devAutoload): void
- {
- $this->aliasOf->setDevAutoload($devAutoload);
- }
- public function setStabilityFlags(array $stabilityFlags): void
- {
- $this->aliasOf->setStabilityFlags($stabilityFlags);
- }
- public function setMinimumStability(string $minimumStability): void
- {
- $this->aliasOf->setMinimumStability($minimumStability);
- }
- public function setPreferStable(bool $preferStable): void
- {
- $this->aliasOf->setPreferStable($preferStable);
- }
- public function setConfig(array $config): void
- {
- $this->aliasOf->setConfig($config);
- }
- public function setReferences(array $references): void
- {
- $this->aliasOf->setReferences($references);
- }
- public function setAliases(array $aliases): void
- {
- $this->aliasOf->setAliases($aliases);
- }
- public function setSuggests(array $suggests): void
- {
- $this->aliasOf->setSuggests($suggests);
- }
- public function setExtra(array $extra): void
- {
- $this->aliasOf->setExtra($extra);
- }
- public function __clone()
- {
- parent::__clone();
- $this->aliasOf = clone $this->aliasOf;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Package;
- class RootPackage extends CompletePackage implements RootPackageInterface
- {
- public const DEFAULT_PRETTY_VERSION = '1.0.0+no-version-set';
- protected $minimumStability = 'stable';
- protected $preferStable = false;
- protected $stabilityFlags = [];
- protected $config = [];
- protected $references = [];
- protected $aliases = [];
- public function setMinimumStability(string $minimumStability): void
- {
- $this->minimumStability = $minimumStability;
- }
- public function getMinimumStability(): string
- {
- return $this->minimumStability;
- }
- public function setStabilityFlags(array $stabilityFlags): void
- {
- $this->stabilityFlags = $stabilityFlags;
- }
- public function getStabilityFlags(): array
- {
- return $this->stabilityFlags;
- }
- public function setPreferStable(bool $preferStable): void
- {
- $this->preferStable = $preferStable;
- }
- public function getPreferStable(): bool
- {
- return $this->preferStable;
- }
- public function setConfig(array $config): void
- {
- $this->config = $config;
- }
- public function getConfig(): array
- {
- return $this->config;
- }
- public function setReferences(array $references): void
- {
- $this->references = $references;
- }
- public function getReferences(): array
- {
- return $this->references;
- }
- public function setAliases(array $aliases): void
- {
- $this->aliases = $aliases;
- }
- public function getAliases(): array
- {
- return $this->aliases;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Package;
- interface RootPackageInterface extends CompletePackageInterface
- {
- public function getAliases(): array;
- public function getMinimumStability(): string;
- public function getStabilityFlags(): array;
- public function getReferences(): array;
- public function getPreferStable(): bool;
- public function getConfig(): array;
- public function setRequires(array $requires): void;
- public function setDevRequires(array $devRequires): void;
- public function setConflicts(array $conflicts): void;
- public function setProvides(array $provides): void;
- public function setReplaces(array $replaces): void;
- public function setAutoload(array $autoload): void;
- public function setDevAutoload(array $devAutoload): void;
- public function setStabilityFlags(array $stabilityFlags): void;
- public function setMinimumStability(string $minimumStability): void;
- public function setPreferStable(bool $preferStable): void;
- public function setConfig(array $config): void;
- public function setReferences(array $references): void;
- public function setAliases(array $aliases): void;
- public function setSuggests(array $suggests): void;
- public function setExtra(array $extra): void;
- }
- <?php declare(strict_types=1);
- namespace Composer\Package\Version;
- use Composer\Package\BasePackage;
- class StabilityFilter
- {
- public static function isPackageAcceptable(array $acceptableStabilities, array $stabilityFlags, array $names, string $stability): bool
- {
- foreach ($names as $name) {
- if (isset($stabilityFlags[$name])) {
- if (BasePackage::$stabilities[$stability] <= $stabilityFlags[$name]) {
- return true;
- }
- } elseif (isset($acceptableStabilities[$stability])) {
- return true;
- }
- }
- return false;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Package\Version;
- use Composer\Package\PackageInterface;
- use Composer\Package\Loader\ArrayLoader;
- use Composer\Package\Dumper\ArrayDumper;
- use Composer\Pcre\Preg;
- use Composer\Semver\Constraint\Constraint;
- use Composer\Semver\Constraint\ConstraintInterface;
- use Composer\Semver\Intervals;
- use Composer\Util\Platform;
- class VersionBumper
- {
- public function bumpRequirement(ConstraintInterface $constraint, PackageInterface $package): string
- {
- $parser = new VersionParser();
- $prettyConstraint = $constraint->getPrettyString();
- if (str_starts_with($constraint->getPrettyString(), 'dev-')) {
- return $prettyConstraint;
- }
- $version = $package->getVersion();
- if (str_starts_with($package->getVersion(), 'dev-')) {
- $loader = new ArrayLoader($parser);
- $dumper = new ArrayDumper();
- $extra = $loader->getBranchAlias($dumper->dump($package));
- if (null === $extra || $extra === VersionParser::DEFAULT_BRANCH_ALIAS) {
- return $prettyConstraint;
- }
- $version = $extra;
- }
- $intervals = Intervals::get($constraint);
- if (\count($intervals['branches']['names']) > 0) {
- return $prettyConstraint;
- }
- $major = Preg::replace('{^(\d+).*}', '$1', $version);
- $newPrettyConstraint = '^'.Preg::replace('{(?:\.(?:0|9999999))+(-dev)?$}', '', $version);
- if (!Preg::isMatch('{^\^\d+(\.\d+)*$}', $newPrettyConstraint)) {
- return $prettyConstraint;
- }
- $pattern = '{
- (?<=,|\ |\||^) # leading separator
- (?P<constraint>
- \^'.$major.'(?:\.\d+)* # e.g. ^2.anything
- | ~'.$major.'(?:\.\d+)? # e.g. ~2 or ~2.2 but no more
- | '.$major.'(?:\.[*x])+ # e.g. 2.* or 2.*.* or 2.x.x.x etc
- )
- (?=,|$|\ |\||@) # trailing separator
- }x';
- if (Preg::isMatchAllWithOffsets($pattern, $prettyConstraint, $matches)) {
- $modified = $prettyConstraint;
- foreach (array_reverse($matches['constraint']) as $match) {
- $modified = substr_replace($modified, $newPrettyConstraint, $match[1], Platform::strlen($match[0]));
- }
- $newConstraint = $parser->parseConstraints($modified);
- if (Intervals::isSubsetOf($newConstraint, $constraint) && Intervals::isSubsetOf($constraint, $newConstraint)) {
- return $prettyConstraint;
- }
- return $modified;
- }
- return $prettyConstraint;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Package\Version;
- use Composer\Config;
- use Composer\Pcre\Preg;
- use Composer\Repository\Vcs\HgDriver;
- use Composer\IO\NullIO;
- use Composer\Semver\VersionParser as SemverVersionParser;
- use Composer\Util\Git as GitUtil;
- use Composer\Util\HttpDownloader;
- use Composer\Util\Platform;
- use Composer\Util\ProcessExecutor;
- use Composer\Util\Svn as SvnUtil;
- use React\Promise\CancellablePromiseInterface;
- use Symfony\Component\Process\Process;
- class VersionGuesser
- {
- private $config;
- private $process;
- private $versionParser;
- public function __construct(Config $config, ProcessExecutor $process, SemverVersionParser $versionParser)
- {
- $this->config = $config;
- $this->process = $process;
- $this->versionParser = $versionParser;
- }
- public function guessVersion(array $packageConfig, string $path): ?array
- {
- if (!function_exists('proc_open')) {
- return null;
- }
- if (Platform::isInputCompletionProcess()) {
- return null;
- }
- $versionData = $this->guessGitVersion($packageConfig, $path);
- if (null !== $versionData && null !== $versionData['version']) {
- return $this->postprocess($versionData);
- }
- $versionData = $this->guessHgVersion($packageConfig, $path);
- if (null !== $versionData && null !== $versionData['version']) {
- return $this->postprocess($versionData);
- }
- $versionData = $this->guessFossilVersion($path);
- if (null !== $versionData && null !== $versionData['version']) {
- return $this->postprocess($versionData);
- }
- $versionData = $this->guessSvnVersion($packageConfig, $path);
- if (null !== $versionData && null !== $versionData['version']) {
- return $this->postprocess($versionData);
- }
- return null;
- }
- private function postprocess(array $versionData): array
- {
- if (!empty($versionData['feature_version']) && $versionData['feature_version'] === $versionData['version'] && $versionData['feature_pretty_version'] === $versionData['pretty_version']) {
- unset($versionData['feature_version'], $versionData['feature_pretty_version']);
- }
- if ('-dev' === substr($versionData['version'], -4) && Preg::isMatch('{\.9{7}}', $versionData['version'])) {
- $versionData['pretty_version'] = Preg::replace('{(\.9{7})+}', '.x', $versionData['version']);
- }
- if (!empty($versionData['feature_version']) && '-dev' === substr($versionData['feature_version'], -4) && Preg::isMatch('{\.9{7}}', $versionData['feature_version'])) {
- $versionData['feature_pretty_version'] = Preg::replace('{(\.9{7})+}', '.x', $versionData['feature_version']);
- }
- return $versionData;
- }
- private function guessGitVersion(array $packageConfig, string $path): array
- {
- GitUtil::cleanEnv();
- $commit = null;
- $version = null;
- $prettyVersion = null;
- $featureVersion = null;
- $featurePrettyVersion = null;
- $isDetached = false;
- if (0 === $this->process->execute(['git', 'branch', '-a', '--no-color', '--no-abbrev', '-v'], $output, $path)) {
- $branches = [];
- $isFeatureBranch = false;
- foreach ($this->process->splitLines($output) as $branch) {
- if ($branch && Preg::isMatch('{^(?:\* ) *(\(no branch\)|\(detached from \S+\)|\(HEAD detached at \S+\)|\S+) *([a-f0-9]+) .*$}', $branch, $match)) {
- if (
- $match[1] === '(no branch)'
- || strpos($match[1], '(detached ') === 0
- || strpos($match[1], '(HEAD detached at') === 0
- ) {
- $version = 'dev-' . $match[2];
- $prettyVersion = $version;
- $isFeatureBranch = true;
- $isDetached = true;
- } else {
- $version = $this->versionParser->normalizeBranch($match[1]);
- $prettyVersion = 'dev-' . $match[1];
- $isFeatureBranch = $this->isFeatureBranch($packageConfig, $match[1]);
- }
- if ($match[2]) {
- $commit = $match[2];
- }
- }
- if ($branch && !Preg::isMatch('{^ *.+/HEAD }', $branch)) {
- if (Preg::isMatch('{^(?:\* )? *((?:remotes/(?:origin|upstream)/)?[^\s/]+) *([a-f0-9]+) .*$}', $branch, $match)) {
- $branches[] = $match[1];
- }
- }
- }
- if ($isFeatureBranch) {
- $featureVersion = $version;
- $featurePrettyVersion = $prettyVersion;
- $result = $this->guessFeatureVersion($packageConfig, $version, $branches, 'git rev-list %candidate%..%branch%', $path);
- $version = $result['version'];
- $prettyVersion = $result['pretty_version'];
- }
- }
- if (!$version || $isDetached) {
- $result = $this->versionFromGitTags($path);
- if ($result) {
- $version = $result['version'];
- $prettyVersion = $result['pretty_version'];
- $featureVersion = null;
- $featurePrettyVersion = null;
- }
- }
- if (!$commit) {
- $command = 'git log --pretty="%H" -n1 HEAD'.GitUtil::getNoShowSignatureFlag($this->process);
- if (0 === $this->process->execute($command, $output, $path)) {
- $commit = trim($output) ?: null;
- }
- }
- if ($featureVersion) {
- return ['version' => $version, 'commit' => $commit, 'pretty_version' => $prettyVersion, 'feature_version' => $featureVersion, 'feature_pretty_version' => $featurePrettyVersion];
- }
- return ['version' => $version, 'commit' => $commit, 'pretty_version' => $prettyVersion];
- }
- private function versionFromGitTags(string $path): ?array
- {
- if (0 === $this->process->execute('git describe --exact-match --tags', $output, $path)) {
- try {
- $version = $this->versionParser->normalize(trim($output));
- return ['version' => $version, 'pretty_version' => trim($output)];
- } catch (\Exception $e) {
- }
- }
- return null;
- }
- private function guessHgVersion(array $packageConfig, string $path): ?array
- {
- if (0 === $this->process->execute('hg branch', $output, $path)) {
- $branch = trim($output);
- $version = $this->versionParser->normalizeBranch($branch);
- $isFeatureBranch = 0 === strpos($version, 'dev-');
- if (VersionParser::DEFAULT_BRANCH_ALIAS === $version) {
- return ['version' => $version, 'commit' => null, 'pretty_version' => 'dev-'.$branch];
- }
- if (!$isFeatureBranch) {
- return ['version' => $version, 'commit' => null, 'pretty_version' => $version];
- }
- $io = new NullIO();
- $driver = new HgDriver(['url' => $path], $io, $this->config, new HttpDownloader($io, $this->config), $this->process);
- $branches = array_map('strval', array_keys($driver->getBranches()));
- $result = $this->guessFeatureVersion($packageConfig, $version, $branches, 'hg log -r "not ancestors(\'%candidate%\') and ancestors(\'%branch%\')" --template "{node}\\n"', $path);
- $result['commit'] = '';
- $result['feature_version'] = $version;
- $result['feature_pretty_version'] = $version;
- return $result;
- }
- return null;
- }
- private function guessFeatureVersion(array $packageConfig, ?string $version, array $branches, string $scmCmdline, string $path): array
- {
- $prettyVersion = $version;
- if (!isset($packageConfig['extra']['branch-alias'][$version])
- || strpos(json_encode($packageConfig), '"self.version"')
- ) {
- $branch = Preg::replace('{^dev-}', '', $version);
- $length = PHP_INT_MAX;
- if (!$this->isFeatureBranch($packageConfig, $branch)) {
- return ['version' => $version, 'pretty_version' => $prettyVersion];
- }
- usort($branches, static function ($a, $b): int {
- $aRemote = 0 === strpos($a, 'remotes/');
- $bRemote = 0 === strpos($b, 'remotes/');
- if ($aRemote !== $bRemote) {
- return $aRemote ? 1 : -1;
- }
- return strnatcasecmp($b, $a);
- });
- $promises = [];
- $this->process->setMaxJobs(30);
- try {
- foreach ($branches as $candidate) {
- $candidateVersion = Preg::replace('{^remotes/\S+/}', '', $candidate);
- if ($candidate === $branch || $this->isFeatureBranch($packageConfig, $candidateVersion)) {
- continue;
- }
- $cmdLine = str_replace(['%candidate%', '%branch%'], [$candidate, $branch], $scmCmdline);
- $promises[] = $this->process->executeAsync($cmdLine, $path)->then(function (Process $process) use (&$length, &$version, &$prettyVersion, $candidateVersion, &$promises): void {
- if (!$process->isSuccessful()) {
- return;
- }
- $output = $process->getOutput();
- if (strlen($output) < $length) {
- $length = strlen($output);
- $version = $this->versionParser->normalizeBranch($candidateVersion);
- $prettyVersion = 'dev-' . $candidateVersion;
- if ($length === 0) {
- foreach ($promises as $promise) {
- if ($promise instanceof CancellablePromiseInterface) {
- $promise->cancel();
- }
- }
- }
- }
- });
- }
- $this->process->wait();
- } finally {
- $this->process->resetMaxJobs();
- }
- }
- return ['version' => $version, 'pretty_version' => $prettyVersion];
- }
- private function isFeatureBranch(array $packageConfig, ?string $branchName): bool
- {
- $nonFeatureBranches = '';
- if (!empty($packageConfig['non-feature-branches'])) {
- $nonFeatureBranches = implode('|', $packageConfig['non-feature-branches']);
- }
- return !Preg::isMatch('{^(' . $nonFeatureBranches . '|master|main|latest|next|current|support|tip|trunk|default|develop|\d+\..+)$}', $branchName, $match);
- }
- private function guessFossilVersion(string $path): array
- {
- $version = null;
- $prettyVersion = null;
- if (0 === $this->process->execute('fossil branch list', $output, $path)) {
- $branch = trim($output);
- $version = $this->versionParser->normalizeBranch($branch);
- $prettyVersion = 'dev-' . $branch;
- }
- if (0 === $this->process->execute('fossil tag list', $output, $path)) {
- try {
- $version = $this->versionParser->normalize(trim($output));
- $prettyVersion = trim($output);
- } catch (\Exception $e) {
- }
- }
- return ['version' => $version, 'commit' => '', 'pretty_version' => $prettyVersion];
- }
- private function guessSvnVersion(array $packageConfig, string $path): ?array
- {
- SvnUtil::cleanEnv();
- if (0 === $this->process->execute('svn info --xml', $output, $path)) {
- $trunkPath = isset($packageConfig['trunk-path']) ? preg_quote($packageConfig['trunk-path'], '#') : 'trunk';
- $branchesPath = isset($packageConfig['branches-path']) ? preg_quote($packageConfig['branches-path'], '#') : 'branches';
- $tagsPath = isset($packageConfig['tags-path']) ? preg_quote($packageConfig['tags-path'], '#') : 'tags';
- $urlPattern = '#<url>.*/(' . $trunkPath . '|(' . $branchesPath . '|' . $tagsPath . ')/(.*))</url>#';
- if (Preg::isMatch($urlPattern, $output, $matches)) {
- if (isset($matches[2]) && ($branchesPath === $matches[2] || $tagsPath === $matches[2])) {
- $version = $this->versionParser->normalizeBranch($matches[3]);
- $prettyVersion = 'dev-' . $matches[3];
- return ['version' => $version, 'commit' => '', 'pretty_version' => $prettyVersion];
- }
- $prettyVersion = trim($matches[1]);
- if ($prettyVersion === 'trunk') {
- $version = 'dev-trunk';
- } else {
- $version = $this->versionParser->normalize($prettyVersion);
- }
- return ['version' => $version, 'commit' => '', 'pretty_version' => $prettyVersion];
- }
- }
- return null;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Package\Version;
- use Composer\Pcre\Preg;
- use Composer\Repository\PlatformRepository;
- use Composer\Semver\VersionParser as SemverVersionParser;
- use Composer\Semver\Semver;
- use Composer\Semver\Constraint\ConstraintInterface;
- class VersionParser extends SemverVersionParser
- {
- public const DEFAULT_BRANCH_ALIAS = '9999999-dev';
- private static $constraints = [];
- public function parseConstraints($constraints): ConstraintInterface
- {
- if (!isset(self::$constraints[$constraints])) {
- self::$constraints[$constraints] = parent::parseConstraints($constraints);
- }
- return self::$constraints[$constraints];
- }
- public function parseNameVersionPairs(array $pairs): array
- {
- $pairs = array_values($pairs);
- $result = [];
- for ($i = 0, $count = count($pairs); $i < $count; $i++) {
- $pair = Preg::replace('{^([^=: ]+)[=: ](.*)$}', '$1 $2', trim($pairs[$i]));
- 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])) {
- $pair .= ' '.$pairs[$i + 1];
- $i++;
- }
- if (strpos($pair, ' ')) {
- [$name, $version] = explode(' ', $pair, 2);
- $result[] = ['name' => $name, 'version' => $version];
- } else {
- $result[] = ['name' => $pair];
- }
- }
- return $result;
- }
- public static function isUpgrade(string $normalizedFrom, string $normalizedTo): bool
- {
- if ($normalizedFrom === $normalizedTo) {
- return true;
- }
- if (in_array($normalizedFrom, ['dev-master', 'dev-trunk', 'dev-default'], true)) {
- $normalizedFrom = VersionParser::DEFAULT_BRANCH_ALIAS;
- }
- if (in_array($normalizedTo, ['dev-master', 'dev-trunk', 'dev-default'], true)) {
- $normalizedTo = VersionParser::DEFAULT_BRANCH_ALIAS;
- }
- if (strpos($normalizedFrom, 'dev-') === 0 || strpos($normalizedTo, 'dev-') === 0) {
- return true;
- }
- $sorted = Semver::sort([$normalizedTo, $normalizedFrom]);
- return $sorted[0] === $normalizedFrom;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Package\Version;
- use Composer\Filter\PlatformRequirementFilter\IgnoreAllPlatformRequirementFilter;
- use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterFactory;
- use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterInterface;
- use Composer\IO\IOInterface;
- use Composer\Package\BasePackage;
- use Composer\Package\AliasPackage;
- use Composer\Package\PackageInterface;
- use Composer\Composer;
- use Composer\Package\Loader\ArrayLoader;
- use Composer\Package\Dumper\ArrayDumper;
- use Composer\Pcre\Preg;
- use Composer\Repository\RepositorySet;
- use Composer\Repository\PlatformRepository;
- use Composer\Semver\Constraint\Constraint;
- use Composer\Semver\Constraint\ConstraintInterface;
- class VersionSelector
- {
- private $repositorySet;
- private $platformConstraints = [];
- private $parser;
- public function __construct(RepositorySet $repositorySet, ?PlatformRepository $platformRepo = null)
- {
- $this->repositorySet = $repositorySet;
- if ($platformRepo) {
- foreach ($platformRepo->getPackages() as $package) {
- $this->platformConstraints[$package->getName()][] = new Constraint('==', $package->getVersion());
- }
- }
- }
- public function findBestCandidate(string $packageName, ?string $targetPackageVersion = null, string $preferredStability = 'stable', $platformRequirementFilter = null, int $repoSetFlags = 0, ?IOInterface $io = null)
- {
- if (!isset(BasePackage::$stabilities[$preferredStability])) {
- throw new \UnexpectedValueException('Expected a valid stability name as 3rd argument, got '.$preferredStability);
- }
- if (null === $platformRequirementFilter) {
- $platformRequirementFilter = PlatformRequirementFilterFactory::ignoreNothing();
- } elseif (!($platformRequirementFilter instanceof PlatformRequirementFilterInterface)) {
- 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);
- $platformRequirementFilter = PlatformRequirementFilterFactory::fromBoolOrList($platformRequirementFilter);
- }
- $constraint = $targetPackageVersion ? $this->getParser()->parseConstraints($targetPackageVersion) : null;
- $candidates = $this->repositorySet->findPackages(strtolower($packageName), $constraint, $repoSetFlags);
- $minPriority = BasePackage::$stabilities[$preferredStability];
- usort($candidates, static function (PackageInterface $a, PackageInterface $b) use ($minPriority) {
- $aPriority = $a->getStabilityPriority();
- $bPriority = $b->getStabilityPriority();
- if ($minPriority < $aPriority && $bPriority < $aPriority) {
- return 1;
- }
- if ($minPriority < $aPriority && $aPriority < $bPriority) {
- return -1;
- }
- if ($minPriority >= $aPriority && $minPriority < $bPriority) {
- return -1;
- }
- return version_compare($b->getVersion(), $a->getVersion());
- });
- if (count($this->platformConstraints) > 0 && !($platformRequirementFilter instanceof IgnoreAllPlatformRequirementFilter)) {
- $alreadyWarnedNames = [];
- foreach ($candidates as $pkg) {
- $reqs = $pkg->getRequires();
- foreach ($reqs as $name => $link) {
- if (!PlatformRepository::isPlatformPackage($name) || $platformRequirementFilter->isIgnored($name)) {
- continue;
- }
- if (isset($this->platformConstraints[$name])) {
- foreach ($this->platformConstraints[$name] as $providedConstraint) {
- if ($link->getConstraint()->matches($providedConstraint)) {
- continue 2;
- }
- }
- $reason = 'is not satisfied by your platform';
- } else {
- $reason = 'is missing from your platform';
- }
- if ($io !== null) {
- $isFirst = !isset($alreadyWarnedNames[$pkg->getName()]);
- $alreadyWarnedNames[$pkg->getName()] = true;
- $latest = $isFirst ? "'s latest version" : '';
- $io->writeError(
- '<warning>Cannot use '.$pkg->getPrettyName().$latest.' '.$pkg->getPrettyVersion().' as it '.$link->getDescription().' '.$link->getTarget().' '.$link->getPrettyConstraint().' which '.$reason.'.</>',
- true,
- $isFirst ? IOInterface::NORMAL : IOInterface::VERBOSE
- );
- }
- continue 2;
- }
- $package = $pkg;
- break;
- }
- } else {
- $package = count($candidates) > 0 ? $candidates[0] : null;
- }
- if (!isset($package)) {
- return false;
- }
- if ($package instanceof AliasPackage && $package->getVersion() === VersionParser::DEFAULT_BRANCH_ALIAS) {
- $package = $package->getAliasOf();
- }
- return $package;
- }
- public function findRecommendedRequireVersion(PackageInterface $package): string
- {
- if (0 === strpos($package->getName(), 'ext-')) {
- $phpVersion = PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION . '.' . PHP_RELEASE_VERSION;
- $extVersion = implode('.', array_slice(explode('.', $package->getVersion()), 0, 3));
- if ($phpVersion === $extVersion) {
- return '*';
- }
- }
- $version = $package->getVersion();
- if (!$package->isDev()) {
- return $this->transformVersion($version, $package->getPrettyVersion(), $package->getStability());
- }
- $loader = new ArrayLoader($this->getParser());
- $dumper = new ArrayDumper();
- $extra = $loader->getBranchAlias($dumper->dump($package));
- if ($extra && $extra !== VersionParser::DEFAULT_BRANCH_ALIAS) {
- $extra = Preg::replace('{^(\d+\.\d+\.\d+)(\.9999999)-dev$}', '$1.0', $extra, -1, $count);
- if ($count) {
- $extra = str_replace('.9999999', '.0', $extra);
- return $this->transformVersion($extra, $extra, 'dev');
- }
- }
- return $package->getPrettyVersion();
- }
- private function transformVersion(string $version, string $prettyVersion, string $stability): string
- {
- $semanticVersionParts = explode('.', $version);
- if (count($semanticVersionParts) === 4 && Preg::isMatch('{^0\D?}', $semanticVersionParts[3])) {
- if ($semanticVersionParts[0] === '0') {
- unset($semanticVersionParts[3]);
- } else {
- unset($semanticVersionParts[2], $semanticVersionParts[3]);
- }
- $version = implode('.', $semanticVersionParts);
- } else {
- return $prettyVersion;
- }
- if ($stability !== 'stable') {
- $version .= '@'.$stability;
- }
- return '^' . $version;
- }
- private function getParser(): VersionParser
- {
- if ($this->parser === null) {
- $this->parser = new VersionParser();
- }
- return $this->parser;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer;
- use Composer\Package\RootPackageInterface;
- use Composer\Util\Loop;
- use Composer\Repository\RepositoryManager;
- use Composer\Installer\InstallationManager;
- use Composer\EventDispatcher\EventDispatcher;
- class PartialComposer
- {
- private $package;
- private $loop;
- private $repositoryManager;
- private $installationManager;
- private $config;
- private $eventDispatcher;
- public function setPackage(RootPackageInterface $package): void
- {
- $this->package = $package;
- }
- public function getPackage(): RootPackageInterface
- {
- return $this->package;
- }
- public function setConfig(Config $config): void
- {
- $this->config = $config;
- }
- public function getConfig(): Config
- {
- return $this->config;
- }
- public function setLoop(Loop $loop): void
- {
- $this->loop = $loop;
- }
- public function getLoop(): Loop
- {
- return $this->loop;
- }
- public function setRepositoryManager(RepositoryManager $manager): void
- {
- $this->repositoryManager = $manager;
- }
- public function getRepositoryManager(): RepositoryManager
- {
- return $this->repositoryManager;
- }
- public function setInstallationManager(InstallationManager $manager): void
- {
- $this->installationManager = $manager;
- }
- public function getInstallationManager(): InstallationManager
- {
- return $this->installationManager;
- }
- public function setEventDispatcher(EventDispatcher $eventDispatcher): void
- {
- $this->eventDispatcher = $eventDispatcher;
- }
- public function getEventDispatcher(): EventDispatcher
- {
- return $this->eventDispatcher;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Platform;
- use Composer\Util\Platform;
- use Composer\Util\ProcessExecutor;
- use Symfony\Component\Process\ExecutableFinder;
- class HhvmDetector
- {
- private static $hhvmVersion = null;
- private $executableFinder;
- private $processExecutor;
- public function __construct(?ExecutableFinder $executableFinder = null, ?ProcessExecutor $processExecutor = null)
- {
- $this->executableFinder = $executableFinder;
- $this->processExecutor = $processExecutor;
- }
- public function reset(): void
- {
- self::$hhvmVersion = null;
- }
- public function getVersion(): ?string
- {
- if (null !== self::$hhvmVersion) {
- return self::$hhvmVersion ?: null;
- }
- self::$hhvmVersion = defined('HHVM_VERSION') ? HHVM_VERSION : null;
- if (self::$hhvmVersion === null && !Platform::isWindows()) {
- self::$hhvmVersion = false;
- $this->executableFinder = $this->executableFinder ?: new ExecutableFinder();
- $hhvmPath = $this->executableFinder->find('hhvm');
- if ($hhvmPath !== null) {
- $this->processExecutor = $this->processExecutor ?? new ProcessExecutor();
- $exitCode = $this->processExecutor->execute(
- ProcessExecutor::escape($hhvmPath).
- ' --php -d hhvm.jit=0 -r "echo HHVM_VERSION;" 2>/dev/null',
- self::$hhvmVersion
- );
- if ($exitCode !== 0) {
- self::$hhvmVersion = false;
- }
- }
- }
- return self::$hhvmVersion ?: null;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Platform;
- class Runtime
- {
- public function hasConstant(string $constant, ?string $class = null): bool
- {
- return defined(ltrim($class.'::'.$constant, ':'));
- }
- public function getConstant(string $constant, ?string $class = null)
- {
- return constant(ltrim($class.'::'.$constant, ':'));
- }
- public function hasFunction(string $fn): bool
- {
- return function_exists($fn);
- }
- public function invoke(callable $callable, array $arguments = [])
- {
- return $callable(...$arguments);
- }
- public function hasClass(string $class): bool
- {
- return class_exists($class, false);
- }
- public function construct(string $class, array $arguments = []): object
- {
- if (empty($arguments)) {
- return new $class;
- }
- $refl = new \ReflectionClass($class);
- return $refl->newInstanceArgs($arguments);
- }
- public function getExtensions(): array
- {
- return get_loaded_extensions();
- }
- public function getExtensionVersion(string $extension): string
- {
- $version = phpversion($extension);
- if ($version === false) {
- $version = '0';
- }
- return $version;
- }
- public function getExtensionInfo(string $extension): string
- {
- $reflector = new \ReflectionExtension($extension);
- ob_start();
- $reflector->info();
- return ob_get_clean();
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Platform;
- use Composer\Pcre\Preg;
- class Version
- {
- public static function parseOpenssl(string $opensslVersion, ?bool &$isFips): ?string
- {
- $isFips = false;
- if (!Preg::isMatch('/^(?<version>[0-9.]+)(?<patch>[a-z]{0,2})?(?<suffix>(?:-?(?:dev|pre|alpha|beta|rc|fips)[\d]*)*)?(?<garbage>-\w+)?(?<garbage2> \(.+?\))?$/', $opensslVersion, $matches)) {
- return null;
- }
- $patch = '';
- if (version_compare($matches['version'], '3.0.0', '<')) {
- $patch = '.'.self::convertAlphaVersionToIntVersion($matches['patch']);
- }
- $isFips = strpos($matches['suffix'], 'fips') !== false;
- $suffix = strtr('-'.ltrim($matches['suffix'], '-'), ['-fips' => '', '-pre' => '-alpha']);
- return rtrim($matches['version'].$patch.$suffix, '-');
- }
- public static function parseLibjpeg(string $libjpegVersion): ?string
- {
- if (!Preg::isMatch('/^(?<major>\d+)(?<minor>[a-z]*)$/', $libjpegVersion, $matches)) {
- return null;
- }
- return $matches['major'].'.'.self::convertAlphaVersionToIntVersion($matches['minor']);
- }
- public static function parseZoneinfoVersion(string $zoneinfoVersion): ?string
- {
- if (!Preg::isMatch('/^(?<year>\d{4})(?<revision>[a-z]*)$/', $zoneinfoVersion, $matches)) {
- return null;
- }
- return $matches['year'].'.'.self::convertAlphaVersionToIntVersion($matches['revision']);
- }
- private static function convertAlphaVersionToIntVersion(string $alpha): int
- {
- return strlen($alpha) * (-ord('a') + 1) + array_sum(array_map('ord', str_split($alpha)));
- }
- public static function convertLibxpmVersionId(int $versionId): string
- {
- return self::convertVersionId($versionId, 100);
- }
- public static function convertOpenldapVersionId(int $versionId): string
- {
- return self::convertVersionId($versionId, 100);
- }
- private static function convertVersionId(int $versionId, int $base): string
- {
- return sprintf(
- '%d.%d.%d',
- $versionId / ($base * $base),
- (int) ($versionId / $base) % $base,
- $versionId % $base
- );
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Plugin\Capability;
- interface Capability
- {
- }
- <?php declare(strict_types=1);
- namespace Composer\Plugin\Capability;
- interface CommandProvider extends Capability
- {
- public function getCommands();
- }
- <?php declare(strict_types=1);
- namespace Composer\Plugin;
- interface Capable
- {
- public function getCapabilities();
- }
- <?php declare(strict_types=1);
- namespace Composer\Plugin;
- use Composer\EventDispatcher\Event;
- use Symfony\Component\Console\Input\InputInterface;
- use Symfony\Component\Console\Output\OutputInterface;
- class CommandEvent extends Event
- {
- private $commandName;
- private $input;
- private $output;
- public function __construct(string $name, string $commandName, InputInterface $input, OutputInterface $output, array $args = [], array $flags = [])
- {
- parent::__construct($name, $args, $flags);
- $this->commandName = $commandName;
- $this->input = $input;
- $this->output = $output;
- }
- public function getInput(): InputInterface
- {
- return $this->input;
- }
- public function getOutput(): OutputInterface
- {
- return $this->output;
- }
- public function getCommandName(): string
- {
- return $this->commandName;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Plugin;
- use UnexpectedValueException;
- class PluginBlockedException extends UnexpectedValueException
- {
- }
- <?php declare(strict_types=1);
- namespace Composer\Plugin;
- class PluginEvents
- {
- public const INIT = 'init';
- public const COMMAND = 'command';
- public const PRE_FILE_DOWNLOAD = 'pre-file-download';
- public const POST_FILE_DOWNLOAD = 'post-file-download';
- public const PRE_COMMAND_RUN = 'pre-command-run';
- public const PRE_POOL_CREATE = 'pre-pool-create';
- }
- <?php declare(strict_types=1);
- namespace Composer\Plugin;
- use Composer\Composer;
- use Composer\IO\IOInterface;
- interface PluginInterface
- {
- public const PLUGIN_API_VERSION = '2.3.0';
- public function activate(Composer $composer, IOInterface $io);
- public function deactivate(Composer $composer, IOInterface $io);
- public function uninstall(Composer $composer, IOInterface $io);
- }
- <?php declare(strict_types=1);
- namespace Composer\Plugin;
- use Composer\Composer;
- use Composer\EventDispatcher\EventSubscriberInterface;
- use Composer\Installer\InstallerInterface;
- use Composer\IO\IOInterface;
- use Composer\Package\BasePackage;
- use Composer\Package\CompletePackage;
- use Composer\Package\Locker;
- use Composer\Package\Package;
- use Composer\Package\Version\VersionParser;
- use Composer\PartialComposer;
- use Composer\Pcre\Preg;
- use Composer\Repository\RepositoryInterface;
- use Composer\Repository\InstalledRepository;
- use Composer\Repository\RootPackageRepository;
- use Composer\Package\PackageInterface;
- use Composer\Package\Link;
- use Composer\Semver\Constraint\Constraint;
- use Composer\Plugin\Capability\Capability;
- use Composer\Util\PackageSorter;
- class PluginManager
- {
- protected $composer;
- protected $io;
- protected $globalComposer;
- protected $versionParser;
- protected $disablePlugins = false;
- protected $plugins = [];
- protected $registeredPlugins = [];
- private $allowPluginRules;
- private $allowGlobalPluginRules;
- private $runningInGlobalDir = false;
- private static $classCounter = 0;
- public function __construct(IOInterface $io, Composer $composer, ?PartialComposer $globalComposer = null, $disablePlugins = false)
- {
- $this->io = $io;
- $this->composer = $composer;
- $this->globalComposer = $globalComposer;
- $this->versionParser = new VersionParser();
- $this->disablePlugins = $disablePlugins;
- $this->allowPluginRules = $this->parseAllowedPlugins($composer->getConfig()->get('allow-plugins'), $composer->getLocker());
- $this->allowGlobalPluginRules = $this->parseAllowedPlugins($globalComposer !== null ? $globalComposer->getConfig()->get('allow-plugins') : false);
- }
- public function setRunningInGlobalDir(bool $runningInGlobalDir): void
- {
- $this->runningInGlobalDir = $runningInGlobalDir;
- }
- public function loadInstalledPlugins(): void
- {
- if (!$this->arePluginsDisabled('local')) {
- $repo = $this->composer->getRepositoryManager()->getLocalRepository();
- $this->loadRepository($repo, false);
- }
- if ($this->globalComposer !== null && !$this->arePluginsDisabled('global')) {
- $this->loadRepository($this->globalComposer->getRepositoryManager()->getLocalRepository(), true);
- }
- }
- public function deactivateInstalledPlugins(): void
- {
- if (!$this->arePluginsDisabled('local')) {
- $repo = $this->composer->getRepositoryManager()->getLocalRepository();
- $this->deactivateRepository($repo, false);
- }
- if ($this->globalComposer !== null && !$this->arePluginsDisabled('global')) {
- $this->deactivateRepository($this->globalComposer->getRepositoryManager()->getLocalRepository(), true);
- }
- }
- public function getPlugins(): array
- {
- return $this->plugins;
- }
- public function getGlobalComposer(): ?PartialComposer
- {
- return $this->globalComposer;
- }
- public function registerPackage(PackageInterface $package, bool $failOnMissingClasses = false, bool $isGlobalPlugin = false): void
- {
- if ($this->arePluginsDisabled($isGlobalPlugin ? 'global' : 'local')) {
- return;
- }
- if ($package->getType() === 'composer-plugin') {
- $requiresComposer = null;
- foreach ($package->getRequires() as $link) {
- if ('composer-plugin-api' === $link->getTarget()) {
- $requiresComposer = $link->getConstraint();
- break;
- }
- }
- if (!$requiresComposer) {
- throw new \RuntimeException("Plugin ".$package->getName()." is missing a require statement for a version of the composer-plugin-api package.");
- }
- $currentPluginApiVersion = $this->getPluginApiVersion();
- $currentPluginApiConstraint = new Constraint('==', $this->versionParser->normalize($currentPluginApiVersion));
- if ($requiresComposer->getPrettyString() === $this->getPluginApiVersion()) {
- $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>');
- } elseif (!$requiresComposer->matches($currentPluginApiConstraint)) {
- $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>');
- return;
- }
- if ($package->getName() === 'symfony/flex' && Preg::isMatch('{^[0-9.]+$}', $package->getVersion()) && version_compare($package->getVersion(), '1.9.8', '<')) {
- $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>');
- return;
- }
- }
- if (!$this->isPluginAllowed($package->getName(), $isGlobalPlugin)) {
- $this->io->writeError('Skipped loading "'.$package->getName() . '" '.($isGlobalPlugin || $this->runningInGlobalDir ? '(installed globally) ' : '').'as it is not in config.allow-plugins', true, IOInterface::DEBUG);
- return;
- }
- $oldInstallerPlugin = ($package->getType() === 'composer-installer');
- if (isset($this->registeredPlugins[$package->getName()])) {
- return;
- }
- $extra = $package->getExtra();
- if (empty($extra['class'])) {
- throw new \UnexpectedValueException('Error while installing '.$package->getPrettyName().', composer-plugin packages should have a class defined in their extra key to be usable.');
- }
- $classes = is_array($extra['class']) ? $extra['class'] : [$extra['class']];
- $localRepo = $this->composer->getRepositoryManager()->getLocalRepository();
- $globalRepo = $this->globalComposer !== null ? $this->globalComposer->getRepositoryManager()->getLocalRepository() : null;
- $rootPackage = clone $this->composer->getPackage();
- $rootPackageAutoloads = $rootPackage->getAutoload();
- $rootPackageAutoloads['files'] = [];
- $rootPackage->setAutoload($rootPackageAutoloads);
- $rootPackageAutoloads = $rootPackage->getDevAutoload();
- $rootPackageAutoloads['files'] = [];
- $rootPackage->setDevAutoload($rootPackageAutoloads);
- unset($rootPackageAutoloads);
- $rootPackageRepo = new RootPackageRepository($rootPackage);
- $installedRepo = new InstalledRepository([$localRepo, $rootPackageRepo]);
- if ($globalRepo) {
- $installedRepo->addRepository($globalRepo);
- }
- $autoloadPackages = [$package->getName() => $package];
- $autoloadPackages = $this->collectDependencies($installedRepo, $autoloadPackages, $package);
- $generator = $this->composer->getAutoloadGenerator();
- $autoloads = [[$rootPackage, '']];
- foreach ($autoloadPackages as $autoloadPackage) {
- if ($autoloadPackage === $rootPackage) {
- continue;
- }
- $downloadPath = $this->getInstallPath($autoloadPackage, $globalRepo && $globalRepo->hasPackage($autoloadPackage));
- $autoloads[] = [$autoloadPackage, $downloadPath];
- }
- $map = $generator->parseAutoloads($autoloads, $rootPackage);
- $classLoader = $generator->createLoader($map, $this->composer->getConfig()->get('vendor-dir'));
- $classLoader->register(false);
- foreach ($map['files'] as $fileIdentifier => $file) {
- if ($fileIdentifier === '7e9bd612cc444b3eed788ebbe46263a0') {
- continue;
- }
- \Composer\Autoload\composerRequire($fileIdentifier, $file);
- }
- foreach ($classes as $class) {
- if (class_exists($class, false)) {
- $class = trim($class, '\\');
- $path = $classLoader->findFile($class);
- $code = file_get_contents($path);
- $separatorPos = strrpos($class, '\\');
- $className = $class;
- if ($separatorPos) {
- $className = substr($class, $separatorPos + 1);
- }
- $code = Preg::replace('{^((?:final\s+)?(?:\s*))class\s+('.preg_quote($className).')}mi', '$1class $2_composer_tmp'.self::$classCounter, $code, 1);
- $code = strtr($code, [
- '__FILE__' => var_export($path, true),
- '__DIR__' => var_export(dirname($path), true),
- '__CLASS__' => var_export($class, true),
- ]);
- $code = Preg::replace('/^\s*<\?(php)?/i', '', $code, 1);
- eval($code);
- $class .= '_composer_tmp'.self::$classCounter;
- self::$classCounter++;
- }
- if ($oldInstallerPlugin) {
- if (!is_a($class, 'Composer\Installer\InstallerInterface', true)) {
- throw new \RuntimeException('Could not activate plugin "'.$package->getName().'" as "'.$class.'" does not implement Composer\Installer\InstallerInterface');
- }
- $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>');
- $installer = new $class($this->io, $this->composer);
- $this->composer->getInstallationManager()->addInstaller($installer);
- $this->registeredPlugins[$package->getName()] = $installer;
- } elseif (class_exists($class)) {
- if (!is_a($class, 'Composer\Plugin\PluginInterface', true)) {
- throw new \RuntimeException('Could not activate plugin "'.$package->getName().'" as "'.$class.'" does not implement Composer\Plugin\PluginInterface');
- }
- $plugin = new $class();
- $this->addPlugin($plugin, $isGlobalPlugin, $package);
- $this->registeredPlugins[$package->getName()] = $plugin;
- } elseif ($failOnMissingClasses) {
- throw new \UnexpectedValueException('Plugin '.$package->getName().' could not be initialized, class not found: '.$class);
- }
- }
- }
- public function deactivatePackage(PackageInterface $package): void
- {
- if (!isset($this->registeredPlugins[$package->getName()])) {
- return;
- }
- $plugin = $this->registeredPlugins[$package->getName()];
- unset($this->registeredPlugins[$package->getName()]);
- if ($plugin instanceof InstallerInterface) {
- $this->composer->getInstallationManager()->removeInstaller($plugin);
- } else {
- $this->removePlugin($plugin);
- }
- }
- public function uninstallPackage(PackageInterface $package): void
- {
- if (!isset($this->registeredPlugins[$package->getName()])) {
- return;
- }
- $plugin = $this->registeredPlugins[$package->getName()];
- if ($plugin instanceof InstallerInterface) {
- $this->deactivatePackage($package);
- } else {
- unset($this->registeredPlugins[$package->getName()]);
- $this->removePlugin($plugin);
- $this->uninstallPlugin($plugin);
- }
- }
- protected function getPluginApiVersion(): string
- {
- return PluginInterface::PLUGIN_API_VERSION;
- }
- public function addPlugin(PluginInterface $plugin, bool $isGlobalPlugin = false, ?PackageInterface $sourcePackage = null): void
- {
- if ($this->arePluginsDisabled($isGlobalPlugin ? 'global' : 'local')) {
- return;
- }
- if ($sourcePackage === null) {
- 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);
- } elseif (!$this->isPluginAllowed($sourcePackage->getName(), $isGlobalPlugin)) {
- $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);
- return;
- }
- $details = [];
- if ($sourcePackage) {
- $details[] = 'from '.$sourcePackage->getName();
- }
- if ($isGlobalPlugin || $this->runningInGlobalDir) {
- $details[] = 'installed globally';
- }
- $this->io->writeError('Loading plugin '.get_class($plugin).($details ? ' ('.implode(', ', $details).')' : ''), true, IOInterface::DEBUG);
- $this->plugins[] = $plugin;
- $plugin->activate($this->composer, $this->io);
- if ($plugin instanceof EventSubscriberInterface) {
- $this->composer->getEventDispatcher()->addSubscriber($plugin);
- }
- }
- public function removePlugin(PluginInterface $plugin): void
- {
- $index = array_search($plugin, $this->plugins, true);
- if ($index === false) {
- return;
- }
- $this->io->writeError('Unloading plugin '.get_class($plugin), true, IOInterface::DEBUG);
- unset($this->plugins[$index]);
- $plugin->deactivate($this->composer, $this->io);
- $this->composer->getEventDispatcher()->removeListener($plugin);
- }
- public function uninstallPlugin(PluginInterface $plugin): void
- {
- $this->io->writeError('Uninstalling plugin '.get_class($plugin), true, IOInterface::DEBUG);
- $plugin->uninstall($this->composer, $this->io);
- }
- private function loadRepository(RepositoryInterface $repo, bool $isGlobalRepo): void
- {
- $packages = $repo->getPackages();
- $weights = [];
- foreach ($packages as $package) {
- if ($package->getType() === 'composer-plugin') {
- $extra = $package->getExtra();
- if ($package->getName() === 'composer/installers' || true === ($extra['plugin-modifies-install-path'] ?? false)) {
- $weights[$package->getName()] = -10000;
- }
- }
- }
- $sortedPackages = PackageSorter::sortPackages($packages, $weights);
- foreach ($sortedPackages as $package) {
- if (!($package instanceof CompletePackage)) {
- continue;
- }
- if ('composer-plugin' === $package->getType()) {
- $this->registerPackage($package, false, $isGlobalRepo);
- } elseif ('composer-installer' === $package->getType()) {
- $this->registerPackage($package, false, $isGlobalRepo);
- }
- }
- }
- private function deactivateRepository(RepositoryInterface $repo, bool $isGlobalRepo): void
- {
- $packages = $repo->getPackages();
- $sortedPackages = array_reverse(PackageSorter::sortPackages($packages));
- foreach ($sortedPackages as $package) {
- if (!($package instanceof CompletePackage)) {
- continue;
- }
- if ('composer-plugin' === $package->getType()) {
- $this->deactivatePackage($package);
- } elseif ('composer-installer' === $package->getType()) {
- $this->deactivatePackage($package);
- }
- }
- }
- private function collectDependencies(InstalledRepository $installedRepo, array $collected, PackageInterface $package): array
- {
- foreach ($package->getRequires() as $requireLink) {
- foreach ($installedRepo->findPackagesWithReplacersAndProviders($requireLink->getTarget()) as $requiredPackage) {
- if (!isset($collected[$requiredPackage->getName()])) {
- $collected[$requiredPackage->getName()] = $requiredPackage;
- $collected = $this->collectDependencies($installedRepo, $collected, $requiredPackage);
- }
- }
- }
- return $collected;
- }
- private function getInstallPath(PackageInterface $package, bool $global = false): string
- {
- if (!$global) {
- return $this->composer->getInstallationManager()->getInstallPath($package);
- }
- assert(null !== $this->globalComposer);
- return $this->globalComposer->getInstallationManager()->getInstallPath($package);
- }
- protected function getCapabilityImplementationClassName(PluginInterface $plugin, string $capability): ?string
- {
- if (!($plugin instanceof Capable)) {
- return null;
- }
- $capabilities = (array) $plugin->getCapabilities();
- if (!empty($capabilities[$capability]) && is_string($capabilities[$capability]) && trim($capabilities[$capability])) {
- return trim($capabilities[$capability]);
- }
- if (
- array_key_exists($capability, $capabilities)
- && (empty($capabilities[$capability]) || !is_string($capabilities[$capability]) || !trim($capabilities[$capability]))
- ) {
- throw new \UnexpectedValueException('Plugin '.get_class($plugin).' provided invalid capability class name(s), got '.var_export($capabilities[$capability], true));
- }
- return null;
- }
- public function getPluginCapability(PluginInterface $plugin, $capabilityClassName, array $ctorArgs = []): ?Capability
- {
- if ($capabilityClass = $this->getCapabilityImplementationClassName($plugin, $capabilityClassName)) {
- if (!class_exists($capabilityClass)) {
- throw new \RuntimeException("Cannot instantiate Capability, as class $capabilityClass from plugin ".get_class($plugin)." does not exist.");
- }
- $ctorArgs['plugin'] = $plugin;
- $capabilityObj = new $capabilityClass($ctorArgs);
- if (!$capabilityObj instanceof Capability || !$capabilityObj instanceof $capabilityClassName) {
- throw new \RuntimeException(
- 'Class ' . $capabilityClass . ' must implement both Composer\Plugin\Capability\Capability and '. $capabilityClassName . '.'
- );
- }
- return $capabilityObj;
- }
- return null;
- }
- public function getPluginCapabilities($capabilityClassName, array $ctorArgs = []): array
- {
- $capabilities = [];
- foreach ($this->getPlugins() as $plugin) {
- $capability = $this->getPluginCapability($plugin, $capabilityClassName, $ctorArgs);
- if (null !== $capability) {
- $capabilities[] = $capability;
- }
- }
- return $capabilities;
- }
- private function parseAllowedPlugins($allowPluginsConfig, ?Locker $locker = null): ?array
- {
- if ([] === $allowPluginsConfig && $locker !== null && $locker->isLocked() && version_compare($locker->getPluginApi(), '2.2.0', '<')) {
- return null;
- }
- if (true === $allowPluginsConfig) {
- return ['{}' => true];
- }
- if (false === $allowPluginsConfig) {
- return ['{}' => false];
- }
- $rules = [];
- foreach ($allowPluginsConfig as $pattern => $allow) {
- $rules[BasePackage::packageNameToRegexp($pattern)] = $allow;
- }
- return $rules;
- }
- public function arePluginsDisabled($type)
- {
- return $this->disablePlugins === true || $this->disablePlugins === $type;
- }
- public function isPluginAllowed(string $package, bool $isGlobalPlugin): bool
- {
- if ($isGlobalPlugin) {
- $rules = &$this->allowGlobalPluginRules;
- } else {
- $rules = &$this->allowPluginRules;
- }
- if ($rules === null) {
- if (!$this->io->isInteractive()) {
- $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>');
- $this->io->writeError('<warning>This warning will become an exception once you run composer update!</warning>');
- $rules = ['{}' => true];
- return true;
- }
- $rules = [];
- }
- foreach ($rules as $pattern => $allow) {
- if (Preg::isMatch($pattern, $package)) {
- return $allow === true;
- }
- }
- if ($package === 'composer/package-versions-deprecated') {
- return false;
- }
- if ($this->io->isInteractive()) {
- $composer = $isGlobalPlugin && $this->globalComposer !== null ? $this->globalComposer : $this->composer;
- $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>');
- $attempts = 0;
- while (true) {
- $default = '?';
- if ($attempts > 5) {
- $this->io->writeError('Too many failed prompts, aborting.');
- break;
- }
- 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)) {
- case 'y':
- case 'n':
- case 'd':
- $allow = $answer === 'y';
- $rules[BasePackage::packageNameToRegexp($package)] = $allow;
- if ($answer === 'y' || $answer === 'n') {
- $composer->getConfig()->getConfigSource()->addConfigSetting('allow-plugins.'.$package, $allow);
- }
- return $allow;
- case '?':
- default:
- $attempts++;
- $this->io->writeError([
- 'y - add package to allow-plugins in composer.json and let it run immediately',
- 'n - add package (as disallowed) to allow-plugins in composer.json to suppress further prompts',
- 'd - discard this, do not change composer.json and do not allow the plugin to run',
- '? - print help',
- ]);
- break;
- }
- }
- }
- throw new PluginBlockedException(
- $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.
- '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.
- 'See https://getcomposer.org/allow-plugins'
- );
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Plugin;
- use Composer\EventDispatcher\Event;
- use Composer\Package\PackageInterface;
- class PostFileDownloadEvent extends Event
- {
- private $fileName;
- private $checksum;
- private $url;
- private $context;
- private $type;
- public function __construct(string $name, ?string $fileName, ?string $checksum, string $url, string $type, $context = null)
- {
- if ($context === null && $type instanceof PackageInterface) {
- $context = $type;
- $type = 'package';
- trigger_error('PostFileDownloadEvent::__construct should receive a $type=package and the package object in $context since Composer 2.1.', E_USER_DEPRECATED);
- }
- parent::__construct($name);
- $this->fileName = $fileName;
- $this->checksum = $checksum;
- $this->url = $url;
- $this->context = $context;
- $this->type = $type;
- }
- public function getFileName(): ?string
- {
- return $this->fileName;
- }
- public function getChecksum(): ?string
- {
- return $this->checksum;
- }
- public function getUrl(): string
- {
- return $this->url;
- }
- public function getContext()
- {
- return $this->context;
- }
- public function getPackage(): ?PackageInterface
- {
- trigger_error('PostFileDownloadEvent::getPackage is deprecated since Composer 2.1, use getContext instead.', E_USER_DEPRECATED);
- $context = $this->getContext();
- return $context instanceof PackageInterface ? $context : null;
- }
- public function getType(): string
- {
- return $this->type;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Plugin;
- use Composer\EventDispatcher\Event;
- use Symfony\Component\Console\Input\InputInterface;
- class PreCommandRunEvent extends Event
- {
- private $input;
- private $command;
- public function __construct(string $name, InputInterface $input, string $command)
- {
- parent::__construct($name);
- $this->input = $input;
- $this->command = $command;
- }
- public function getInput(): InputInterface
- {
- return $this->input;
- }
- public function getCommand(): string
- {
- return $this->command;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Plugin;
- use Composer\EventDispatcher\Event;
- use Composer\Util\HttpDownloader;
- class PreFileDownloadEvent extends Event
- {
- private $httpDownloader;
- private $processedUrl;
- private $customCacheKey;
- private $type;
- private $context;
- private $transportOptions = [];
- public function __construct(string $name, HttpDownloader $httpDownloader, string $processedUrl, string $type, $context = null)
- {
- parent::__construct($name);
- $this->httpDownloader = $httpDownloader;
- $this->processedUrl = $processedUrl;
- $this->type = $type;
- $this->context = $context;
- }
- public function getHttpDownloader(): HttpDownloader
- {
- return $this->httpDownloader;
- }
- public function getProcessedUrl(): string
- {
- return $this->processedUrl;
- }
- public function setProcessedUrl(string $processedUrl): void
- {
- $this->processedUrl = $processedUrl;
- }
- public function getCustomCacheKey(): ?string
- {
- return $this->customCacheKey;
- }
- public function setCustomCacheKey(?string $customCacheKey): void
- {
- $this->customCacheKey = $customCacheKey;
- }
- public function getType(): string
- {
- return $this->type;
- }
- public function getContext()
- {
- return $this->context;
- }
- public function getTransportOptions(): array
- {
- return $this->transportOptions;
- }
- public function setTransportOptions(array $options): void
- {
- $this->transportOptions = $options;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Plugin;
- use Composer\EventDispatcher\Event;
- use Composer\Repository\RepositoryInterface;
- use Composer\DependencyResolver\Request;
- use Composer\Package\BasePackage;
- class PrePoolCreateEvent extends Event
- {
- private $repositories;
- private $request;
- private $acceptableStabilities;
- private $stabilityFlags;
- private $rootAliases;
- private $rootReferences;
- private $packages;
- private $unacceptableFixedPackages;
- public function __construct(string $name, array $repositories, Request $request, array $acceptableStabilities, array $stabilityFlags, array $rootAliases, array $rootReferences, array $packages, array $unacceptableFixedPackages)
- {
- parent::__construct($name);
- $this->repositories = $repositories;
- $this->request = $request;
- $this->acceptableStabilities = $acceptableStabilities;
- $this->stabilityFlags = $stabilityFlags;
- $this->rootAliases = $rootAliases;
- $this->rootReferences = $rootReferences;
- $this->packages = $packages;
- $this->unacceptableFixedPackages = $unacceptableFixedPackages;
- }
- public function getRepositories(): array
- {
- return $this->repositories;
- }
- public function getRequest(): Request
- {
- return $this->request;
- }
- public function getAcceptableStabilities(): array
- {
- return $this->acceptableStabilities;
- }
- public function getStabilityFlags(): array
- {
- return $this->stabilityFlags;
- }
- public function getRootAliases(): array
- {
- return $this->rootAliases;
- }
- public function getRootReferences(): array
- {
- return $this->rootReferences;
- }
- public function getPackages(): array
- {
- return $this->packages;
- }
- public function getUnacceptableFixedPackages(): array
- {
- return $this->unacceptableFixedPackages;
- }
- public function setPackages(array $packages): void
- {
- $this->packages = $packages;
- }
- public function setUnacceptableFixedPackages(array $packages): void
- {
- $this->unacceptableFixedPackages = $packages;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Question;
- use Composer\Pcre\Preg;
- use Symfony\Component\Console\Exception\InvalidArgumentException;
- use Symfony\Component\Console\Question\Question;
- class StrictConfirmationQuestion extends Question
- {
- private $trueAnswerRegex;
- private $falseAnswerRegex;
- public function __construct(string $question, bool $default = true, string $trueAnswerRegex = '/^y(?:es)?$/i', string $falseAnswerRegex = '/^no?$/i')
- {
- parent::__construct($question, (bool) $default);
- $this->trueAnswerRegex = $trueAnswerRegex;
- $this->falseAnswerRegex = $falseAnswerRegex;
- $this->setNormalizer($this->getDefaultNormalizer());
- $this->setValidator($this->getDefaultValidator());
- }
- private function getDefaultNormalizer(): callable
- {
- $default = $this->getDefault();
- $trueRegex = $this->trueAnswerRegex;
- $falseRegex = $this->falseAnswerRegex;
- return static function ($answer) use ($default, $trueRegex, $falseRegex) {
- if (is_bool($answer)) {
- return $answer;
- }
- if (empty($answer) && !empty($default)) {
- return $default;
- }
- if (Preg::isMatch($trueRegex, $answer)) {
- return true;
- }
- if (Preg::isMatch($falseRegex, $answer)) {
- return false;
- }
- return null;
- };
- }
- private function getDefaultValidator(): callable
- {
- return static function ($answer): bool {
- if (!is_bool($answer)) {
- throw new InvalidArgumentException('Please answer yes, y, no, or n.');
- }
- return $answer;
- };
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Repository;
- use Composer\Semver\Constraint\ConstraintInterface;
- use Composer\Advisory\PartialSecurityAdvisory;
- use Composer\Advisory\SecurityAdvisory;
- interface AdvisoryProviderInterface
- {
- public function hasSecurityAdvisories(): bool;
- public function getSecurityAdvisories(array $packageConstraintMap, bool $allowPartialAdvisories = false): array;
- }
- <?php declare(strict_types=1);
- namespace Composer\Repository;
- use Composer\Package\AliasPackage;
- use Composer\Package\BasePackage;
- use Composer\Package\CompleteAliasPackage;
- use Composer\Package\CompletePackage;
- use Composer\Package\PackageInterface;
- use Composer\Package\CompletePackageInterface;
- use Composer\Package\Version\VersionParser;
- use Composer\Package\Version\StabilityFilter;
- use Composer\Pcre\Preg;
- use Composer\Semver\Constraint\ConstraintInterface;
- use Composer\Semver\Constraint\Constraint;
- class ArrayRepository implements RepositoryInterface
- {
- protected $packages = null;
- protected $packageMap = null;
- public function __construct(array $packages = [])
- {
- foreach ($packages as $package) {
- $this->addPackage($package);
- }
- }
- public function getRepoName()
- {
- return 'array repo (defining '.$this->count().' package'.($this->count() > 1 ? 's' : '').')';
- }
- public function loadPackages(array $packageNameMap, array $acceptableStabilities, array $stabilityFlags, array $alreadyLoaded = [])
- {
- $packages = $this->getPackages();
- $result = [];
- $namesFound = [];
- foreach ($packages as $package) {
- if (array_key_exists($package->getName(), $packageNameMap)) {
- if (
- (!$packageNameMap[$package->getName()] || $packageNameMap[$package->getName()]->matches(new Constraint('==', $package->getVersion())))
- && StabilityFilter::isPackageAcceptable($acceptableStabilities, $stabilityFlags, $package->getNames(), $package->getStability())
- && !isset($alreadyLoaded[$package->getName()][$package->getVersion()])
- ) {
- $result[spl_object_hash($package)] = $package;
- if ($package instanceof AliasPackage && !isset($result[spl_object_hash($package->getAliasOf())])) {
- $result[spl_object_hash($package->getAliasOf())] = $package->getAliasOf();
- }
- }
- $namesFound[$package->getName()] = true;
- }
- }
- foreach ($packages as $package) {
- if ($package instanceof AliasPackage) {
- if (isset($result[spl_object_hash($package->getAliasOf())])) {
- $result[spl_object_hash($package)] = $package;
- }
- }
- }
- return ['namesFound' => array_keys($namesFound), 'packages' => $result];
- }
- public function findPackage(string $name, $constraint)
- {
- $name = strtolower($name);
- if (!$constraint instanceof ConstraintInterface) {
- $versionParser = new VersionParser();
- $constraint = $versionParser->parseConstraints($constraint);
- }
- foreach ($this->getPackages() as $package) {
- if ($name === $package->getName()) {
- $pkgConstraint = new Constraint('==', $package->getVersion());
- if ($constraint->matches($pkgConstraint)) {
- return $package;
- }
- }
- }
- return null;
- }
- public function findPackages(string $name, $constraint = null)
- {
- $name = strtolower($name);
- $packages = [];
- if (null !== $constraint && !$constraint instanceof ConstraintInterface) {
- $versionParser = new VersionParser();
- $constraint = $versionParser->parseConstraints($constraint);
- }
- foreach ($this->getPackages() as $package) {
- if ($name === $package->getName()) {
- if (null === $constraint || $constraint->matches(new Constraint('==', $package->getVersion()))) {
- $packages[] = $package;
- }
- }
- }
- return $packages;
- }
- public function search(string $query, int $mode = 0, ?string $type = null)
- {
- if ($mode === self::SEARCH_FULLTEXT) {
- $regex = '{(?:'.implode('|', Preg::split('{\s+}', preg_quote($query))).')}i';
- } else {
- $regex = '{(?:'.implode('|', Preg::split('{\s+}', $query)).')}i';
- }
- $matches = [];
- foreach ($this->getPackages() as $package) {
- $name = $package->getName();
- if ($mode === self::SEARCH_VENDOR) {
- [$name] = explode('/', $name);
- }
- if (isset($matches[$name])) {
- continue;
- }
- if (null !== $type && $package->getType() !== $type) {
- continue;
- }
- if (Preg::isMatch($regex, $name)
- || ($mode === self::SEARCH_FULLTEXT && $package instanceof CompletePackageInterface && Preg::isMatch($regex, implode(' ', (array) $package->getKeywords()) . ' ' . $package->getDescription()))
- ) {
- if ($mode === self::SEARCH_VENDOR) {
- $matches[$name] = [
- 'name' => $name,
- 'description' => null,
- ];
- } else {
- $matches[$name] = [
- 'name' => $package->getPrettyName(),
- 'description' => $package instanceof CompletePackageInterface ? $package->getDescription() : null,
- ];
- if ($package instanceof CompletePackageInterface && $package->isAbandoned()) {
- $matches[$name]['abandoned'] = $package->getReplacementPackage() ?: true;
- }
- }
- }
- }
- return array_values($matches);
- }
- public function hasPackage(PackageInterface $package)
- {
- if ($this->packageMap === null) {
- $this->packageMap = [];
- foreach ($this->getPackages() as $repoPackage) {
- $this->packageMap[$repoPackage->getUniqueName()] = $repoPackage;
- }
- }
- return isset($this->packageMap[$package->getUniqueName()]);
- }
- public function addPackage(PackageInterface $package)
- {
- if (!$package instanceof BasePackage) {
- throw new \InvalidArgumentException('Only subclasses of BasePackage are supported');
- }
- if (null === $this->packages) {
- $this->initialize();
- }
- $package->setRepository($this);
- $this->packages[] = $package;
- if ($package instanceof AliasPackage) {
- $aliasedPackage = $package->getAliasOf();
- if (null === $aliasedPackage->getRepository()) {
- $this->addPackage($aliasedPackage);
- }
- }
- $this->packageMap = null;
- }
- public function getProviders(string $packageName)
- {
- $result = [];
- foreach ($this->getPackages() as $candidate) {
- if (isset($result[$candidate->getName()])) {
- continue;
- }
- foreach ($candidate->getProvides() as $link) {
- if ($packageName === $link->getTarget()) {
- $result[$candidate->getName()] = [
- 'name' => $candidate->getName(),
- 'description' => $candidate instanceof CompletePackageInterface ? $candidate->getDescription() : null,
- 'type' => $candidate->getType(),
- ];
- continue 2;
- }
- }
- }
- return $result;
- }
- protected function createAliasPackage(BasePackage $package, string $alias, string $prettyAlias)
- {
- while ($package instanceof AliasPackage) {
- $package = $package->getAliasOf();
- }
- if ($package instanceof CompletePackage) {
- return new CompleteAliasPackage($package, $alias, $prettyAlias);
- }
- return new AliasPackage($package, $alias, $prettyAlias);
- }
- public function removePackage(PackageInterface $package)
- {
- $packageId = $package->getUniqueName();
- foreach ($this->getPackages() as $key => $repoPackage) {
- if ($packageId === $repoPackage->getUniqueName()) {
- array_splice($this->packages, $key, 1);
- $this->packageMap = null;
- return;
- }
- }
- }
- public function getPackages()
- {
- if (null === $this->packages) {
- $this->initialize();
- }
- if (null === $this->packages) {
- throw new \LogicException('initialize failed to initialize the packages array');
- }
- return $this->packages;
- }
- public function count(): int
- {
- if (null === $this->packages) {
- $this->initialize();
- }
- return count($this->packages);
- }
- protected function initialize()
- {
- $this->packages = [];
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Repository;
- use Composer\IO\IOInterface;
- use Composer\Json\JsonFile;
- use Composer\Package\BasePackage;
- use Composer\Package\Loader\ArrayLoader;
- use Composer\Package\Loader\LoaderInterface;
- use Composer\Util\Tar;
- use Composer\Util\Zip;
- class ArtifactRepository extends ArrayRepository implements ConfigurableRepositoryInterface
- {
- protected $loader;
- protected $lookup;
- protected $repoConfig;
- private $io;
- public function __construct(array $repoConfig, IOInterface $io)
- {
- parent::__construct();
- if (!extension_loaded('zip')) {
- throw new \RuntimeException('The artifact repository requires PHP\'s zip extension');
- }
- $this->loader = new ArrayLoader();
- $this->lookup = $repoConfig['url'];
- $this->io = $io;
- $this->repoConfig = $repoConfig;
- }
- public function getRepoName()
- {
- return 'artifact repo ('.$this->lookup.')';
- }
- public function getRepoConfig()
- {
- return $this->repoConfig;
- }
- protected function initialize()
- {
- parent::initialize();
- $this->scanDirectory($this->lookup);
- }
- private function scanDirectory(string $path): void
- {
- $io = $this->io;
- $directory = new \RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::FOLLOW_SYMLINKS);
- $iterator = new \RecursiveIteratorIterator($directory);
- $regex = new \RegexIterator($iterator, '/^.+\.(zip|tar|gz|tgz)$/i');
- foreach ($regex as $file) {
- if (!$file->isFile()) {
- continue;
- }
- $package = $this->getComposerInformation($file);
- if (!$package) {
- $io->writeError("File <comment>{$file->getBasename()}</comment> doesn't seem to hold a package", true, IOInterface::VERBOSE);
- continue;
- }
- $template = 'Found package <info>%s</info> (<comment>%s</comment>) in file <info>%s</info>';
- $io->writeError(sprintf($template, $package->getName(), $package->getPrettyVersion(), $file->getBasename()), true, IOInterface::VERBOSE);
- $this->addPackage($package);
- }
- }
- private function getComposerInformation(\SplFileInfo $file): ?BasePackage
- {
- $json = null;
- $fileType = null;
- $fileExtension = pathinfo($file->getPathname(), PATHINFO_EXTENSION);
- if (in_array($fileExtension, ['gz', 'tar', 'tgz'], true)) {
- $fileType = 'tar';
- } elseif ($fileExtension === 'zip') {
- $fileType = 'zip';
- } else {
- throw new \RuntimeException('Files with "'.$fileExtension.'" extensions aren\'t supported. Only ZIP and TAR/TAR.GZ/TGZ archives are supported.');
- }
- try {
- if ($fileType === 'tar') {
- $json = Tar::getComposerJson($file->getPathname());
- } else {
- $json = Zip::getComposerJson($file->getPathname());
- }
- } catch (\Exception $exception) {
- $this->io->write('Failed loading package '.$file->getPathname().': '.$exception->getMessage(), false, IOInterface::VERBOSE);
- }
- if (null === $json) {
- return null;
- }
- $package = JsonFile::parseJson($json, $file->getPathname().'#composer.json');
- $package['dist'] = [
- 'type' => $fileType,
- 'url' => strtr($file->getPathname(), '\\', '/'),
- 'shasum' => sha1_file($file->getRealPath()),
- ];
- try {
- $package = $this->loader->load($package);
- } catch (\UnexpectedValueException $e) {
- throw new \UnexpectedValueException('Failed loading package in '.$file.': '.$e->getMessage(), 0, $e);
- }
- return $package;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Repository;
- use Composer\Package\AliasPackage;
- use Composer\Package\PackageInterface;
- trait CanonicalPackagesTrait
- {
- public function getCanonicalPackages()
- {
- $packages = $this->getPackages();
- $packagesByName = [];
- foreach ($packages as $package) {
- if (!isset($packagesByName[$package->getName()]) || $packagesByName[$package->getName()] instanceof AliasPackage) {
- $packagesByName[$package->getName()] = $package;
- }
- }
- $canonicalPackages = [];
- foreach ($packagesByName as $package) {
- while ($package instanceof AliasPackage) {
- $package = $package->getAliasOf();
- }
- $canonicalPackages[] = $package;
- }
- return $canonicalPackages;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Repository;
- use Composer\Advisory\PartialSecurityAdvisory;
- use Composer\Advisory\SecurityAdvisory;
- use Composer\Package\BasePackage;
- use Composer\Package\Loader\ArrayLoader;
- use Composer\Package\PackageInterface;
- use Composer\Package\AliasPackage;
- use Composer\Package\CompletePackage;
- use Composer\Package\CompleteAliasPackage;
- use Composer\Package\Version\VersionParser;
- use Composer\Package\Version\StabilityFilter;
- use Composer\Json\JsonFile;
- use Composer\Cache;
- use Composer\Config;
- use Composer\IO\IOInterface;
- use Composer\Pcre\Preg;
- use Composer\Plugin\PostFileDownloadEvent;
- use Composer\Semver\CompilingMatcher;
- use Composer\Util\HttpDownloader;
- use Composer\Util\Loop;
- use Composer\Plugin\PluginEvents;
- use Composer\Plugin\PreFileDownloadEvent;
- use Composer\EventDispatcher\EventDispatcher;
- use Composer\Downloader\TransportException;
- use Composer\Semver\Constraint\ConstraintInterface;
- use Composer\Semver\Constraint\Constraint;
- use Composer\Semver\Constraint\MatchAllConstraint;
- use Composer\Util\Http\Response;
- use Composer\MetadataMinifier\MetadataMinifier;
- use Composer\Util\Url;
- use React\Promise\PromiseInterface;
- class ComposerRepository extends ArrayRepository implements ConfigurableRepositoryInterface, AdvisoryProviderInterface
- {
- private $repoConfig;
- private $options;
- private $url;
- private $baseUrl;
- private $io;
- private $httpDownloader;
- private $loop;
- protected $cache;
- protected $notifyUrl = null;
- protected $searchUrl = null;
- protected $providersApiUrl = null;
- protected $hasProviders = false;
- protected $providersUrl = null;
- protected $listUrl = null;
- protected $hasAvailablePackageList = false;
- protected $availablePackages = null;
- protected $availablePackagePatterns = null;
- protected $lazyProvidersUrl = null;
- protected $providerListing;
- protected $loader;
- private $allowSslDowngrade = false;
- private $eventDispatcher;
- private $sourceMirrors;
- private $distMirrors;
- private $degradedMode = false;
- private $rootData;
- private $hasPartialPackages = false;
- private $partialPackagesByName = null;
- private $displayedWarningAboutNonMatchingPackageIndex = false;
- private $securityAdvisoryConfig = null;
- private $freshMetadataUrls = [];
- private $packagesNotFoundCache = [];
- private $versionParser;
- public function __construct(array $repoConfig, IOInterface $io, Config $config, HttpDownloader $httpDownloader, ?EventDispatcher $eventDispatcher = null)
- {
- parent::__construct();
- if (!Preg::isMatch('{^[\w.]+\??://}', $repoConfig['url'])) {
- $repoConfig['url'] = 'http://'.$repoConfig['url'];
- }
- $repoConfig['url'] = rtrim($repoConfig['url'], '/');
- if (strpos($repoConfig['url'], 'https?') === 0) {
- $repoConfig['url'] = (extension_loaded('openssl') ? 'https' : 'http') . substr($repoConfig['url'], 6);
- }
- $urlBits = parse_url(strtr($repoConfig['url'], '\\', '/'));
- if ($urlBits === false || empty($urlBits['scheme'])) {
- throw new \UnexpectedValueException('Invalid url given for Composer repository: '.$repoConfig['url']);
- }
- if (!isset($repoConfig['options'])) {
- $repoConfig['options'] = [];
- }
- if (isset($repoConfig['allow_ssl_downgrade']) && true === $repoConfig['allow_ssl_downgrade']) {
- $this->allowSslDowngrade = true;
- }
- $this->options = $repoConfig['options'];
- $this->url = $repoConfig['url'];
- if (Preg::isMatch('{^(?P<proto>https?)://packagist\.org/?$}i', $this->url, $match)) {
- $this->url = $match['proto'].'://repo.packagist.org';
- }
- $this->baseUrl = rtrim(Preg::replace('{(?:/[^/\\\\]+\.json)?(?:[?#].*)?$}', '', $this->url), '/');
- $this->io = $io;
- $this->cache = new Cache($io, $config->get('cache-repo-dir').'/'.Preg::replace('{[^a-z0-9.]}i', '-', Url::sanitize($this->url)), 'a-z0-9.$~');
- $this->cache->setReadOnly($config->get('cache-read-only'));
- $this->versionParser = new VersionParser();
- $this->loader = new ArrayLoader($this->versionParser);
- $this->httpDownloader = $httpDownloader;
- $this->eventDispatcher = $eventDispatcher;
- $this->repoConfig = $repoConfig;
- $this->loop = new Loop($this->httpDownloader);
- }
- public function getRepoName()
- {
- return 'composer repo ('.Url::sanitize($this->url).')';
- }
- public function getRepoConfig()
- {
- return $this->repoConfig;
- }
- public function findPackage(string $name, $constraint)
- {
- $hasProviders = $this->hasProviders();
- $name = strtolower($name);
- if (!$constraint instanceof ConstraintInterface) {
- $constraint = $this->versionParser->parseConstraints($constraint);
- }
- if ($this->lazyProvidersUrl) {
- if ($this->hasPartialPackages() && isset($this->partialPackagesByName[$name])) {
- return $this->filterPackages($this->whatProvides($name), $constraint, true);
- }
- if ($this->hasAvailablePackageList && !$this->lazyProvidersRepoContains($name)) {
- return null;
- }
- $packages = $this->loadAsyncPackages([$name => $constraint]);
- if (count($packages['packages']) > 0) {
- return reset($packages['packages']);
- }
- return null;
- }
- if ($hasProviders) {
- foreach ($this->getProviderNames() as $providerName) {
- if ($name === $providerName) {
- return $this->filterPackages($this->whatProvides($providerName), $constraint, true);
- }
- }
- return null;
- }
- return parent::findPackage($name, $constraint);
- }
- public function findPackages(string $name, $constraint = null)
- {
- $hasProviders = $this->hasProviders();
- $name = strtolower($name);
- if (null !== $constraint && !$constraint instanceof ConstraintInterface) {
- $constraint = $this->versionParser->parseConstraints($constraint);
- }
- if ($this->lazyProvidersUrl) {
- if ($this->hasPartialPackages() && isset($this->partialPackagesByName[$name])) {
- return $this->filterPackages($this->whatProvides($name), $constraint);
- }
- if ($this->hasAvailablePackageList && !$this->lazyProvidersRepoContains($name)) {
- return [];
- }
- $result = $this->loadAsyncPackages([$name => $constraint]);
- return $result['packages'];
- }
- if ($hasProviders) {
- foreach ($this->getProviderNames() as $providerName) {
- if ($name === $providerName) {
- return $this->filterPackages($this->whatProvides($providerName), $constraint);
- }
- }
- return [];
- }
- return parent::findPackages($name, $constraint);
- }
- private function filterPackages(array $packages, ?ConstraintInterface $constraint = null, bool $returnFirstMatch = false)
- {
- if (null === $constraint) {
- if ($returnFirstMatch) {
- return reset($packages);
- }
- return $packages;
- }
- $filteredPackages = [];
- foreach ($packages as $package) {
- $pkgConstraint = new Constraint('==', $package->getVersion());
- if ($constraint->matches($pkgConstraint)) {
- if ($returnFirstMatch) {
- return $package;
- }
- $filteredPackages[] = $package;
- }
- }
- if ($returnFirstMatch) {
- return null;
- }
- return $filteredPackages;
- }
- public function getPackages()
- {
- $hasProviders = $this->hasProviders();
- if ($this->lazyProvidersUrl) {
- if (is_array($this->availablePackages) && !$this->availablePackagePatterns) {
- $packageMap = [];
- foreach ($this->availablePackages as $name) {
- $packageMap[$name] = new MatchAllConstraint();
- }
- $result = $this->loadAsyncPackages($packageMap);
- return array_values($result['packages']);
- }
- if ($this->hasPartialPackages()) {
- if (!is_array($this->partialPackagesByName)) {
- throw new \LogicException('hasPartialPackages failed to initialize $this->partialPackagesByName');
- }
- return $this->createPackages($this->partialPackagesByName, 'packages.json inline packages');
- }
- 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.');
- }
- if ($hasProviders) {
- throw new \LogicException('Composer repositories that have providers can not load the complete list of packages, use getPackageNames instead.');
- }
- return parent::getPackages();
- }
- public function getPackageNames(?string $packageFilter = null)
- {
- $hasProviders = $this->hasProviders();
- $filterResults =
- static function (array $results): array {
- return $results;
- }
- ;
- if (null !== $packageFilter && '' !== $packageFilter) {
- $packageFilterRegex = BasePackage::packageNameToRegexp($packageFilter);
- $filterResults =
- static function (array $results) use ($packageFilterRegex): array {
- return Preg::grep($packageFilterRegex, $results);
- }
- ;
- }
- if ($this->lazyProvidersUrl) {
- if (is_array($this->availablePackages)) {
- return $filterResults(array_keys($this->availablePackages));
- }
- if ($this->listUrl) {
- return $this->loadPackageList($packageFilter);
- }
- if ($this->hasPartialPackages() && $this->partialPackagesByName !== null) {
- return $filterResults(array_keys($this->partialPackagesByName));
- }
- return [];
- }
- if ($hasProviders) {
- return $filterResults($this->getProviderNames());
- }
- $names = [];
- foreach ($this->getPackages() as $package) {
- $names[] = $package->getPrettyName();
- }
- return $filterResults($names);
- }
- private function getVendorNames(): array
- {
- $cacheKey = 'vendor-list.txt';
- $cacheAge = $this->cache->getAge($cacheKey);
- if (false !== $cacheAge && $cacheAge < 600 && ($cachedData = $this->cache->read($cacheKey)) !== false) {
- $cachedData = explode("\n", $cachedData);
- return $cachedData;
- }
- $names = $this->getPackageNames();
- $uniques = [];
- foreach ($names as $name) {
- $uniques[substr($name, 0, strpos($name, '/'))] = true;
- }
- $vendors = array_keys($uniques);
- if (!$this->cache->isReadOnly()) {
- $this->cache->write($cacheKey, implode("\n", $vendors));
- }
- return $vendors;
- }
- private function loadPackageList(?string $packageFilter = null): array
- {
- if (null === $this->listUrl) {
- throw new \LogicException('Make sure to call loadRootServerFile before loadPackageList');
- }
- $url = $this->listUrl;
- if (is_string($packageFilter) && $packageFilter !== '') {
- $url .= '?filter='.urlencode($packageFilter);
- $result = $this->httpDownloader->get($url, $this->options)->decodeJson();
- return $result['packageNames'];
- }
- $cacheKey = 'package-list.txt';
- $cacheAge = $this->cache->getAge($cacheKey);
- if (false !== $cacheAge && $cacheAge < 600 && ($cachedData = $this->cache->read($cacheKey)) !== false) {
- $cachedData = explode("\n", $cachedData);
- return $cachedData;
- }
- $result = $this->httpDownloader->get($url, $this->options)->decodeJson();
- if (!$this->cache->isReadOnly()) {
- $this->cache->write($cacheKey, implode("\n", $result['packageNames']));
- }
- return $result['packageNames'];
- }
- public function loadPackages(array $packageNameMap, array $acceptableStabilities, array $stabilityFlags, array $alreadyLoaded = [])
- {
- $hasProviders = $this->hasProviders();
- if (!$hasProviders && !$this->hasPartialPackages() && null === $this->lazyProvidersUrl) {
- return parent::loadPackages($packageNameMap, $acceptableStabilities, $stabilityFlags, $alreadyLoaded);
- }
- $packages = [];
- $namesFound = [];
- if ($hasProviders || $this->hasPartialPackages()) {
- foreach ($packageNameMap as $name => $constraint) {
- $matches = [];
- if (!$hasProviders && !isset($this->partialPackagesByName[$name])) {
- continue;
- }
- $candidates = $this->whatProvides($name, $acceptableStabilities, $stabilityFlags, $alreadyLoaded);
- foreach ($candidates as $candidate) {
- if ($candidate->getName() !== $name) {
- throw new \LogicException('whatProvides should never return a package with a different name than the requested one');
- }
- $namesFound[$name] = true;
- if (!$constraint || $constraint->matches(new Constraint('==', $candidate->getVersion()))) {
- $matches[spl_object_hash($candidate)] = $candidate;
- if ($candidate instanceof AliasPackage && !isset($matches[spl_object_hash($candidate->getAliasOf())])) {
- $matches[spl_object_hash($candidate->getAliasOf())] = $candidate->getAliasOf();
- }
- }
- }
- foreach ($candidates as $candidate) {
- if ($candidate instanceof AliasPackage) {
- if (isset($matches[spl_object_hash($candidate->getAliasOf())])) {
- $matches[spl_object_hash($candidate)] = $candidate;
- }
- }
- }
- $packages = array_merge($packages, $matches);
- unset($packageNameMap[$name]);
- }
- }
- if ($this->lazyProvidersUrl && count($packageNameMap)) {
- if ($this->hasAvailablePackageList) {
- foreach ($packageNameMap as $name => $constraint) {
- if (!$this->lazyProvidersRepoContains(strtolower($name))) {
- unset($packageNameMap[$name]);
- }
- }
- }
- $result = $this->loadAsyncPackages($packageNameMap, $acceptableStabilities, $stabilityFlags, $alreadyLoaded);
- $packages = array_merge($packages, $result['packages']);
- $namesFound = array_merge($namesFound, $result['namesFound']);
- }
- return ['namesFound' => array_keys($namesFound), 'packages' => $packages];
- }
- public function search(string $query, int $mode = 0, ?string $type = null)
- {
- $this->loadRootServerFile(600);
- if ($this->searchUrl && $mode === self::SEARCH_FULLTEXT) {
- $url = str_replace(['%query%', '%type%'], [urlencode($query), $type], $this->searchUrl);
- $search = $this->httpDownloader->get($url, $this->options)->decodeJson();
- if (empty($search['results'])) {
- return [];
- }
- $results = [];
- foreach ($search['results'] as $result) {
- if (!empty($result['virtual'])) {
- continue;
- }
- $results[] = $result;
- }
- return $results;
- }
- if ($mode === self::SEARCH_VENDOR) {
- $results = [];
- $regex = '{(?:'.implode('|', Preg::split('{\s+}', $query)).')}i';
- $vendorNames = $this->getVendorNames();
- foreach (Preg::grep($regex, $vendorNames) as $name) {
- $results[] = ['name' => $name, 'description' => ''];
- }
- return $results;
- }
- if ($this->hasProviders() || $this->lazyProvidersUrl) {
- if (Preg::isMatch('{^\^(?P<query>(?P<vendor>[a-z0-9_.-]+)/[a-z0-9_.-]*)\*?$}i', $query, $match) && $this->listUrl !== null) {
- $url = $this->listUrl . '?vendor='.urlencode($match['vendor']).'&filter='.urlencode($match['query'].'*');
- $result = $this->httpDownloader->get($url, $this->options)->decodeJson();
- $results = [];
- foreach ($result['packageNames'] as $name) {
- $results[] = ['name' => $name, 'description' => ''];
- }
- return $results;
- }
- $results = [];
- $regex = '{(?:'.implode('|', Preg::split('{\s+}', $query)).')}i';
- $packageNames = $this->getPackageNames();
- foreach (Preg::grep($regex, $packageNames) as $name) {
- $results[] = ['name' => $name, 'description' => ''];
- }
- return $results;
- }
- return parent::search($query, $mode);
- }
- public function hasSecurityAdvisories(): bool
- {
- $this->loadRootServerFile(600);
- return $this->securityAdvisoryConfig !== null && ($this->securityAdvisoryConfig['metadata'] || $this->securityAdvisoryConfig['api-url'] !== null);
- }
- public function getSecurityAdvisories(array $packageConstraintMap, bool $allowPartialAdvisories = false): array
- {
- $this->loadRootServerFile(600);
- if (null === $this->securityAdvisoryConfig) {
- return ['namesFound' => [], 'advisories' => []];
- }
- $advisories = [];
- $namesFound = [];
- $apiUrl = $this->securityAdvisoryConfig['api-url'];
- $parser = new VersionParser();
- $create = function (array $data, string $name) use ($parser, $allowPartialAdvisories, &$packageConstraintMap): ?PartialSecurityAdvisory {
- $advisory = PartialSecurityAdvisory::create($name, $data, $parser);
- if (!$allowPartialAdvisories && !$advisory instanceof SecurityAdvisory) {
- throw new \RuntimeException('Advisory for '.$name.' could not be loaded as a full advisory from '.$this->getRepoName() . PHP_EOL . var_export($data, true));
- }
- if (!$advisory->affectedVersions->matches($packageConstraintMap[$name])) {
- return null;
- }
- return $advisory;
- };
- if ($this->securityAdvisoryConfig['metadata'] && ($allowPartialAdvisories || $apiUrl === null)) {
- $promises = [];
- foreach ($packageConstraintMap as $name => $constraint) {
- $name = strtolower($name);
- if (PlatformRepository::isPlatformPackage($name) || '__root__' === $name) {
- continue;
- }
- $promises[] = $this->startCachedAsyncDownload($name, $name)
- ->then(static function (array $spec) use (&$advisories, &$namesFound, &$packageConstraintMap, $name, $create): void {
- [$response, ] = $spec;
- if (!isset($response['security-advisories']) || !is_array($response['security-advisories'])) {
- return;
- }
- $namesFound[$name] = true;
- if (count($response['security-advisories']) > 0) {
- $advisories[$name] = array_filter(array_map(
- static function ($data) use ($name, $create) {
- return $create($data, $name);
- },
- $response['security-advisories']
- ));
- }
- unset($packageConstraintMap[$name]);
- });
- }
- $this->loop->wait($promises);
- }
- if ($apiUrl !== null && count($packageConstraintMap) > 0) {
- $options = [
- 'http' => [
- 'method' => 'POST',
- 'header' => ['Content-type: application/x-www-form-urlencoded'],
- 'timeout' => 10,
- 'content' => http_build_query(['packages' => array_keys($packageConstraintMap)]),
- ],
- ];
- $response = $this->httpDownloader->get($apiUrl, $options);
- foreach ($response->decodeJson()['advisories'] as $name => $list) {
- if (count($list) > 0) {
- $advisories[$name] = array_filter(array_map(
- static function ($data) use ($name, $create) {
- return $create($data, $name);
- },
- $list
- ));
- }
- $namesFound[$name] = true;
- }
- }
- return ['namesFound' => array_keys($namesFound), 'advisories' => array_filter($advisories)];
- }
- public function getProviders(string $packageName)
- {
- $this->loadRootServerFile();
- $result = [];
- if ($this->providersApiUrl) {
- try {
- $apiResult = $this->httpDownloader->get(str_replace('%package%', $packageName, $this->providersApiUrl), $this->options)->decodeJson();
- } catch (TransportException $e) {
- if ($e->getStatusCode() === 404) {
- return $result;
- }
- throw $e;
- }
- foreach ($apiResult['providers'] as $provider) {
- $result[$provider['name']] = $provider;
- }
- return $result;
- }
- if ($this->hasPartialPackages()) {
- if (!is_array($this->partialPackagesByName)) {
- throw new \LogicException('hasPartialPackages failed to initialize $this->partialPackagesByName');
- }
- foreach ($this->partialPackagesByName as $versions) {
- foreach ($versions as $candidate) {
- if (isset($result[$candidate['name']]) || !isset($candidate['provide'][$packageName])) {
- continue;
- }
- $result[$candidate['name']] = [
- 'name' => $candidate['name'],
- 'description' => $candidate['description'] ?? '',
- 'type' => $candidate['type'] ?? '',
- ];
- }
- }
- }
- if ($this->packages) {
- $result = array_merge($result, parent::getProviders($packageName));
- }
- return $result;
- }
- private function getProviderNames(): array
- {
- $this->loadRootServerFile();
- if (null === $this->providerListing) {
- $data = $this->loadRootServerFile();
- if (is_array($data)) {
- $this->loadProviderListings($data);
- }
- }
- if ($this->lazyProvidersUrl) {
- return [];
- }
- if (null !== $this->providersUrl && null !== $this->providerListing) {
- return array_keys($this->providerListing);
- }
- return [];
- }
- protected function configurePackageTransportOptions(PackageInterface $package): void
- {
- foreach ($package->getDistUrls() as $url) {
- if (strpos($url, $this->baseUrl) === 0) {
- $package->setTransportOptions($this->options);
- return;
- }
- }
- }
- private function hasProviders(): bool
- {
- $this->loadRootServerFile();
- return $this->hasProviders;
- }
- private function whatProvides(string $name, ?array $acceptableStabilities = null, ?array $stabilityFlags = null, array $alreadyLoaded = []): array
- {
- $packagesSource = null;
- if (!$this->hasPartialPackages() || !isset($this->partialPackagesByName[$name])) {
- if (PlatformRepository::isPlatformPackage($name) || '__root__' === $name) {
- return [];
- }
- if (null === $this->providerListing) {
- $data = $this->loadRootServerFile();
- if (is_array($data)) {
- $this->loadProviderListings($data);
- }
- }
- $useLastModifiedCheck = false;
- if ($this->lazyProvidersUrl && !isset($this->providerListing[$name])) {
- $hash = null;
- $url = str_replace('%package%', $name, $this->lazyProvidersUrl);
- $cacheKey = 'provider-'.strtr($name, '/', '$').'.json';
- $useLastModifiedCheck = true;
- } elseif ($this->providersUrl) {
- if (!isset($this->providerListing[$name])) {
- return [];
- }
- $hash = $this->providerListing[$name]['sha256'];
- $url = str_replace(['%package%', '%hash%'], [$name, $hash], $this->providersUrl);
- $cacheKey = 'provider-'.strtr($name, '/', '$').'.json';
- } else {
- return [];
- }
- $packages = null;
- if (!$useLastModifiedCheck && $hash && $this->cache->sha256($cacheKey) === $hash) {
- $packages = json_decode($this->cache->read($cacheKey), true);
- $packagesSource = 'cached file ('.$cacheKey.' originating from '.Url::sanitize($url).')';
- } elseif ($useLastModifiedCheck) {
- if ($contents = $this->cache->read($cacheKey)) {
- $contents = json_decode($contents, true);
- if (isset($alreadyLoaded[$name])) {
- $packages = $contents;
- $packagesSource = 'cached file ('.$cacheKey.' originating from '.Url::sanitize($url).')';
- } elseif (isset($contents['last-modified'])) {
- $response = $this->fetchFileIfLastModified($url, $cacheKey, $contents['last-modified']);
- $packages = true === $response ? $contents : $response;
- $packagesSource = true === $response ? 'cached file ('.$cacheKey.' originating from '.Url::sanitize($url).')' : 'downloaded file ('.Url::sanitize($url).')';
- }
- }
- }
- if (!$packages) {
- try {
- $packages = $this->fetchFile($url, $cacheKey, $hash, $useLastModifiedCheck);
- $packagesSource = 'downloaded file ('.Url::sanitize($url).')';
- } catch (TransportException $e) {
- if ($this->lazyProvidersUrl && in_array($e->getStatusCode(), [404, 499], true)) {
- $packages = ['packages' => []];
- $packagesSource = 'not-found file ('.Url::sanitize($url).')';
- if ($e->getStatusCode() === 499) {
- $this->io->error('<warning>' . $e->getMessage() . '</warning>');
- }
- } else {
- throw $e;
- }
- }
- }
- $loadingPartialPackage = false;
- } else {
- $packages = ['packages' => ['versions' => $this->partialPackagesByName[$name]]];
- $packagesSource = 'root file ('.Url::sanitize($this->getPackagesJsonUrl()).')';
- $loadingPartialPackage = true;
- }
- $result = [];
- $versionsToLoad = [];
- foreach ($packages['packages'] as $versions) {
- foreach ($versions as $version) {
- $normalizedName = strtolower($version['name']);
- if ($normalizedName !== $name) {
- continue;
- }
- if (!$loadingPartialPackage && $this->hasPartialPackages() && isset($this->partialPackagesByName[$normalizedName])) {
- continue;
- }
- if (!isset($versionsToLoad[$version['uid']])) {
- if (!isset($version['version_normalized'])) {
- $version['version_normalized'] = $this->versionParser->normalize($version['version']);
- } elseif ($version['version_normalized'] === VersionParser::DEFAULT_BRANCH_ALIAS) {
- $version['version_normalized'] = $this->versionParser->normalize($version['version']);
- }
- if (isset($alreadyLoaded[$name][$version['version_normalized']])) {
- continue;
- }
- if ($this->isVersionAcceptable(null, $normalizedName, $version, $acceptableStabilities, $stabilityFlags)) {
- $versionsToLoad[$version['uid']] = $version;
- }
- }
- }
- }
- $loadedPackages = $this->createPackages($versionsToLoad, $packagesSource);
- $uids = array_keys($versionsToLoad);
- foreach ($loadedPackages as $index => $package) {
- $package->setRepository($this);
- $uid = $uids[$index];
- if ($package instanceof AliasPackage) {
- $aliased = $package->getAliasOf();
- $aliased->setRepository($this);
- $result[$uid] = $aliased;
- $result[$uid.'-alias'] = $package;
- } else {
- $result[$uid] = $package;
- }
- }
- return $result;
- }
- protected function initialize()
- {
- parent::initialize();
- $repoData = $this->loadDataFromServer();
- foreach ($this->createPackages($repoData, 'root file ('.Url::sanitize($this->getPackagesJsonUrl()).')') as $package) {
- $this->addPackage($package);
- }
- }
- public function addPackage(PackageInterface $package)
- {
- parent::addPackage($package);
- $this->configurePackageTransportOptions($package);
- }
- private function loadAsyncPackages(array $packageNames, ?array $acceptableStabilities = null, ?array $stabilityFlags = null, array $alreadyLoaded = []): array
- {
- $this->loadRootServerFile();
- $packages = [];
- $namesFound = [];
- $promises = [];
- if (null === $this->lazyProvidersUrl) {
- throw new \LogicException('loadAsyncPackages only supports v2 protocol composer repos with a metadata-url');
- }
- foreach ($packageNames as $name => $constraint) {
- if ($acceptableStabilities === null || $stabilityFlags === null || StabilityFilter::isPackageAcceptable($acceptableStabilities, $stabilityFlags, [$name], 'dev')) {
- $packageNames[$name.'~dev'] = $constraint;
- }
- if (isset($acceptableStabilities['dev']) && count($acceptableStabilities) === 1 && count($stabilityFlags) === 0) {
- unset($packageNames[$name]);
- }
- }
- foreach ($packageNames as $name => $constraint) {
- $name = strtolower($name);
- $realName = Preg::replace('{~dev$}', '', $name);
- if (PlatformRepository::isPlatformPackage($realName) || '__root__' === $realName) {
- continue;
- }
- $promises[] = $this->startCachedAsyncDownload($name, $realName)
- ->then(function (array $spec) use (&$packages, &$namesFound, $realName, $constraint, $acceptableStabilities, $stabilityFlags, $alreadyLoaded): void {
- [$response, $packagesSource] = $spec;
- if (null === $response) {
- return;
- }
- $versions = $response['packages'][$realName];
- if (isset($response['minified']) && $response['minified'] === 'composer/2.0') {
- $versions = MetadataMinifier::expand($versions);
- }
- $namesFound[$realName] = true;
- $versionsToLoad = [];
- foreach ($versions as $version) {
- if (!isset($version['version_normalized'])) {
- $version['version_normalized'] = $this->versionParser->normalize($version['version']);
- } elseif ($version['version_normalized'] === VersionParser::DEFAULT_BRANCH_ALIAS) {
- $version['version_normalized'] = $this->versionParser->normalize($version['version']);
- }
- if (isset($alreadyLoaded[$realName][$version['version_normalized']])) {
- continue;
- }
- if ($this->isVersionAcceptable($constraint, $realName, $version, $acceptableStabilities, $stabilityFlags)) {
- $versionsToLoad[] = $version;
- }
- }
- $loadedPackages = $this->createPackages($versionsToLoad, $packagesSource);
- foreach ($loadedPackages as $package) {
- $package->setRepository($this);
- $packages[spl_object_hash($package)] = $package;
- if ($package instanceof AliasPackage && !isset($packages[spl_object_hash($package->getAliasOf())])) {
- $package->getAliasOf()->setRepository($this);
- $packages[spl_object_hash($package->getAliasOf())] = $package->getAliasOf();
- }
- }
- });
- }
- $this->loop->wait($promises);
- return ['namesFound' => $namesFound, 'packages' => $packages];
- }
- private function startCachedAsyncDownload(string $fileName, ?string $packageName = null): PromiseInterface
- {
- if (null === $this->lazyProvidersUrl) {
- throw new \LogicException('startCachedAsyncDownload only supports v2 protocol composer repos with a metadata-url');
- }
- $name = strtolower($fileName);
- $packageName = $packageName ?? $name;
- $url = str_replace('%package%', $name, $this->lazyProvidersUrl);
- $cacheKey = 'provider-'.strtr($name, '/', '~').'.json';
- $lastModified = null;
- if ($contents = $this->cache->read($cacheKey)) {
- $contents = json_decode($contents, true);
- $lastModified = $contents['last-modified'] ?? null;
- }
- return $this->asyncFetchFile($url, $cacheKey, $lastModified)
- ->then(static function ($response) use ($url, $cacheKey, $contents, $packageName): array {
- $packagesSource = 'downloaded file ('.Url::sanitize($url).')';
- if (true === $response) {
- $packagesSource = 'cached file ('.$cacheKey.' originating from '.Url::sanitize($url).')';
- $response = $contents;
- }
- if (!isset($response['packages'][$packageName])) {
- return [null, $packagesSource];
- }
- return [$response, $packagesSource];
- });
- }
- private function isVersionAcceptable(?ConstraintInterface $constraint, string $name, array $versionData, ?array $acceptableStabilities = null, ?array $stabilityFlags = null): bool
- {
- $versions = [$versionData['version_normalized']];
- if ($alias = $this->loader->getBranchAlias($versionData)) {
- $versions[] = $alias;
- }
- foreach ($versions as $version) {
- if (null !== $acceptableStabilities && null !== $stabilityFlags && !StabilityFilter::isPackageAcceptable($acceptableStabilities, $stabilityFlags, [$name], VersionParser::parseStability($version))) {
- continue;
- }
- if ($constraint && !CompilingMatcher::match($constraint, Constraint::OP_EQ, $version)) {
- continue;
- }
- return true;
- }
- return false;
- }
- private function getPackagesJsonUrl(): string
- {
- $jsonUrlParts = parse_url(strtr($this->url, '\\', '/'));
- if (isset($jsonUrlParts['path']) && false !== strpos($jsonUrlParts['path'], '.json')) {
- return $this->url;
- }
- return $this->url . '/packages.json';
- }
- protected function loadRootServerFile(?int $rootMaxAge = null)
- {
- if (null !== $this->rootData) {
- return $this->rootData;
- }
- if (!extension_loaded('openssl') && strpos($this->url, 'https') === 0) {
- throw new \RuntimeException('You must enable the openssl extension in your php.ini to load information from '.$this->url);
- }
- if ($cachedData = $this->cache->read('packages.json')) {
- $cachedData = json_decode($cachedData, true);
- if ($rootMaxAge !== null && ($age = $this->cache->getAge('packages.json')) !== false && $age <= $rootMaxAge) {
- $data = $cachedData;
- } elseif (isset($cachedData['last-modified'])) {
- $response = $this->fetchFileIfLastModified($this->getPackagesJsonUrl(), 'packages.json', $cachedData['last-modified']);
- $data = true === $response ? $cachedData : $response;
- }
- }
- if (!isset($data)) {
- $data = $this->fetchFile($this->getPackagesJsonUrl(), 'packages.json', null, true);
- }
- if (!empty($data['notify-batch'])) {
- $this->notifyUrl = $this->canonicalizeUrl($data['notify-batch']);
- } elseif (!empty($data['notify'])) {
- $this->notifyUrl = $this->canonicalizeUrl($data['notify']);
- }
- if (!empty($data['search'])) {
- $this->searchUrl = $this->canonicalizeUrl($data['search']);
- }
- if (!empty($data['mirrors'])) {
- foreach ($data['mirrors'] as $mirror) {
- if (!empty($mirror['git-url'])) {
- $this->sourceMirrors['git'][] = ['url' => $mirror['git-url'], 'preferred' => !empty($mirror['preferred'])];
- }
- if (!empty($mirror['hg-url'])) {
- $this->sourceMirrors['hg'][] = ['url' => $mirror['hg-url'], 'preferred' => !empty($mirror['preferred'])];
- }
- if (!empty($mirror['dist-url'])) {
- $this->distMirrors[] = [
- 'url' => $this->canonicalizeUrl($mirror['dist-url']),
- 'preferred' => !empty($mirror['preferred']),
- ];
- }
- }
- }
- if (!empty($data['providers-lazy-url'])) {
- $this->lazyProvidersUrl = $this->canonicalizeUrl($data['providers-lazy-url']);
- $this->hasProviders = true;
- $this->hasPartialPackages = !empty($data['packages']) && is_array($data['packages']);
- }
- if (!empty($data['metadata-url'])) {
- $this->lazyProvidersUrl = $this->canonicalizeUrl($data['metadata-url']);
- $this->providersUrl = null;
- $this->hasProviders = false;
- $this->hasPartialPackages = !empty($data['packages']) && is_array($data['packages']);
- $this->allowSslDowngrade = false;
- if (!empty($data['available-packages'])) {
- $availPackages = array_map('strtolower', $data['available-packages']);
- $this->availablePackages = array_combine($availPackages, $availPackages);
- $this->hasAvailablePackageList = true;
- }
- if (!empty($data['available-package-patterns'])) {
- $this->availablePackagePatterns = array_map(static function ($pattern): string {
- return BasePackage::packageNameToRegexp($pattern);
- }, $data['available-package-patterns']);
- $this->hasAvailablePackageList = true;
- }
- unset($data['providers-url'], $data['providers'], $data['providers-includes']);
- if (isset($data['security-advisories']) && is_array($data['security-advisories'])) {
- $this->securityAdvisoryConfig = [
- 'metadata' => $data['security-advisories']['metadata'] ?? false,
- 'api-url' => $data['security-advisories']['api-url'] ?? null,
- 'query-all' => $data['security-advisories']['query-all'] ?? false,
- ];
- }
- }
- if ($this->allowSslDowngrade) {
- $this->url = str_replace('https://', 'http://', $this->url);
- $this->baseUrl = str_replace('https://', 'http://', $this->baseUrl);
- }
- if (!empty($data['providers-url'])) {
- $this->providersUrl = $this->canonicalizeUrl($data['providers-url']);
- $this->hasProviders = true;
- }
- if (!empty($data['list'])) {
- $this->listUrl = $this->canonicalizeUrl($data['list']);
- }
- if (!empty($data['providers']) || !empty($data['providers-includes'])) {
- $this->hasProviders = true;
- }
- if (!empty($data['providers-api'])) {
- $this->providersApiUrl = $this->canonicalizeUrl($data['providers-api']);
- }
- return $this->rootData = $data;
- }
- private function canonicalizeUrl(string $url): string
- {
- if ('/' === $url[0]) {
- if (Preg::isMatch('{^[^:]++://[^/]*+}', $this->url, $matches)) {
- return $matches[0] . $url;
- }
- return $this->url;
- }
- return $url;
- }
- private function loadDataFromServer(): array
- {
- $data = $this->loadRootServerFile();
- if (true === $data) {
- throw new \LogicException('loadRootServerFile should not return true during initialization');
- }
- return $this->loadIncludes($data);
- }
- private function hasPartialPackages(): bool
- {
- if ($this->hasPartialPackages && null === $this->partialPackagesByName) {
- $this->initializePartialPackages();
- }
- return $this->hasPartialPackages;
- }
- private function loadProviderListings($data): void
- {
- if (isset($data['providers'])) {
- if (!is_array($this->providerListing)) {
- $this->providerListing = [];
- }
- $this->providerListing = array_merge($this->providerListing, $data['providers']);
- }
- if ($this->providersUrl && isset($data['provider-includes'])) {
- $includes = $data['provider-includes'];
- foreach ($includes as $include => $metadata) {
- $url = $this->baseUrl . '/' . str_replace('%hash%', $metadata['sha256'], $include);
- $cacheKey = str_replace(['%hash%','$'], '', $include);
- if ($this->cache->sha256($cacheKey) === $metadata['sha256']) {
- $includedData = json_decode($this->cache->read($cacheKey), true);
- } else {
- $includedData = $this->fetchFile($url, $cacheKey, $metadata['sha256']);
- }
- $this->loadProviderListings($includedData);
- }
- }
- }
- private function loadIncludes(array $data): array
- {
- $packages = [];
- if (!isset($data['packages']) && !isset($data['includes'])) {
- foreach ($data as $pkg) {
- if (isset($pkg['versions']) && is_array($pkg['versions'])) {
- foreach ($pkg['versions'] as $metadata) {
- $packages[] = $metadata;
- }
- }
- }
- return $packages;
- }
- if (isset($data['packages'])) {
- foreach ($data['packages'] as $package => $versions) {
- $packageName = strtolower((string) $package);
- foreach ($versions as $version => $metadata) {
- $packages[] = $metadata;
- if (!$this->displayedWarningAboutNonMatchingPackageIndex && $packageName !== strtolower((string) ($metadata['name'] ?? ''))) {
- $this->displayedWarningAboutNonMatchingPackageIndex = true;
- $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));
- }
- }
- }
- }
- if (isset($data['includes'])) {
- foreach ($data['includes'] as $include => $metadata) {
- if (isset($metadata['sha1']) && $this->cache->sha1((string) $include) === $metadata['sha1']) {
- $includedData = json_decode($this->cache->read((string) $include), true);
- } else {
- $includedData = $this->fetchFile($include);
- }
- $packages = array_merge($packages, $this->loadIncludes($includedData));
- }
- }
- return $packages;
- }
- private function createPackages(array $packages, ?string $source = null): array
- {
- if (!$packages) {
- return [];
- }
- try {
- foreach ($packages as &$data) {
- if (!isset($data['notification-url'])) {
- $data['notification-url'] = $this->notifyUrl;
- }
- }
- $packageInstances = $this->loader->loadPackages($packages);
- foreach ($packageInstances as $package) {
- if (isset($this->sourceMirrors[$package->getSourceType()])) {
- $package->setSourceMirrors($this->sourceMirrors[$package->getSourceType()]);
- }
- $package->setDistMirrors($this->distMirrors);
- $this->configurePackageTransportOptions($package);
- }
- return $packageInstances;
- } catch (\Exception $e) {
- 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);
- }
- }
- protected function fetchFile(string $filename, ?string $cacheKey = null, ?string $sha256 = null, bool $storeLastModifiedTime = false)
- {
- if (null === $cacheKey) {
- $cacheKey = $filename;
- $filename = $this->baseUrl.'/'.$filename;
- }
- if (($pos = strpos($filename, '$')) && Preg::isMatch('{^https?://}i', $filename)) {
- $filename = substr($filename, 0, $pos) . '%24' . substr($filename, $pos + 1);
- }
- $retries = 3;
- while ($retries--) {
- try {
- $options = $this->options;
- if ($this->eventDispatcher) {
- $preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $this->httpDownloader, $filename, 'metadata', ['repository' => $this]);
- $preFileDownloadEvent->setTransportOptions($this->options);
- $this->eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
- $filename = $preFileDownloadEvent->getProcessedUrl();
- $options = $preFileDownloadEvent->getTransportOptions();
- }
- $response = $this->httpDownloader->get($filename, $options);
- $json = (string) $response->getBody();
- if ($sha256 && $sha256 !== hash('sha256', $json)) {
- if ($this->allowSslDowngrade) {
- $this->url = str_replace('http://', 'https://', $this->url);
- $this->baseUrl = str_replace('http://', 'https://', $this->baseUrl);
- $filename = str_replace('http://', 'https://', $filename);
- }
- if ($retries > 0) {
- usleep(100000);
- continue;
- }
- 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.');
- }
- if ($this->eventDispatcher) {
- $postFileDownloadEvent = new PostFileDownloadEvent(PluginEvents::POST_FILE_DOWNLOAD, null, $sha256, $filename, 'metadata', ['response' => $response, 'repository' => $this]);
- $this->eventDispatcher->dispatch($postFileDownloadEvent->getName(), $postFileDownloadEvent);
- }
- $data = $response->decodeJson();
- HttpDownloader::outputWarnings($this->io, $this->url, $data);
- if ($cacheKey && !$this->cache->isReadOnly()) {
- if ($storeLastModifiedTime) {
- $lastModifiedDate = $response->getHeader('last-modified');
- if ($lastModifiedDate) {
- $data['last-modified'] = $lastModifiedDate;
- $json = JsonFile::encode($data, 0);
- }
- }
- $this->cache->write($cacheKey, $json);
- }
- $response->collect();
- break;
- } catch (\Exception $e) {
- if ($e instanceof \LogicException) {
- throw $e;
- }
- if ($e instanceof TransportException && $e->getStatusCode() === 404) {
- throw $e;
- }
- if ($e instanceof RepositorySecurityException) {
- throw $e;
- }
- if ($cacheKey && ($contents = $this->cache->read($cacheKey))) {
- if (!$this->degradedMode) {
- $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>');
- }
- $this->degradedMode = true;
- $data = JsonFile::parseJson($contents, $this->cache->getRoot().$cacheKey);
- break;
- }
- throw $e;
- }
- }
- if (!isset($data)) {
- throw new \LogicException("ComposerRepository: Undefined \$data. Please report at https://github.com/composer/composer/issues/new.");
- }
- return $data;
- }
- private function fetchFileIfLastModified(string $filename, string $cacheKey, string $lastModifiedTime)
- {
- try {
- $options = $this->options;
- if ($this->eventDispatcher) {
- $preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $this->httpDownloader, $filename, 'metadata', ['repository' => $this]);
- $preFileDownloadEvent->setTransportOptions($this->options);
- $this->eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
- $filename = $preFileDownloadEvent->getProcessedUrl();
- $options = $preFileDownloadEvent->getTransportOptions();
- }
- if (isset($options['http']['header'])) {
- $options['http']['header'] = (array) $options['http']['header'];
- }
- $options['http']['header'][] = 'If-Modified-Since: '.$lastModifiedTime;
- $response = $this->httpDownloader->get($filename, $options);
- $json = (string) $response->getBody();
- if ($json === '' && $response->getStatusCode() === 304) {
- return true;
- }
- if ($this->eventDispatcher) {
- $postFileDownloadEvent = new PostFileDownloadEvent(PluginEvents::POST_FILE_DOWNLOAD, null, null, $filename, 'metadata', ['response' => $response, 'repository' => $this]);
- $this->eventDispatcher->dispatch($postFileDownloadEvent->getName(), $postFileDownloadEvent);
- }
- $data = $response->decodeJson();
- HttpDownloader::outputWarnings($this->io, $this->url, $data);
- $lastModifiedDate = $response->getHeader('last-modified');
- $response->collect();
- if ($lastModifiedDate) {
- $data['last-modified'] = $lastModifiedDate;
- $json = JsonFile::encode($data, 0);
- }
- if (!$this->cache->isReadOnly()) {
- $this->cache->write($cacheKey, $json);
- }
- return $data;
- } catch (\Exception $e) {
- if ($e instanceof \LogicException) {
- throw $e;
- }
- if ($e instanceof TransportException && $e->getStatusCode() === 404) {
- throw $e;
- }
- if (!$this->degradedMode) {
- $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>');
- }
- $this->degradedMode = true;
- return true;
- }
- }
- private function asyncFetchFile(string $filename, string $cacheKey, ?string $lastModifiedTime = null): PromiseInterface
- {
- if (isset($this->packagesNotFoundCache[$filename])) {
- return \React\Promise\resolve(['packages' => []]);
- }
- if (isset($this->freshMetadataUrls[$filename]) && $lastModifiedTime) {
- return \React\Promise\resolve(true);
- }
- $httpDownloader = $this->httpDownloader;
- $options = $this->options;
- if ($this->eventDispatcher) {
- $preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $this->httpDownloader, $filename, 'metadata', ['repository' => $this]);
- $preFileDownloadEvent->setTransportOptions($this->options);
- $this->eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
- $filename = $preFileDownloadEvent->getProcessedUrl();
- $options = $preFileDownloadEvent->getTransportOptions();
- }
- if ($lastModifiedTime) {
- if (isset($options['http']['header'])) {
- $options['http']['header'] = (array) $options['http']['header'];
- }
- $options['http']['header'][] = 'If-Modified-Since: '.$lastModifiedTime;
- }
- $io = $this->io;
- $url = $this->url;
- $cache = $this->cache;
- $degradedMode = &$this->degradedMode;
- $eventDispatcher = $this->eventDispatcher;
- $accept = function ($response) use ($io, $url, $filename, $cache, $cacheKey, $eventDispatcher) {
- if ($response->getStatusCode() === 404) {
- $this->packagesNotFoundCache[$filename] = true;
- return ['packages' => []];
- }
- $json = (string) $response->getBody();
- if ($json === '' && $response->getStatusCode() === 304) {
- $this->freshMetadataUrls[$filename] = true;
- return true;
- }
- if ($eventDispatcher) {
- $postFileDownloadEvent = new PostFileDownloadEvent(PluginEvents::POST_FILE_DOWNLOAD, null, null, $filename, 'metadata', ['response' => $response, 'repository' => $this]);
- $eventDispatcher->dispatch($postFileDownloadEvent->getName(), $postFileDownloadEvent);
- }
- $data = $response->decodeJson();
- HttpDownloader::outputWarnings($io, $url, $data);
- $lastModifiedDate = $response->getHeader('last-modified');
- $response->collect();
- if ($lastModifiedDate) {
- $data['last-modified'] = $lastModifiedDate;
- $json = JsonFile::encode($data, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
- }
- if (!$cache->isReadOnly()) {
- $cache->write($cacheKey, $json);
- }
- $this->freshMetadataUrls[$filename] = true;
- return $data;
- };
- $reject = function ($e) use ($filename, $accept, $io, $url, &$degradedMode, $lastModifiedTime) {
- if ($e instanceof TransportException && $e->getStatusCode() === 404) {
- $this->packagesNotFoundCache[$filename] = true;
- return false;
- }
- if (!$degradedMode) {
- $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>');
- }
- $degradedMode = true;
- if ($lastModifiedTime) {
- return $accept(new Response(['url' => $url], 304, [], ''));
- }
- if ($e instanceof TransportException && $e->getStatusCode() === 499) {
- return $accept(new Response(['url' => $url], 404, [], ''));
- }
- throw $e;
- };
- return $httpDownloader->add($filename, $options)->then($accept, $reject);
- }
- private function initializePartialPackages(): void
- {
- $rootData = $this->loadRootServerFile();
- if ($rootData === true) {
- return;
- }
- $this->partialPackagesByName = [];
- foreach ($rootData['packages'] as $package => $versions) {
- foreach ($versions as $version) {
- $versionPackageName = strtolower((string) ($version['name'] ?? ''));
- $this->partialPackagesByName[$versionPackageName][] = $version;
- if (!$this->displayedWarningAboutNonMatchingPackageIndex && $versionPackageName !== strtolower($package)) {
- $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));
- $this->displayedWarningAboutNonMatchingPackageIndex = true;
- }
- }
- }
- $this->rootData = true;
- }
- protected function lazyProvidersRepoContains(string $name)
- {
- if (!$this->hasAvailablePackageList) {
- throw new \LogicException('lazyProvidersRepoContains should not be called unless hasAvailablePackageList is true');
- }
- if (is_array($this->availablePackages) && isset($this->availablePackages[$name])) {
- return true;
- }
- if (is_array($this->availablePackagePatterns)) {
- foreach ($this->availablePackagePatterns as $providerRegex) {
- if (Preg::isMatch($providerRegex, $name)) {
- return true;
- }
- }
- }
- return false;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Repository;
- use Composer\Package\BasePackage;
- use Composer\Package\PackageInterface;
- class CompositeRepository implements RepositoryInterface
- {
- private $repositories;
- public function __construct(array $repositories)
- {
- $this->repositories = [];
- foreach ($repositories as $repo) {
- $this->addRepository($repo);
- }
- }
- public function getRepoName(): string
- {
- return 'composite repo ('.implode(', ', array_map(static function ($repo): string {
- return $repo->getRepoName();
- }, $this->repositories)).')';
- }
- public function getRepositories(): array
- {
- return $this->repositories;
- }
- public function hasPackage(PackageInterface $package): bool
- {
- foreach ($this->repositories as $repository) {
- if ($repository->hasPackage($package)) {
- return true;
- }
- }
- return false;
- }
- public function findPackage($name, $constraint): ?BasePackage
- {
- foreach ($this->repositories as $repository) {
- $package = $repository->findPackage($name, $constraint);
- if (null !== $package) {
- return $package;
- }
- }
- return null;
- }
- public function findPackages($name, $constraint = null): array
- {
- $packages = [];
- foreach ($this->repositories as $repository) {
- $packages[] = $repository->findPackages($name, $constraint);
- }
- return $packages ? array_merge(...$packages) : [];
- }
- public function loadPackages(array $packageNameMap, array $acceptableStabilities, array $stabilityFlags, array $alreadyLoaded = []): array
- {
- $packages = [];
- $namesFound = [];
- foreach ($this->repositories as $repository) {
- $result = $repository->loadPackages($packageNameMap, $acceptableStabilities, $stabilityFlags, $alreadyLoaded);
- $packages[] = $result['packages'];
- $namesFound[] = $result['namesFound'];
- }
- return [
- 'packages' => $packages ? array_merge(...$packages) : [],
- 'namesFound' => $namesFound ? array_unique(array_merge(...$namesFound)) : [],
- ];
- }
- public function search(string $query, int $mode = 0, ?string $type = null): array
- {
- $matches = [];
- foreach ($this->repositories as $repository) {
- $matches[] = $repository->search($query, $mode, $type);
- }
- return $matches ? array_merge(...$matches) : [];
- }
- public function getPackages(): array
- {
- $packages = [];
- foreach ($this->repositories as $repository) {
- $packages[] = $repository->getPackages();
- }
- return $packages ? array_merge(...$packages) : [];
- }
- public function getProviders($packageName): array
- {
- $results = [];
- foreach ($this->repositories as $repository) {
- $results[] = $repository->getProviders($packageName);
- }
- return $results ? array_merge(...$results) : [];
- }
- public function removePackage(PackageInterface $package): void
- {
- foreach ($this->repositories as $repository) {
- if ($repository instanceof WritableRepositoryInterface) {
- $repository->removePackage($package);
- }
- }
- }
- public function count(): int
- {
- $total = 0;
- foreach ($this->repositories as $repository) {
- $total += $repository->count();
- }
- return $total;
- }
- public function addRepository(RepositoryInterface $repository): void
- {
- if ($repository instanceof self) {
- foreach ($repository->getRepositories() as $repo) {
- $this->addRepository($repo);
- }
- } else {
- $this->repositories[] = $repository;
- }
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Repository;
- interface ConfigurableRepositoryInterface
- {
- public function getRepoConfig();
- }
- <?php declare(strict_types=1);
- namespace Composer\Repository;
- use Composer\Json\JsonFile;
- use Composer\Package\Loader\ArrayLoader;
- use Composer\Package\PackageInterface;
- use Composer\Package\RootAliasPackage;
- use Composer\Package\RootPackageInterface;
- use Composer\Package\AliasPackage;
- use Composer\Package\Dumper\ArrayDumper;
- use Composer\Installer\InstallationManager;
- use Composer\Util\Filesystem;
- use Composer\Util\Platform;
- class FilesystemRepository extends WritableArrayRepository
- {
- protected $file;
- private $dumpVersions;
- private $rootPackage;
- private $filesystem;
- private $devMode = null;
- public function __construct(JsonFile $repositoryFile, bool $dumpVersions = false, ?RootPackageInterface $rootPackage = null, ?Filesystem $filesystem = null)
- {
- parent::__construct();
- $this->file = $repositoryFile;
- $this->dumpVersions = $dumpVersions;
- $this->rootPackage = $rootPackage;
- $this->filesystem = $filesystem ?: new Filesystem;
- if ($dumpVersions && !$rootPackage) {
- throw new \InvalidArgumentException('Expected a root package instance if $dumpVersions is true');
- }
- }
- public function getDevMode()
- {
- return $this->devMode;
- }
- protected function initialize()
- {
- parent::initialize();
- if (!$this->file->exists()) {
- return;
- }
- try {
- $data = $this->file->read();
- if (isset($data['packages'])) {
- $packages = $data['packages'];
- } else {
- $packages = $data;
- }
- if (isset($data['dev-package-names'])) {
- $this->setDevPackageNames($data['dev-package-names']);
- }
- if (isset($data['dev'])) {
- $this->devMode = $data['dev'];
- }
- if (!is_array($packages)) {
- throw new \UnexpectedValueException('Could not parse package list from the repository');
- }
- } catch (\Exception $e) {
- throw new InvalidRepositoryException('Invalid repository data in '.$this->file->getPath().', packages could not be loaded: ['.get_class($e).'] '.$e->getMessage());
- }
- $loader = new ArrayLoader(null, true);
- foreach ($packages as $packageData) {
- $package = $loader->load($packageData);
- $this->addPackage($package);
- }
- }
- public function reload()
- {
- $this->packages = null;
- $this->initialize();
- }
- public function write(bool $devMode, InstallationManager $installationManager)
- {
- $data = ['packages' => [], 'dev' => $devMode, 'dev-package-names' => []];
- $dumper = new ArrayDumper();
- $repoDir = dirname($this->file->getPath());
- $this->filesystem->ensureDirectoryExists($repoDir);
- $repoDir = $this->filesystem->normalizePath(realpath($repoDir));
- $installPaths = [];
- foreach ($this->getCanonicalPackages() as $package) {
- $pkgArray = $dumper->dump($package);
- $path = $installationManager->getInstallPath($package);
- $installPath = null;
- if ('' !== $path && null !== $path) {
- $normalizedPath = $this->filesystem->normalizePath($this->filesystem->isAbsolutePath($path) ? $path : Platform::getCwd() . '/' . $path);
- $installPath = $this->filesystem->findShortestPath($repoDir, $normalizedPath, true);
- }
- $installPaths[$package->getName()] = $installPath;
- $pkgArray['install-path'] = $installPath;
- $data['packages'][] = $pkgArray;
- if (in_array($package->getName(), $this->devPackageNames, true)) {
- $data['dev-package-names'][] = $package->getName();
- }
- }
- sort($data['dev-package-names']);
- usort($data['packages'], static function ($a, $b): int {
- return strcmp($a['name'], $b['name']);
- });
- $this->file->write($data);
- if ($this->dumpVersions) {
- $versions = $this->generateInstalledVersions($installationManager, $installPaths, $devMode, $repoDir);
- $this->filesystem->filePutContentsIfModified($repoDir.'/installed.php', '<?php return ' . $this->dumpToPhpCode($versions) . ';'."\n");
- $installedVersionsClass = file_get_contents(__DIR__.'/../InstalledVersions.php');
- $this->filesystem->filePutContentsIfModified($repoDir.'/InstalledVersions.php', $installedVersionsClass);
- \Composer\InstalledVersions::reload($versions);
- }
- }
- private function dumpToPhpCode(array $array = [], int $level = 0): string
- {
- $lines = "array(\n";
- $level++;
- foreach ($array as $key => $value) {
- $lines .= str_repeat(' ', $level);
- $lines .= is_int($key) ? $key . ' => ' : '\'' . $key . '\' => ';
- if (is_array($value)) {
- if (!empty($value)) {
- $lines .= $this->dumpToPhpCode($value, $level);
- } else {
- $lines .= "array(),\n";
- }
- } elseif ($key === 'install_path' && is_string($value)) {
- if ($this->filesystem->isAbsolutePath($value)) {
- $lines .= var_export($value, true) . ",\n";
- } else {
- $lines .= "__DIR__ . " . var_export('/' . $value, true) . ",\n";
- }
- } else {
- $lines .= var_export($value, true) . ",\n";
- }
- }
- $lines .= str_repeat(' ', $level - 1) . ')' . ($level - 1 === 0 ? '' : ",\n");
- return $lines;
- }
- private function generateInstalledVersions(InstallationManager $installationManager, array $installPaths, bool $devMode, string $repoDir): array
- {
- $devPackages = array_flip($this->devPackageNames);
- $packages = $this->getPackages();
- if (null === $this->rootPackage) {
- throw new \LogicException('It should not be possible to dump packages if no root package is given');
- }
- $packages[] = $rootPackage = $this->rootPackage;
- while ($rootPackage instanceof RootAliasPackage) {
- $rootPackage = $rootPackage->getAliasOf();
- $packages[] = $rootPackage;
- }
- $versions = [
- 'root' => $this->dumpRootPackage($rootPackage, $installPaths, $devMode, $repoDir, $devPackages),
- 'versions' => [],
- ];
- foreach ($packages as $package) {
- if ($package instanceof AliasPackage) {
- continue;
- }
- $versions['versions'][$package->getName()] = $this->dumpInstalledPackage($package, $installPaths, $repoDir, $devPackages);
- }
- foreach ($packages as $package) {
- $isDevPackage = isset($devPackages[$package->getName()]);
- foreach ($package->getReplaces() as $replace) {
- if (PlatformRepository::isPlatformPackage($replace->getTarget())) {
- continue;
- }
- if (!isset($versions['versions'][$replace->getTarget()]['dev_requirement'])) {
- $versions['versions'][$replace->getTarget()]['dev_requirement'] = $isDevPackage;
- } elseif (!$isDevPackage) {
- $versions['versions'][$replace->getTarget()]['dev_requirement'] = false;
- }
- $replaced = $replace->getPrettyConstraint();
- if ($replaced === 'self.version') {
- $replaced = $package->getPrettyVersion();
- }
- if (!isset($versions['versions'][$replace->getTarget()]['replaced']) || !in_array($replaced, $versions['versions'][$replace->getTarget()]['replaced'], true)) {
- $versions['versions'][$replace->getTarget()]['replaced'][] = $replaced;
- }
- }
- foreach ($package->getProvides() as $provide) {
- if (PlatformRepository::isPlatformPackage($provide->getTarget())) {
- continue;
- }
- if (!isset($versions['versions'][$provide->getTarget()]['dev_requirement'])) {
- $versions['versions'][$provide->getTarget()]['dev_requirement'] = $isDevPackage;
- } elseif (!$isDevPackage) {
- $versions['versions'][$provide->getTarget()]['dev_requirement'] = false;
- }
- $provided = $provide->getPrettyConstraint();
- if ($provided === 'self.version') {
- $provided = $package->getPrettyVersion();
- }
- if (!isset($versions['versions'][$provide->getTarget()]['provided']) || !in_array($provided, $versions['versions'][$provide->getTarget()]['provided'], true)) {
- $versions['versions'][$provide->getTarget()]['provided'][] = $provided;
- }
- }
- }
- foreach ($packages as $package) {
- if (!$package instanceof AliasPackage) {
- continue;
- }
- $versions['versions'][$package->getName()]['aliases'][] = $package->getPrettyVersion();
- if ($package instanceof RootPackageInterface) {
- $versions['root']['aliases'][] = $package->getPrettyVersion();
- }
- }
- ksort($versions['versions']);
- ksort($versions);
- return $versions;
- }
- private function dumpInstalledPackage(PackageInterface $package, array $installPaths, string $repoDir, array $devPackages): array
- {
- $reference = null;
- if ($package->getInstallationSource()) {
- $reference = $package->getInstallationSource() === 'source' ? $package->getSourceReference() : $package->getDistReference();
- }
- if (null === $reference) {
- $reference = ($package->getSourceReference() ?: $package->getDistReference()) ?: null;
- }
- if ($package instanceof RootPackageInterface) {
- $to = $this->filesystem->normalizePath(realpath(Platform::getCwd()));
- $installPath = $this->filesystem->findShortestPath($repoDir, $to, true);
- } else {
- $installPath = $installPaths[$package->getName()];
- }
- $data = [
- 'pretty_version' => $package->getPrettyVersion(),
- 'version' => $package->getVersion(),
- 'reference' => $reference,
- 'type' => $package->getType(),
- 'install_path' => $installPath,
- 'aliases' => [],
- 'dev_requirement' => isset($devPackages[$package->getName()]),
- ];
- return $data;
- }
- private function dumpRootPackage(RootPackageInterface $package, array $installPaths, bool $devMode, string $repoDir, array $devPackages)
- {
- $data = $this->dumpInstalledPackage($package, $installPaths, $repoDir, $devPackages);
- return [
- 'name' => $package->getName(),
- 'pretty_version' => $data['pretty_version'],
- 'version' => $data['version'],
- 'reference' => $data['reference'],
- 'type' => $data['type'],
- 'install_path' => $data['install_path'],
- 'aliases' => $data['aliases'],
- 'dev' => $devMode,
- ];
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Repository;
- use Composer\Package\PackageInterface;
- use Composer\Package\BasePackage;
- use Composer\Pcre\Preg;
- class FilterRepository implements RepositoryInterface
- {
- private $only = null;
- private $exclude = null;
- private $canonical = true;
- private $repo;
- public function __construct(RepositoryInterface $repo, array $options)
- {
- if (isset($options['only'])) {
- if (!is_array($options['only'])) {
- throw new \InvalidArgumentException('"only" key for repository '.$repo->getRepoName().' should be an array');
- }
- $this->only = BasePackage::packageNamesToRegexp($options['only']);
- }
- if (isset($options['exclude'])) {
- if (!is_array($options['exclude'])) {
- throw new \InvalidArgumentException('"exclude" key for repository '.$repo->getRepoName().' should be an array');
- }
- $this->exclude = BasePackage::packageNamesToRegexp($options['exclude']);
- }
- if ($this->exclude && $this->only) {
- throw new \InvalidArgumentException('Only one of "only" and "exclude" can be specified for repository '.$repo->getRepoName());
- }
- if (isset($options['canonical'])) {
- if (!is_bool($options['canonical'])) {
- throw new \InvalidArgumentException('"canonical" key for repository '.$repo->getRepoName().' should be a boolean');
- }
- $this->canonical = $options['canonical'];
- }
- $this->repo = $repo;
- }
- public function getRepoName(): string
- {
- return $this->repo->getRepoName();
- }
- public function getRepository(): RepositoryInterface
- {
- return $this->repo;
- }
- public function hasPackage(PackageInterface $package): bool
- {
- return $this->repo->hasPackage($package);
- }
- public function findPackage($name, $constraint): ?BasePackage
- {
- if (!$this->isAllowed($name)) {
- return null;
- }
- return $this->repo->findPackage($name, $constraint);
- }
- public function findPackages($name, $constraint = null): array
- {
- if (!$this->isAllowed($name)) {
- return [];
- }
- return $this->repo->findPackages($name, $constraint);
- }
- public function loadPackages(array $packageNameMap, array $acceptableStabilities, array $stabilityFlags, array $alreadyLoaded = []): array
- {
- foreach ($packageNameMap as $name => $constraint) {
- if (!$this->isAllowed($name)) {
- unset($packageNameMap[$name]);
- }
- }
- if (!$packageNameMap) {
- return ['namesFound' => [], 'packages' => []];
- }
- $result = $this->repo->loadPackages($packageNameMap, $acceptableStabilities, $stabilityFlags, $alreadyLoaded);
- if (!$this->canonical) {
- $result['namesFound'] = [];
- }
- return $result;
- }
- public function search(string $query, int $mode = 0, ?string $type = null): array
- {
- $result = [];
- foreach ($this->repo->search($query, $mode, $type) as $package) {
- if ($this->isAllowed($package['name'])) {
- $result[] = $package;
- }
- }
- return $result;
- }
- public function getPackages(): array
- {
- $result = [];
- foreach ($this->repo->getPackages() as $package) {
- if ($this->isAllowed($package->getName())) {
- $result[] = $package;
- }
- }
- return $result;
- }
- public function getProviders($packageName): array
- {
- $result = [];
- foreach ($this->repo->getProviders($packageName) as $name => $provider) {
- if ($this->isAllowed($provider['name'])) {
- $result[$name] = $provider;
- }
- }
- return $result;
- }
- public function count(): int
- {
- if ($this->repo->count() > 0) {
- return count($this->getPackages());
- }
- return 0;
- }
- private function isAllowed(string $name): bool
- {
- if (!$this->only && !$this->exclude) {
- return true;
- }
- if ($this->only) {
- return Preg::isMatch($this->only, $name);
- }
- if ($this->exclude === null) {
- return true;
- }
- return !Preg::isMatch($this->exclude, $name);
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Repository;
- class InstalledArrayRepository extends WritableArrayRepository implements InstalledRepositoryInterface
- {
- public function getRepoName(): string
- {
- return 'installed '.parent::getRepoName();
- }
- public function isFresh(): bool
- {
- return $this->count() === 0;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Repository;
- class InstalledFilesystemRepository extends FilesystemRepository implements InstalledRepositoryInterface
- {
- public function getRepoName()
- {
- return 'installed '.parent::getRepoName();
- }
- public function isFresh()
- {
- return !$this->file->exists();
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Repository;
- use Composer\Package\BasePackage;
- use Composer\Package\PackageInterface;
- use Composer\Package\Version\VersionParser;
- use Composer\Semver\Constraint\ConstraintInterface;
- use Composer\Semver\Constraint\Constraint;
- use Composer\Semver\Constraint\MatchAllConstraint;
- use Composer\Package\RootPackageInterface;
- use Composer\Package\Link;
- class InstalledRepository extends CompositeRepository
- {
- public function findPackagesWithReplacersAndProviders(string $name, $constraint = null): array
- {
- $name = strtolower($name);
- if (null !== $constraint && !$constraint instanceof ConstraintInterface) {
- $versionParser = new VersionParser();
- $constraint = $versionParser->parseConstraints($constraint);
- }
- $matches = [];
- foreach ($this->getRepositories() as $repo) {
- foreach ($repo->getPackages() as $candidate) {
- if ($name === $candidate->getName()) {
- if (null === $constraint || $constraint->matches(new Constraint('==', $candidate->getVersion()))) {
- $matches[] = $candidate;
- }
- continue;
- }
- foreach (array_merge($candidate->getProvides(), $candidate->getReplaces()) as $link) {
- if (
- $name === $link->getTarget()
- && ($constraint === null || $constraint->matches($link->getConstraint()))
- ) {
- $matches[] = $candidate;
- continue 2;
- }
- }
- }
- }
- return $matches;
- }
- public function getDependents($needle, ?ConstraintInterface $constraint = null, bool $invert = false, bool $recurse = true, ?array $packagesFound = null): array
- {
- $needles = array_map('strtolower', (array) $needle);
- $results = [];
- if (null === $packagesFound) {
- $packagesFound = $needles;
- }
- $rootPackage = null;
- foreach ($this->getPackages() as $package) {
- if ($package instanceof RootPackageInterface) {
- $rootPackage = $package;
- break;
- }
- }
- foreach ($this->getPackages() as $package) {
- $links = $package->getRequires();
- $packagesInTree = $packagesFound;
- if (!$invert) {
- $links += $package->getReplaces();
- foreach ($package->getReplaces() as $link) {
- foreach ($needles as $needle) {
- if ($link->getSource() === $needle) {
- if ($constraint === null || ($link->getConstraint()->matches($constraint) === true)) {
- if (in_array($link->getTarget(), $packagesInTree)) {
- $results[] = [$package, $link, false];
- continue;
- }
- $packagesInTree[] = $link->getTarget();
- $dependents = $recurse ? $this->getDependents($link->getTarget(), null, false, true, $packagesInTree) : [];
- $results[] = [$package, $link, $dependents];
- $needles[] = $link->getTarget();
- }
- }
- }
- }
- }
- if ($package instanceof RootPackageInterface) {
- $links += $package->getDevRequires();
- }
- foreach ($links as $link) {
- foreach ($needles as $needle) {
- if ($link->getTarget() === $needle) {
- if ($constraint === null || ($link->getConstraint()->matches($constraint) === !$invert)) {
- if (in_array($link->getSource(), $packagesInTree)) {
- $results[] = [$package, $link, false];
- continue;
- }
- $packagesInTree[] = $link->getSource();
- $dependents = $recurse ? $this->getDependents($link->getSource(), null, false, true, $packagesInTree) : [];
- $results[] = [$package, $link, $dependents];
- }
- }
- }
- }
- if ($invert && in_array($package->getName(), $needles)) {
- foreach ($package->getConflicts() as $link) {
- foreach ($this->findPackages($link->getTarget()) as $pkg) {
- $version = new Constraint('=', $pkg->getVersion());
- if ($link->getConstraint()->matches($version) === $invert) {
- $results[] = [$package, $link, false];
- }
- }
- }
- }
- foreach ($package->getConflicts() as $link) {
- if (in_array($link->getTarget(), $needles)) {
- foreach ($this->findPackages($link->getTarget()) as $pkg) {
- $version = new Constraint('=', $pkg->getVersion());
- if ($link->getConstraint()->matches($version) === $invert) {
- $results[] = [$package, $link, false];
- }
- }
- }
- }
- if ($invert && $constraint && in_array($package->getName(), $needles) && $constraint->matches(new Constraint('=', $package->getVersion()))) {
- foreach ($package->getRequires() as $link) {
- if (PlatformRepository::isPlatformPackage($link->getTarget())) {
- if ($this->findPackage($link->getTarget(), $link->getConstraint())) {
- continue;
- }
- $platformPkg = $this->findPackage($link->getTarget(), '*');
- $description = $platformPkg ? 'but '.$platformPkg->getPrettyVersion().' is installed' : 'but it is missing';
- $results[] = [$package, new Link($package->getName(), $link->getTarget(), new MatchAllConstraint, Link::TYPE_REQUIRE, $link->getPrettyConstraint().' '.$description), false];
- continue;
- }
- foreach ($this->getPackages() as $pkg) {
- if (!in_array($link->getTarget(), $pkg->getNames())) {
- continue;
- }
- $version = new Constraint('=', $pkg->getVersion());
- if ($link->getTarget() !== $pkg->getName()) {
- foreach (array_merge($pkg->getReplaces(), $pkg->getProvides()) as $prov) {
- if ($link->getTarget() === $prov->getTarget()) {
- $version = $prov->getConstraint();
- break;
- }
- }
- }
- if (!$link->getConstraint()->matches($version)) {
- if ($rootPackage) {
- foreach (array_merge($rootPackage->getRequires(), $rootPackage->getDevRequires()) as $rootReq) {
- if (in_array($rootReq->getTarget(), $pkg->getNames()) && !$rootReq->getConstraint()->matches($link->getConstraint())) {
- $results[] = [$package, $link, false];
- $results[] = [$rootPackage, $rootReq, false];
- continue 3;
- }
- }
- $results[] = [$package, $link, false];
- $results[] = [$rootPackage, new Link($rootPackage->getName(), $link->getTarget(), new MatchAllConstraint, Link::TYPE_DOES_NOT_REQUIRE, 'but ' . $pkg->getPrettyVersion() . ' is installed'), false];
- } else {
- $results[] = [$package, $link, false];
- }
- }
- continue 2;
- }
- }
- }
- }
- ksort($results);
- return $results;
- }
- public function getRepoName(): string
- {
- return 'installed repo ('.implode(', ', array_map(static function ($repo): string {
- return $repo->getRepoName();
- }, $this->getRepositories())).')';
- }
- public function addRepository(RepositoryInterface $repository): void
- {
- if (
- $repository instanceof LockArrayRepository
- || $repository instanceof InstalledRepositoryInterface
- || $repository instanceof RootPackageRepository
- || $repository instanceof PlatformRepository
- ) {
- parent::addRepository($repository);
- return;
- }
- throw new \LogicException('An InstalledRepository can not contain a repository of type '.get_class($repository).' ('.$repository->getRepoName().')');
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Repository;
- interface InstalledRepositoryInterface extends WritableRepositoryInterface
- {
- public function getDevMode();
- public function isFresh();
- }
- <?php declare(strict_types=1);
- namespace Composer\Repository;
- class InvalidRepositoryException extends \Exception
- {
- }
- <?php declare(strict_types=1);
- namespace Composer\Repository;
- class LockArrayRepository extends ArrayRepository
- {
- use CanonicalPackagesTrait;
- public function getRepoName(): string
- {
- return 'lock repo';
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Repository;
- use Composer\Package\Loader\ArrayLoader;
- use Composer\Package\Loader\ValidatingArrayLoader;
- use Composer\Pcre\Preg;
- class PackageRepository extends ArrayRepository
- {
- private $config;
- public function __construct(array $config)
- {
- parent::__construct();
- $this->config = $config['package'];
- if (!is_numeric(key($this->config))) {
- $this->config = [$this->config];
- }
- }
- protected function initialize(): void
- {
- parent::initialize();
- $loader = new ValidatingArrayLoader(new ArrayLoader(null, true), true);
- foreach ($this->config as $package) {
- try {
- $package = $loader->load($package);
- } catch (\Exception $e) {
- throw new InvalidRepositoryException('A repository of type "package" contains an invalid package definition: '.$e->getMessage()."\n\nInvalid package definition:\n".json_encode($package));
- }
- $this->addPackage($package);
- }
- }
- public function getRepoName(): string
- {
- return Preg::replace('{^array }', 'package ', parent::getRepoName());
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Repository;
- use Composer\Config;
- use Composer\EventDispatcher\EventDispatcher;
- use Composer\IO\IOInterface;
- use Composer\Json\JsonFile;
- use Composer\Package\Loader\ArrayLoader;
- use Composer\Package\Version\VersionGuesser;
- use Composer\Package\Version\VersionParser;
- use Composer\Pcre\Preg;
- use Composer\Util\HttpDownloader;
- use Composer\Util\Platform;
- use Composer\Util\ProcessExecutor;
- use Composer\Util\Filesystem;
- use Composer\Util\Url;
- use Composer\Util\Git as GitUtil;
- class PathRepository extends ArrayRepository implements ConfigurableRepositoryInterface
- {
- private $loader;
- private $versionGuesser;
- private $url;
- private $repoConfig;
- private $process;
- private $options;
- public function __construct(array $repoConfig, IOInterface $io, Config $config, ?HttpDownloader $httpDownloader = null, ?EventDispatcher $dispatcher = null, ?ProcessExecutor $process = null)
- {
- if (!isset($repoConfig['url'])) {
- throw new \RuntimeException('You must specify the `url` configuration for the path repository');
- }
- $this->loader = new ArrayLoader(null, true);
- $this->url = Platform::expandPath($repoConfig['url']);
- $this->process = $process ?? new ProcessExecutor($io);
- $this->versionGuesser = new VersionGuesser($config, $this->process, new VersionParser());
- $this->repoConfig = $repoConfig;
- $this->options = $repoConfig['options'] ?? [];
- if (!isset($this->options['relative'])) {
- $filesystem = new Filesystem();
- $this->options['relative'] = !$filesystem->isAbsolutePath($this->url);
- }
- parent::__construct();
- }
- public function getRepoName(): string
- {
- return 'path repo ('.Url::sanitize($this->repoConfig['url']).')';
- }
- public function getRepoConfig(): array
- {
- return $this->repoConfig;
- }
- protected function initialize(): void
- {
- parent::initialize();
- $urlMatches = $this->getUrlMatches();
- if (empty($urlMatches)) {
- if (Preg::isMatch('{[*{}]}', $this->url)) {
- $url = $this->url;
- while (Preg::isMatch('{[*{}]}', $url)) {
- $url = dirname($url);
- }
- if (is_dir($url)) {
- return;
- }
- }
- throw new \RuntimeException('The `url` supplied for the path (' . $this->url . ') repository does not exist');
- }
- foreach ($urlMatches as $url) {
- $path = realpath($url) . DIRECTORY_SEPARATOR;
- $composerFilePath = $path.'composer.json';
- if (!file_exists($composerFilePath)) {
- continue;
- }
- $json = file_get_contents($composerFilePath);
- $package = JsonFile::parseJson($json, $composerFilePath);
- $package['dist'] = [
- 'type' => 'path',
- 'url' => $url,
- ];
- $reference = $this->options['reference'] ?? 'auto';
- if ('none' === $reference) {
- $package['dist']['reference'] = null;
- } elseif ('config' === $reference || 'auto' === $reference) {
- $package['dist']['reference'] = sha1($json . serialize($this->options));
- }
- $package['transport-options'] = array_intersect_key($this->options, ['symlink' => true, 'relative' => true]);
- if (isset($package['name'], $this->options['versions'][$package['name']])) {
- $package['version'] = $this->options['versions'][$package['name']];
- }
- if (!isset($package['version']) && ($rootVersion = Platform::getEnv('COMPOSER_ROOT_VERSION'))) {
- if (
- 0 === $this->process->execute('git rev-parse HEAD', $ref1, $path)
- && 0 === $this->process->execute('git rev-parse HEAD', $ref2)
- && $ref1 === $ref2
- ) {
- $package['version'] = $rootVersion;
- }
- }
- $output = '';
- if ('auto' === $reference && is_dir($path . DIRECTORY_SEPARATOR . '.git') && 0 === $this->process->execute('git log -n1 --pretty=%H'.GitUtil::getNoShowSignatureFlag($this->process), $output, $path)) {
- $package['dist']['reference'] = trim($output);
- }
- if (!isset($package['version'])) {
- $versionData = $this->versionGuesser->guessVersion($package, $path);
- if (is_array($versionData) && $versionData['pretty_version']) {
- if (!empty($versionData['feature_pretty_version'])) {
- $package['version'] = $versionData['feature_pretty_version'];
- $this->addPackage($this->loader->load($package));
- }
- $package['version'] = $versionData['pretty_version'];
- } else {
- $package['version'] = 'dev-main';
- }
- }
- try {
- $this->addPackage($this->loader->load($package));
- } catch (\Exception $e) {
- throw new \RuntimeException('Failed loading the package in '.$composerFilePath, 0, $e);
- }
- }
- }
- private function getUrlMatches(): array
- {
- $flags = GLOB_MARK | GLOB_ONLYDIR;
- if (defined('GLOB_BRACE')) {
- $flags |= GLOB_BRACE;
- } elseif (strpos($this->url, '{') !== false || strpos($this->url, '}') !== false) {
- throw new \RuntimeException('The operating system does not support GLOB_BRACE which is required for the url '. $this->url);
- }
- return array_map(static function ($val): string {
- return rtrim(str_replace(DIRECTORY_SEPARATOR, '/', $val), '/');
- }, glob($this->url, $flags));
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Repository;
- class PearRepository extends ArrayRepository
- {
- public function __construct()
- {
- throw new \InvalidArgumentException('The PEAR repository has been removed from Composer 2.x');
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Repository;
- use Composer\Composer;
- use Composer\Package\CompletePackage;
- use Composer\Package\CompletePackageInterface;
- use Composer\Package\Link;
- use Composer\Package\PackageInterface;
- use Composer\Package\Version\VersionParser;
- use Composer\Pcre\Preg;
- use Composer\Platform\HhvmDetector;
- use Composer\Platform\Runtime;
- use Composer\Platform\Version;
- use Composer\Plugin\PluginInterface;
- use Composer\Semver\Constraint\Constraint;
- use Composer\Util\Silencer;
- use Composer\XdebugHandler\XdebugHandler;
- class PlatformRepository extends ArrayRepository
- {
- public const PLATFORM_PACKAGE_REGEX = '{^(?:php(?:-64bit|-ipv6|-zts|-debug)?|hhvm|(?:ext|lib)-[a-z0-9](?:[_.-]?[a-z0-9]+)*|composer(?:-(?:plugin|runtime)-api)?)$}iD';
- private static $lastSeenPlatformPhp = null;
- private $versionParser;
- private $overrides = [];
- private $disabledPackages = [];
- private $runtime;
- private $hhvmDetector;
- public function __construct(array $packages = [], array $overrides = [], ?Runtime $runtime = null, ?HhvmDetector $hhvmDetector = null)
- {
- $this->runtime = $runtime ?: new Runtime();
- $this->hhvmDetector = $hhvmDetector ?: new HhvmDetector();
- foreach ($overrides as $name => $version) {
- if (!is_string($version) && false !== $version) {
- throw new \UnexpectedValueException('config.platform.'.$name.' should be a string or false, but got '.gettype($version).' '.var_export($version, true));
- }
- if ($name === 'php' && $version === false) {
- throw new \UnexpectedValueException('config.platform.'.$name.' cannot be set to false as you cannot disable php entirely.');
- }
- $this->overrides[strtolower($name)] = ['name' => $name, 'version' => $version];
- }
- parent::__construct($packages);
- }
- public function getRepoName(): string
- {
- return 'platform repo';
- }
- public function isPlatformPackageDisabled(string $name): bool
- {
- return isset($this->disabledPackages[$name]);
- }
- public function getDisabledPackages(): array
- {
- return $this->disabledPackages;
- }
- protected function initialize(): void
- {
- parent::initialize();
- $this->versionParser = new VersionParser();
- foreach ($this->overrides as $override) {
- if (!self::isPlatformPackage($override['name'])) {
- throw new \InvalidArgumentException('Invalid platform package name in config.platform: '.$override['name']);
- }
- if ($override['version'] !== false) {
- $this->addOverriddenPackage($override);
- }
- }
- $prettyVersion = Composer::getVersion();
- $version = $this->versionParser->normalize($prettyVersion);
- $composer = new CompletePackage('composer', $version, $prettyVersion);
- $composer->setDescription('Composer package');
- $this->addPackage($composer);
- $prettyVersion = PluginInterface::PLUGIN_API_VERSION;
- $version = $this->versionParser->normalize($prettyVersion);
- $composerPluginApi = new CompletePackage('composer-plugin-api', $version, $prettyVersion);
- $composerPluginApi->setDescription('The Composer Plugin API');
- $this->addPackage($composerPluginApi);
- $prettyVersion = Composer::RUNTIME_API_VERSION;
- $version = $this->versionParser->normalize($prettyVersion);
- $composerRuntimeApi = new CompletePackage('composer-runtime-api', $version, $prettyVersion);
- $composerRuntimeApi->setDescription('The Composer Runtime API');
- $this->addPackage($composerRuntimeApi);
- try {
- $prettyVersion = $this->runtime->getConstant('PHP_VERSION');
- $version = $this->versionParser->normalize($prettyVersion);
- } catch (\UnexpectedValueException $e) {
- $prettyVersion = Preg::replace('#^([^~+-]+).*$#', '$1', $this->runtime->getConstant('PHP_VERSION'));
- $version = $this->versionParser->normalize($prettyVersion);
- }
- $php = new CompletePackage('php', $version, $prettyVersion);
- $php->setDescription('The PHP interpreter');
- $this->addPackage($php);
- if ($this->runtime->getConstant('PHP_DEBUG')) {
- $phpdebug = new CompletePackage('php-debug', $version, $prettyVersion);
- $phpdebug->setDescription('The PHP interpreter, with debugging symbols');
- $this->addPackage($phpdebug);
- }
- if ($this->runtime->hasConstant('PHP_ZTS') && $this->runtime->getConstant('PHP_ZTS')) {
- $phpzts = new CompletePackage('php-zts', $version, $prettyVersion);
- $phpzts->setDescription('The PHP interpreter, with Zend Thread Safety');
- $this->addPackage($phpzts);
- }
- if ($this->runtime->getConstant('PHP_INT_SIZE') === 8) {
- $php64 = new CompletePackage('php-64bit', $version, $prettyVersion);
- $php64->setDescription('The PHP interpreter, 64bit');
- $this->addPackage($php64);
- }
- if ($this->runtime->hasConstant('AF_INET6') || Silencer::call([$this->runtime, 'invoke'], 'inet_pton', ['::']) !== false) {
- $phpIpv6 = new CompletePackage('php-ipv6', $version, $prettyVersion);
- $phpIpv6->setDescription('The PHP interpreter, with IPv6 support');
- $this->addPackage($phpIpv6);
- }
- $loadedExtensions = $this->runtime->getExtensions();
- foreach ($loadedExtensions as $name) {
- if (in_array($name, ['standard', 'Core'])) {
- continue;
- }
- $this->addExtension($name, $this->runtime->getExtensionVersion($name));
- }
- if (!in_array('xdebug', $loadedExtensions, true) && ($prettyVersion = XdebugHandler::getSkippedVersion())) {
- $this->addExtension('xdebug', $prettyVersion);
- }
- foreach ($loadedExtensions as $name) {
- switch ($name) {
- case 'amqp':
- $info = $this->runtime->getExtensionInfo($name);
- if (Preg::isMatch('/^librabbitmq version => (?<version>.+)$/im', $info, $librabbitmqMatches)) {
- $this->addLibrary($name.'-librabbitmq', $librabbitmqMatches['version'], 'AMQP librabbitmq version');
- }
- if (Preg::isMatch('/^AMQP protocol version => (?<version>.+)$/im', $info, $protocolMatches)) {
- $this->addLibrary($name.'-protocol', str_replace('-', '.', $protocolMatches['version']), 'AMQP protocol version');
- }
- break;
- case 'bz2':
- $info = $this->runtime->getExtensionInfo($name);
- if (Preg::isMatch('/^BZip2 Version => (?<version>.*),/im', $info, $matches)) {
- $this->addLibrary($name, $matches['version']);
- }
- break;
- case 'curl':
- $curlVersion = $this->runtime->invoke('curl_version');
- $this->addLibrary($name, $curlVersion['version']);
- $info = $this->runtime->getExtensionInfo($name);
- if (Preg::isMatch('{^SSL Version => (?<library>[^/]+)/(?<version>.+)$}im', $info, $sslMatches)) {
- $library = strtolower($sslMatches['library']);
- if ($library === 'openssl') {
- $parsedVersion = Version::parseOpenssl($sslMatches['version'], $isFips);
- $this->addLibrary($name.'-openssl'.($isFips ? '-fips' : ''), $parsedVersion, 'curl OpenSSL version ('.$parsedVersion.')', [], $isFips ? ['curl-openssl'] : []);
- } else {
- $this->addLibrary($name.'-'.$library, $sslMatches['version'], 'curl '.$library.' version ('.$sslMatches['version'].')', ['curl-openssl']);
- }
- }
- if (Preg::isMatch('{^libSSH Version => (?<library>[^/]+)/(?<version>.+?)(?:/.*)?$}im', $info, $sshMatches)) {
- $this->addLibrary($name.'-'.strtolower($sshMatches['library']), $sshMatches['version'], 'curl '.$sshMatches['library'].' version');
- }
- if (Preg::isMatch('{^ZLib Version => (?<version>.+)$}im', $info, $zlibMatches)) {
- $this->addLibrary($name.'-zlib', $zlibMatches['version'], 'curl zlib version');
- }
- break;
- case 'date':
- $info = $this->runtime->getExtensionInfo($name);
- if (Preg::isMatch('/^timelib version => (?<version>.+)$/im', $info, $timelibMatches)) {
- $this->addLibrary($name.'-timelib', $timelibMatches['version'], 'date timelib version');
- }
- if (Preg::isMatch('/^Timezone Database => (?<source>internal|external)$/im', $info, $zoneinfoSourceMatches)) {
- $external = $zoneinfoSourceMatches['source'] === 'external';
- if (Preg::isMatch('/^"Olson" Timezone Database Version => (?<version>.+?)(\.system)?$/im', $info, $zoneinfoMatches)) {
- if ($external && in_array('timezonedb', $loadedExtensions, true)) {
- $this->addLibrary('timezonedb-zoneinfo', $zoneinfoMatches['version'], 'zoneinfo ("Olson") database for date (replaced by timezonedb)', [$name.'-zoneinfo']);
- } else {
- $this->addLibrary($name.'-zoneinfo', $zoneinfoMatches['version'], 'zoneinfo ("Olson") database for date');
- }
- }
- }
- break;
- case 'fileinfo':
- $info = $this->runtime->getExtensionInfo($name);
- if (Preg::isMatch('/^libmagic => (?<version>.+)$/im', $info, $magicMatches)) {
- $this->addLibrary($name.'-libmagic', $magicMatches['version'], 'fileinfo libmagic version');
- }
- break;
- case 'gd':
- $this->addLibrary($name, $this->runtime->getConstant('GD_VERSION'));
- $info = $this->runtime->getExtensionInfo($name);
- if (Preg::isMatch('/^libJPEG Version => (?<version>.+?)(?: compatible)?$/im', $info, $libjpegMatches)) {
- $this->addLibrary($name.'-libjpeg', Version::parseLibjpeg($libjpegMatches['version']), 'libjpeg version for gd');
- }
- if (Preg::isMatch('/^libPNG Version => (?<version>.+)$/im', $info, $libpngMatches)) {
- $this->addLibrary($name.'-libpng', $libpngMatches['version'], 'libpng version for gd');
- }
- if (Preg::isMatch('/^FreeType Version => (?<version>.+)$/im', $info, $freetypeMatches)) {
- $this->addLibrary($name.'-freetype', $freetypeMatches['version'], 'freetype version for gd');
- }
- if (Preg::isMatch('/^libXpm Version => (?<versionId>\d+)$/im', $info, $libxpmMatches)) {
- $this->addLibrary($name.'-libxpm', Version::convertLibxpmVersionId((int) $libxpmMatches['versionId']), 'libxpm version for gd');
- }
- break;
- case 'gmp':
- $this->addLibrary($name, $this->runtime->getConstant('GMP_VERSION'));
- break;
- case 'iconv':
- $this->addLibrary($name, $this->runtime->getConstant('ICONV_VERSION'));
- break;
- case 'intl':
- $info = $this->runtime->getExtensionInfo($name);
- $description = 'The ICU unicode and globalization support library';
- if ($this->runtime->hasConstant('INTL_ICU_VERSION')) {
- $this->addLibrary('icu', $this->runtime->getConstant('INTL_ICU_VERSION'), $description);
- } elseif (Preg::isMatch('/^ICU version => (?<version>.+)$/im', $info, $matches)) {
- $this->addLibrary('icu', $matches['version'], $description);
- }
- if (Preg::isMatch('/^ICU TZData version => (?<version>.*)$/im', $info, $zoneinfoMatches) && null !== ($version = Version::parseZoneinfoVersion($zoneinfoMatches['version']))) {
- $this->addLibrary('icu-zoneinfo', $version, 'zoneinfo ("Olson") database for icu');
- }
- if ($this->runtime->hasClass('ResourceBundle')) {
- $cldrVersion = $this->runtime->invoke(['ResourceBundle', 'create'], ['root', 'ICUDATA', false])->get('Version');
- $this->addLibrary('icu-cldr', $cldrVersion, 'ICU CLDR project version');
- }
- if ($this->runtime->hasClass('IntlChar')) {
- $this->addLibrary('icu-unicode', implode('.', array_slice($this->runtime->invoke(['IntlChar', 'getUnicodeVersion']), 0, 3)), 'ICU unicode version');
- }
- break;
- case 'imagick':
- $imageMagickVersion = $this->runtime->construct('Imagick')->getVersion();
- Preg::match('/^ImageMagick (?<version>[\d.]+)(?:-(?<patch>\d+))?/', $imageMagickVersion['versionString'], $matches);
- $version = $matches['version'];
- if (isset($matches['patch'])) {
- $version .= '.'.$matches['patch'];
- }
- $this->addLibrary($name.'-imagemagick', $version, null, ['imagick']);
- break;
- case 'ldap':
- $info = $this->runtime->getExtensionInfo($name);
- if (Preg::isMatch('/^Vendor Version => (?<versionId>\d+)$/im', $info, $matches) && Preg::isMatch('/^Vendor Name => (?<vendor>.+)$/im', $info, $vendorMatches)) {
- $this->addLibrary($name.'-'.strtolower($vendorMatches['vendor']), Version::convertOpenldapVersionId((int) $matches['versionId']), $vendorMatches['vendor'].' version of ldap');
- }
- break;
- case 'libxml':
- $libxmlProvides = array_map(static function ($extension): string {
- return $extension . '-libxml';
- }, array_intersect($loadedExtensions, ['dom', 'simplexml', 'xml', 'xmlreader', 'xmlwriter']));
- $this->addLibrary($name, $this->runtime->getConstant('LIBXML_DOTTED_VERSION'), 'libxml library version', [], $libxmlProvides);
- break;
- case 'mbstring':
- $info = $this->runtime->getExtensionInfo($name);
- if (Preg::isMatch('/^libmbfl version => (?<version>.+)$/im', $info, $libmbflMatches)) {
- $this->addLibrary($name.'-libmbfl', $libmbflMatches['version'], 'mbstring libmbfl version');
- }
- if ($this->runtime->hasConstant('MB_ONIGURUMA_VERSION')) {
- $this->addLibrary($name.'-oniguruma', $this->runtime->getConstant('MB_ONIGURUMA_VERSION'), 'mbstring oniguruma version');
- } elseif (Preg::isMatch('/^(?:oniguruma|Multibyte regex \(oniguruma\)) version => (?<version>.+)$/im', $info, $onigurumaMatches)) {
- $this->addLibrary($name.'-oniguruma', $onigurumaMatches['version'], 'mbstring oniguruma version');
- }
- break;
- case 'memcached':
- $info = $this->runtime->getExtensionInfo($name);
- if (Preg::isMatch('/^libmemcached version => (?<version>.+)$/im', $info, $matches)) {
- $this->addLibrary($name.'-libmemcached', $matches['version'], 'libmemcached version');
- }
- break;
- case 'openssl':
- if (Preg::isMatch('{^(?:OpenSSL|LibreSSL)?\s*(?<version>\S+)}i', $this->runtime->getConstant('OPENSSL_VERSION_TEXT'), $matches)) {
- $parsedVersion = Version::parseOpenssl($matches['version'], $isFips);
- $this->addLibrary($name.($isFips ? '-fips' : ''), $parsedVersion, $this->runtime->getConstant('OPENSSL_VERSION_TEXT'), [], $isFips ? [$name] : []);
- }
- break;
- case 'pcre':
- $this->addLibrary($name, Preg::replace('{^(\S+).*}', '$1', $this->runtime->getConstant('PCRE_VERSION')));
- $info = $this->runtime->getExtensionInfo($name);
- if (Preg::isMatch('/^PCRE Unicode Version => (?<version>.+)$/im', $info, $pcreUnicodeMatches)) {
- $this->addLibrary($name.'-unicode', $pcreUnicodeMatches['version'], 'PCRE Unicode version support');
- }
- break;
- case 'mysqlnd':
- case 'pdo_mysql':
- $info = $this->runtime->getExtensionInfo($name);
- if (Preg::isMatch('/^(?:Client API version|Version) => mysqlnd (?<version>.+?) /mi', $info, $matches)) {
- $this->addLibrary($name.'-mysqlnd', $matches['version'], 'mysqlnd library version for '.$name);
- }
- break;
- case 'mongodb':
- $info = $this->runtime->getExtensionInfo($name);
- if (Preg::isMatch('/^libmongoc bundled version => (?<version>.+)$/im', $info, $libmongocMatches)) {
- $this->addLibrary($name.'-libmongoc', $libmongocMatches['version'], 'libmongoc version of mongodb');
- }
- if (Preg::isMatch('/^libbson bundled version => (?<version>.+)$/im', $info, $libbsonMatches)) {
- $this->addLibrary($name.'-libbson', $libbsonMatches['version'], 'libbson version of mongodb');
- }
- break;
- case 'pgsql':
- case 'pdo_pgsql':
- $info = $this->runtime->getExtensionInfo($name);
- if (Preg::isMatch('/^PostgreSQL\(libpq\) Version => (?<version>.*)$/im', $info, $matches)) {
- $this->addLibrary($name.'-libpq', $matches['version'], 'libpq for '.$name);
- }
- break;
- case 'libsodium':
- case 'sodium':
- if ($this->runtime->hasConstant('SODIUM_LIBRARY_VERSION')) {
- $this->addLibrary('libsodium', $this->runtime->getConstant('SODIUM_LIBRARY_VERSION'));
- }
- break;
- case 'sqlite3':
- case 'pdo_sqlite':
- $info = $this->runtime->getExtensionInfo($name);
- if (Preg::isMatch('/^SQLite Library => (?<version>.+)$/im', $info, $matches)) {
- $this->addLibrary($name.'-sqlite', $matches['version']);
- }
- break;
- case 'ssh2':
- $info = $this->runtime->getExtensionInfo($name);
- if (Preg::isMatch('/^libssh2 version => (?<version>.+)$/im', $info, $matches)) {
- $this->addLibrary($name.'-libssh2', $matches['version']);
- }
- break;
- case 'xsl':
- $this->addLibrary('libxslt', $this->runtime->getConstant('LIBXSLT_DOTTED_VERSION'), null, ['xsl']);
- $info = $this->runtime->getExtensionInfo('xsl');
- if (Preg::isMatch('/^libxslt compiled against libxml Version => (?<version>.+)$/im', $info, $matches)) {
- $this->addLibrary('libxslt-libxml', $matches['version'], 'libxml version libxslt is compiled against');
- }
- break;
- case 'yaml':
- $info = $this->runtime->getExtensionInfo('yaml');
- if (Preg::isMatch('/^LibYAML Version => (?<version>.+)$/im', $info, $matches)) {
- $this->addLibrary($name.'-libyaml', $matches['version'], 'libyaml version of yaml');
- }
- break;
- case 'zip':
- if ($this->runtime->hasConstant('LIBZIP_VERSION', 'ZipArchive')) {
- $this->addLibrary($name.'-libzip', $this->runtime->getConstant('LIBZIP_VERSION', 'ZipArchive'), null, ['zip']);
- }
- break;
- case 'zlib':
- if ($this->runtime->hasConstant('ZLIB_VERSION')) {
- $this->addLibrary($name, $this->runtime->getConstant('ZLIB_VERSION'));
- } elseif (Preg::isMatch('/^Linked Version => (?<version>.+)$/im', $this->runtime->getExtensionInfo($name), $matches)) {
- $this->addLibrary($name, $matches['version']);
- }
- break;
- default:
- break;
- }
- }
- $hhvmVersion = $this->hhvmDetector->getVersion();
- if ($hhvmVersion) {
- try {
- $prettyVersion = $hhvmVersion;
- $version = $this->versionParser->normalize($prettyVersion);
- } catch (\UnexpectedValueException $e) {
- $prettyVersion = Preg::replace('#^([^~+-]+).*$#', '$1', $hhvmVersion);
- $version = $this->versionParser->normalize($prettyVersion);
- }
- $hhvm = new CompletePackage('hhvm', $version, $prettyVersion);
- $hhvm->setDescription('The HHVM Runtime (64bit)');
- $this->addPackage($hhvm);
- }
- }
- public function addPackage(PackageInterface $package): void
- {
- if (!$package instanceof CompletePackage) {
- throw new \UnexpectedValueException('Expected CompletePackage but got '.get_class($package));
- }
- if (isset($this->overrides[$package->getName()])) {
- if ($this->overrides[$package->getName()]['version'] === false) {
- $this->addDisabledPackage($package);
- return;
- }
- $overrider = $this->findPackage($package->getName(), '*');
- if ($package->getVersion() === $overrider->getVersion()) {
- $actualText = 'same as actual';
- } else {
- $actualText = 'actual: '.$package->getPrettyVersion();
- }
- if ($overrider instanceof CompletePackageInterface) {
- $overrider->setDescription($overrider->getDescription().', '.$actualText);
- }
- return;
- }
- if (isset($this->overrides['php']) && 0 === strpos($package->getName(), 'php-')) {
- $overrider = $this->addOverriddenPackage($this->overrides['php'], $package->getPrettyName());
- if ($package->getVersion() === $overrider->getVersion()) {
- $actualText = 'same as actual';
- } else {
- $actualText = 'actual: '.$package->getPrettyVersion();
- }
- $overrider->setDescription($overrider->getDescription().', '.$actualText);
- return;
- }
- parent::addPackage($package);
- }
- private function addOverriddenPackage(array $override, ?string $name = null): CompletePackage
- {
- $version = $this->versionParser->normalize($override['version']);
- $package = new CompletePackage($name ?: $override['name'], $version, $override['version']);
- $package->setDescription('Package overridden via config.platform');
- $package->setExtra(['config.platform' => true]);
- parent::addPackage($package);
- if ($package->getName() === 'php') {
- self::$lastSeenPlatformPhp = implode('.', array_slice(explode('.', $package->getVersion()), 0, 3));
- }
- return $package;
- }
- private function addDisabledPackage(CompletePackage $package): void
- {
- $package->setDescription($package->getDescription().'. <warning>Package disabled via config.platform</warning>');
- $package->setExtra(['config.platform' => true]);
- $this->disabledPackages[$package->getName()] = $package;
- }
- private function addExtension(string $name, string $prettyVersion): void
- {
- $extraDescription = null;
- try {
- $version = $this->versionParser->normalize($prettyVersion);
- } catch (\UnexpectedValueException $e) {
- $extraDescription = ' (actual version: '.$prettyVersion.')';
- if (Preg::isMatch('{^(\d+\.\d+\.\d+(?:\.\d+)?)}', $prettyVersion, $match)) {
- $prettyVersion = $match[1];
- } else {
- $prettyVersion = '0';
- }
- $version = $this->versionParser->normalize($prettyVersion);
- }
- $packageName = $this->buildPackageName($name);
- $ext = new CompletePackage($packageName, $version, $prettyVersion);
- $ext->setDescription('The '.$name.' PHP extension'.$extraDescription);
- if ($name === 'uuid') {
- $ext->setReplaces([
- 'lib-uuid' => new Link('ext-uuid', 'lib-uuid', new Constraint('=', $version), Link::TYPE_REPLACE, $ext->getPrettyVersion()),
- ]);
- }
- $this->addPackage($ext);
- }
- private function buildPackageName(string $name): string
- {
- return 'ext-' . str_replace(' ', '-', strtolower($name));
- }
- private function addLibrary(string $name, ?string $prettyVersion, ?string $description = null, array $replaces = [], array $provides = []): void
- {
- if (null === $prettyVersion) {
- return;
- }
- try {
- $version = $this->versionParser->normalize($prettyVersion);
- } catch (\UnexpectedValueException $e) {
- return;
- }
- if ($description === null) {
- $description = 'The '.$name.' library';
- }
- $lib = new CompletePackage('lib-'.$name, $version, $prettyVersion);
- $lib->setDescription($description);
- $replaceLinks = [];
- foreach ($replaces as $replace) {
- $replace = strtolower($replace);
- $replaceLinks[$replace] = new Link('lib-'.$name, 'lib-'.$replace, new Constraint('=', $version), Link::TYPE_REPLACE, $lib->getPrettyVersion());
- }
- $provideLinks = [];
- foreach ($provides as $provide) {
- $provide = strtolower($provide);
- $provideLinks[$provide] = new Link('lib-'.$name, 'lib-'.$provide, new Constraint('=', $version), Link::TYPE_PROVIDE, $lib->getPrettyVersion());
- }
- $lib->setReplaces($replaceLinks);
- $lib->setProvides($provideLinks);
- $this->addPackage($lib);
- }
- public static function isPlatformPackage(string $name): bool
- {
- static $cache = [];
- if (isset($cache[$name])) {
- return $cache[$name];
- }
- return $cache[$name] = Preg::isMatch(PlatformRepository::PLATFORM_PACKAGE_REGEX, $name);
- }
- public static function getPlatformPhpVersion(): ?string
- {
- return self::$lastSeenPlatformPhp;
- }
- public function search(string $query, int $mode = 0, ?string $type = null): array
- {
- if ($mode === self::SEARCH_VENDOR) {
- return [];
- }
- return parent::search($query, $mode, $type);
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Repository;
- use Composer\Factory;
- use Composer\IO\IOInterface;
- use Composer\Config;
- use Composer\EventDispatcher\EventDispatcher;
- use Composer\Pcre\Preg;
- use Composer\Util\HttpDownloader;
- use Composer\Util\ProcessExecutor;
- use Composer\Json\JsonFile;
- class RepositoryFactory
- {
- public static function configFromString(IOInterface $io, Config $config, string $repository, bool $allowFilesystem = false)
- {
- if (0 === strpos($repository, 'http')) {
- $repoConfig = ['type' => 'composer', 'url' => $repository];
- } elseif ("json" === pathinfo($repository, PATHINFO_EXTENSION)) {
- $json = new JsonFile($repository, Factory::createHttpDownloader($io, $config));
- $data = $json->read();
- if (!empty($data['packages']) || !empty($data['includes']) || !empty($data['provider-includes'])) {
- $repoConfig = ['type' => 'composer', 'url' => 'file://' . strtr(realpath($repository), '\\', '/')];
- } elseif ($allowFilesystem) {
- $repoConfig = ['type' => 'filesystem', 'json' => $json];
- } else {
- throw new \InvalidArgumentException("Invalid repository URL ($repository) given. This file does not contain a valid composer repository.");
- }
- } elseif (strpos($repository, '{') === 0) {
- $repoConfig = JsonFile::parseJson($repository);
- } else {
- throw new \InvalidArgumentException("Invalid repository url ($repository) given. Has to be a .json file, an http url or a JSON object.");
- }
- return $repoConfig;
- }
- public static function fromString(IOInterface $io, Config $config, string $repository, bool $allowFilesystem = false, ?RepositoryManager $rm = null): RepositoryInterface
- {
- $repoConfig = static::configFromString($io, $config, $repository, $allowFilesystem);
- return static::createRepo($io, $config, $repoConfig, $rm);
- }
- public static function createRepo(IOInterface $io, Config $config, array $repoConfig, ?RepositoryManager $rm = null): RepositoryInterface
- {
- if (!$rm) {
- @trigger_error('Not passing a repository manager when calling createRepo is deprecated since Composer 2.3.6', E_USER_DEPRECATED);
- $rm = static::manager($io, $config);
- }
- $repos = self::createRepos($rm, [$repoConfig]);
- return reset($repos);
- }
- public static function defaultRepos(?IOInterface $io = null, ?Config $config = null, ?RepositoryManager $rm = null): array
- {
- if (null === $rm) {
- @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);
- }
- if (null === $config) {
- $config = Factory::createConfig($io);
- }
- if (null !== $io) {
- $io->loadConfiguration($config);
- }
- if (null === $rm) {
- if (null === $io) {
- throw new \InvalidArgumentException('This function requires either an IOInterface or a RepositoryManager');
- }
- $rm = static::manager($io, $config, Factory::createHttpDownloader($io, $config));
- }
- return self::createRepos($rm, $config->getRepositories());
- }
- public static function manager(IOInterface $io, Config $config, ?HttpDownloader $httpDownloader = null, ?EventDispatcher $eventDispatcher = null, ?ProcessExecutor $process = null): RepositoryManager
- {
- if ($httpDownloader === null) {
- $httpDownloader = Factory::createHttpDownloader($io, $config);
- }
- if ($process === null) {
- $process = new ProcessExecutor($io);
- $process->enableAsync();
- }
- $rm = new RepositoryManager($io, $config, $httpDownloader, $eventDispatcher, $process);
- $rm->setRepositoryClass('composer', 'Composer\Repository\ComposerRepository');
- $rm->setRepositoryClass('vcs', 'Composer\Repository\VcsRepository');
- $rm->setRepositoryClass('package', 'Composer\Repository\PackageRepository');
- $rm->setRepositoryClass('pear', 'Composer\Repository\PearRepository');
- $rm->setRepositoryClass('git', 'Composer\Repository\VcsRepository');
- $rm->setRepositoryClass('bitbucket', 'Composer\Repository\VcsRepository');
- $rm->setRepositoryClass('git-bitbucket', 'Composer\Repository\VcsRepository');
- $rm->setRepositoryClass('github', 'Composer\Repository\VcsRepository');
- $rm->setRepositoryClass('gitlab', 'Composer\Repository\VcsRepository');
- $rm->setRepositoryClass('svn', 'Composer\Repository\VcsRepository');
- $rm->setRepositoryClass('fossil', 'Composer\Repository\VcsRepository');
- $rm->setRepositoryClass('perforce', 'Composer\Repository\VcsRepository');
- $rm->setRepositoryClass('hg', 'Composer\Repository\VcsRepository');
- $rm->setRepositoryClass('artifact', 'Composer\Repository\ArtifactRepository');
- $rm->setRepositoryClass('path', 'Composer\Repository\PathRepository');
- return $rm;
- }
- public static function defaultReposWithDefaultManager(IOInterface $io): array
- {
- $manager = RepositoryFactory::manager($io, $config = Factory::createConfig($io));
- $io->loadConfiguration($config);
- return RepositoryFactory::defaultRepos($io, $config, $manager);
- }
- private static function createRepos(RepositoryManager $rm, array $repoConfigs): array
- {
- $repos = [];
- foreach ($repoConfigs as $index => $repo) {
- if (is_string($repo)) {
- throw new \UnexpectedValueException('"repositories" should be an array of repository definitions, only a single repository was given');
- }
- if (!is_array($repo)) {
- throw new \UnexpectedValueException('Repository "'.$index.'" ('.json_encode($repo).') should be an array, '.gettype($repo).' given');
- }
- if (!isset($repo['type'])) {
- throw new \UnexpectedValueException('Repository "'.$index.'" ('.json_encode($repo).') must have a type defined');
- }
- $name = self::generateRepositoryName($index, $repo, $repos);
- if ($repo['type'] === 'filesystem') {
- $repos[$name] = new FilesystemRepository($repo['json']);
- } else {
- $repos[$name] = $rm->createRepository($repo['type'], $repo, (string) $index);
- }
- }
- return $repos;
- }
- public static function generateRepositoryName($index, array $repo, array $existingRepos): string
- {
- $name = is_int($index) && isset($repo['url']) ? Preg::replace('{^https?://}i', '', $repo['url']) : (string) $index;
- while (isset($existingRepos[$name])) {
- $name .= '2';
- }
- return $name;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Repository;
- use Composer\Package\PackageInterface;
- use Composer\Package\BasePackage;
- use Composer\Semver\Constraint\ConstraintInterface;
- interface RepositoryInterface extends \Countable
- {
- public const SEARCH_FULLTEXT = 0;
- public const SEARCH_NAME = 1;
- public const SEARCH_VENDOR = 2;
- public function hasPackage(PackageInterface $package);
- public function findPackage(string $name, $constraint);
- public function findPackages(string $name, $constraint = null);
- public function getPackages();
- public function loadPackages(array $packageNameMap, array $acceptableStabilities, array $stabilityFlags, array $alreadyLoaded = []);
- public function search(string $query, int $mode = 0, ?string $type = null);
- public function getProviders(string $packageName);
- public function getRepoName();
- }
- <?php declare(strict_types=1);
- namespace Composer\Repository;
- use Composer\IO\IOInterface;
- use Composer\Config;
- use Composer\EventDispatcher\EventDispatcher;
- use Composer\Package\PackageInterface;
- use Composer\Util\HttpDownloader;
- use Composer\Util\ProcessExecutor;
- class RepositoryManager
- {
- private $localRepository;
- private $repositories = [];
- private $repositoryClasses = [];
- private $io;
- private $config;
- private $httpDownloader;
- private $eventDispatcher;
- private $process;
- public function __construct(IOInterface $io, Config $config, HttpDownloader $httpDownloader, ?EventDispatcher $eventDispatcher = null, ?ProcessExecutor $process = null)
- {
- $this->io = $io;
- $this->config = $config;
- $this->httpDownloader = $httpDownloader;
- $this->eventDispatcher = $eventDispatcher;
- $this->process = $process ?? new ProcessExecutor($io);
- }
- public function findPackage(string $name, $constraint): ?PackageInterface
- {
- foreach ($this->repositories as $repository) {
- if ($package = $repository->findPackage($name, $constraint)) {
- return $package;
- }
- }
- return null;
- }
- public function findPackages(string $name, $constraint): array
- {
- $packages = [];
- foreach ($this->getRepositories() as $repository) {
- $packages = array_merge($packages, $repository->findPackages($name, $constraint));
- }
- return $packages;
- }
- public function addRepository(RepositoryInterface $repository): void
- {
- $this->repositories[] = $repository;
- }
- public function prependRepository(RepositoryInterface $repository): void
- {
- array_unshift($this->repositories, $repository);
- }
- public function createRepository(string $type, array $config, ?string $name = null): RepositoryInterface
- {
- if (!isset($this->repositoryClasses[$type])) {
- throw new \InvalidArgumentException('Repository type is not registered: '.$type);
- }
- if (isset($config['packagist']) && false === $config['packagist']) {
- $this->io->writeError('<warning>Repository "'.$name.'" ('.json_encode($config).') has a packagist key which should be in its own repository definition</warning>');
- }
- $class = $this->repositoryClasses[$type];
- if (isset($config['only']) || isset($config['exclude']) || isset($config['canonical'])) {
- $filterConfig = $config;
- unset($config['only'], $config['exclude'], $config['canonical']);
- }
- $repository = new $class($config, $this->io, $this->config, $this->httpDownloader, $this->eventDispatcher, $this->process);
- if (isset($filterConfig)) {
- $repository = new FilterRepository($repository, $filterConfig);
- }
- return $repository;
- }
- public function setRepositoryClass(string $type, $class): void
- {
- $this->repositoryClasses[$type] = $class;
- }
- public function getRepositories(): array
- {
- return $this->repositories;
- }
- public function setLocalRepository(InstalledRepositoryInterface $repository): void
- {
- $this->localRepository = $repository;
- }
- public function getLocalRepository(): InstalledRepositoryInterface
- {
- return $this->localRepository;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Repository;
- class RepositorySecurityException extends \Exception
- {
- }
- <?php declare(strict_types=1);
- namespace Composer\Repository;
- use Composer\DependencyResolver\PoolOptimizer;
- use Composer\DependencyResolver\Pool;
- use Composer\DependencyResolver\PoolBuilder;
- use Composer\DependencyResolver\Request;
- use Composer\EventDispatcher\EventDispatcher;
- use Composer\Advisory\SecurityAdvisory;
- use Composer\Advisory\PartialSecurityAdvisory;
- use Composer\IO\IOInterface;
- use Composer\IO\NullIO;
- use Composer\Package\BasePackage;
- use Composer\Package\AliasPackage;
- use Composer\Package\CompleteAliasPackage;
- use Composer\Package\CompletePackage;
- use Composer\Package\PackageInterface;
- use Composer\Semver\Constraint\Constraint;
- use Composer\Semver\Constraint\ConstraintInterface;
- use Composer\Package\Version\StabilityFilter;
- use Composer\Semver\Constraint\MatchAllConstraint;
- class RepositorySet
- {
- public const ALLOW_UNACCEPTABLE_STABILITIES = 1;
- public const ALLOW_SHADOWED_REPOSITORIES = 2;
- private $rootAliases;
- private $rootReferences;
- private $repositories = [];
- private $acceptableStabilities;
- private $stabilityFlags;
- private $rootRequires;
- private $temporaryConstraints;
- private $locked = false;
- private $allowInstalledRepositories = false;
- public function __construct(string $minimumStability = 'stable', array $stabilityFlags = [], array $rootAliases = [], array $rootReferences = [], array $rootRequires = [], array $temporaryConstraints = [])
- {
- $this->rootAliases = self::getRootAliasesPerPackage($rootAliases);
- $this->rootReferences = $rootReferences;
- $this->acceptableStabilities = [];
- foreach (BasePackage::$stabilities as $stability => $value) {
- if ($value <= BasePackage::$stabilities[$minimumStability]) {
- $this->acceptableStabilities[$stability] = $value;
- }
- }
- $this->stabilityFlags = $stabilityFlags;
- $this->rootRequires = $rootRequires;
- foreach ($rootRequires as $name => $constraint) {
- if (PlatformRepository::isPlatformPackage($name)) {
- unset($this->rootRequires[$name]);
- }
- }
- $this->temporaryConstraints = $temporaryConstraints;
- }
- public function allowInstalledRepositories(bool $allow = true): void
- {
- $this->allowInstalledRepositories = $allow;
- }
- public function getRootRequires(): array
- {
- return $this->rootRequires;
- }
- public function getTemporaryConstraints(): array
- {
- return $this->temporaryConstraints;
- }
- public function addRepository(RepositoryInterface $repo): void
- {
- if ($this->locked) {
- throw new \RuntimeException("Pool has already been created from this repository set, it cannot be modified anymore.");
- }
- if ($repo instanceof CompositeRepository) {
- $repos = $repo->getRepositories();
- } else {
- $repos = [$repo];
- }
- foreach ($repos as $repo) {
- $this->repositories[] = $repo;
- }
- }
- public function findPackages(string $name, ?ConstraintInterface $constraint = null, int $flags = 0): array
- {
- $ignoreStability = ($flags & self::ALLOW_UNACCEPTABLE_STABILITIES) !== 0;
- $loadFromAllRepos = ($flags & self::ALLOW_SHADOWED_REPOSITORIES) !== 0;
- $packages = [];
- if ($loadFromAllRepos) {
- foreach ($this->repositories as $repository) {
- $packages[] = $repository->findPackages($name, $constraint) ?: [];
- }
- } else {
- foreach ($this->repositories as $repository) {
- $result = $repository->loadPackages([$name => $constraint], $ignoreStability ? BasePackage::$stabilities : $this->acceptableStabilities, $ignoreStability ? [] : $this->stabilityFlags);
- $packages[] = $result['packages'];
- foreach ($result['namesFound'] as $nameFound) {
- if ($name === $nameFound) {
- break 2;
- }
- }
- }
- }
- $candidates = $packages ? array_merge(...$packages) : [];
- if ($ignoreStability || !$loadFromAllRepos) {
- return $candidates;
- }
- $result = [];
- foreach ($candidates as $candidate) {
- if ($this->isPackageAcceptable($candidate->getNames(), $candidate->getStability())) {
- $result[] = $candidate;
- }
- }
- return $result;
- }
- public function getSecurityAdvisories(array $packageNames, bool $allowPartialAdvisories = false): array
- {
- $map = [];
- foreach ($packageNames as $name) {
- $map[$name] = new MatchAllConstraint();
- }
- return $this->getSecurityAdvisoriesForConstraints($map, $allowPartialAdvisories);
- }
- public function getMatchingSecurityAdvisories(array $packages, bool $allowPartialAdvisories = false): array
- {
- $map = [];
- foreach ($packages as $package) {
- $map[$package->getName()] = new Constraint('=', $package->getVersion());
- }
- return $this->getSecurityAdvisoriesForConstraints($map, $allowPartialAdvisories);
- }
- private function getSecurityAdvisoriesForConstraints(array $packageConstraintMap, bool $allowPartialAdvisories): array
- {
- $advisories = [];
- foreach ($this->repositories as $repository) {
- if (!$repository instanceof AdvisoryProviderInterface || !$repository->hasSecurityAdvisories()) {
- continue;
- }
- $result = $repository->getSecurityAdvisories($packageConstraintMap, $allowPartialAdvisories);
- foreach ($result['namesFound'] as $nameFound) {
- unset($packageConstraintMap[$nameFound]);
- }
- $advisories = array_merge($advisories, $result['advisories']);
- }
- return $advisories;
- }
- public function getProviders(string $packageName): array
- {
- $providers = [];
- foreach ($this->repositories as $repository) {
- if ($repoProviders = $repository->getProviders($packageName)) {
- $providers = array_merge($providers, $repoProviders);
- }
- }
- return $providers;
- }
- public function isPackageAcceptable(array $names, string $stability): bool
- {
- return StabilityFilter::isPackageAcceptable($this->acceptableStabilities, $this->stabilityFlags, $names, $stability);
- }
- public function createPool(Request $request, IOInterface $io, ?EventDispatcher $eventDispatcher = null, ?PoolOptimizer $poolOptimizer = null): Pool
- {
- $poolBuilder = new PoolBuilder($this->acceptableStabilities, $this->stabilityFlags, $this->rootAliases, $this->rootReferences, $io, $eventDispatcher, $poolOptimizer, $this->temporaryConstraints);
- foreach ($this->repositories as $repo) {
- if (($repo instanceof InstalledRepositoryInterface || $repo instanceof InstalledRepository) && !$this->allowInstalledRepositories) {
- throw new \LogicException('The pool can not accept packages from an installed repository');
- }
- }
- $this->locked = true;
- return $poolBuilder->buildPool($this->repositories, $request);
- }
- public function createPoolWithAllPackages(): Pool
- {
- foreach ($this->repositories as $repo) {
- if (($repo instanceof InstalledRepositoryInterface || $repo instanceof InstalledRepository) && !$this->allowInstalledRepositories) {
- throw new \LogicException('The pool can not accept packages from an installed repository');
- }
- }
- $this->locked = true;
- $packages = [];
- foreach ($this->repositories as $repository) {
- foreach ($repository->getPackages() as $package) {
- $packages[] = $package;
- if (isset($this->rootAliases[$package->getName()][$package->getVersion()])) {
- $alias = $this->rootAliases[$package->getName()][$package->getVersion()];
- while ($package instanceof AliasPackage) {
- $package = $package->getAliasOf();
- }
- if ($package instanceof CompletePackage) {
- $aliasPackage = new CompleteAliasPackage($package, $alias['alias_normalized'], $alias['alias']);
- } else {
- $aliasPackage = new AliasPackage($package, $alias['alias_normalized'], $alias['alias']);
- }
- $aliasPackage->setRootPackageAlias(true);
- $packages[] = $aliasPackage;
- }
- }
- }
- return new Pool($packages);
- }
- public function createPoolForPackage(string $packageName, ?LockArrayRepository $lockedRepo = null): Pool
- {
- return $this->createPoolForPackages([$packageName], $lockedRepo);
- }
- public function createPoolForPackages(array $packageNames, ?LockArrayRepository $lockedRepo = null): Pool
- {
- $request = new Request($lockedRepo);
- foreach ($packageNames as $packageName) {
- if (PlatformRepository::isPlatformPackage($packageName)) {
- 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.');
- }
- $request->requireName($packageName);
- }
- return $this->createPool($request, new NullIO());
- }
- private static function getRootAliasesPerPackage(array $aliases): array
- {
- $normalizedAliases = [];
- foreach ($aliases as $alias) {
- $normalizedAliases[$alias['package']][$alias['version']] = [
- 'alias' => $alias['alias'],
- 'alias_normalized' => $alias['alias_normalized'],
- ];
- }
- return $normalizedAliases;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Repository;
- use Composer\Package\PackageInterface;
- class RepositoryUtils
- {
- public static function filterRequiredPackages(array $packages, PackageInterface $requirer, array $bucket = []): array
- {
- $requires = $requirer->getRequires();
- foreach ($packages as $candidate) {
- foreach ($candidate->getNames() as $name) {
- if (isset($requires[$name])) {
- if (!in_array($candidate, $bucket, true)) {
- $bucket[] = $candidate;
- $bucket = self::filterRequiredPackages($packages, $candidate, $bucket);
- }
- break;
- }
- }
- }
- return $bucket;
- }
- public static function flattenRepositories(RepositoryInterface $repo, bool $unwrapFilterRepos = true): array
- {
- if ($unwrapFilterRepos && $repo instanceof FilterRepository) {
- $repo = $repo->getRepository();
- }
- if (!$repo instanceof CompositeRepository) {
- return [$repo];
- }
- $repos = [];
- foreach ($repo->getRepositories() as $r) {
- foreach (self::flattenRepositories($r, $unwrapFilterRepos) as $r2) {
- $repos[] = $r2;
- }
- }
- return $repos;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Repository;
- use Composer\Package\RootPackageInterface;
- class RootPackageRepository extends ArrayRepository
- {
- public function __construct(RootPackageInterface $package)
- {
- parent::__construct([$package]);
- }
- public function getRepoName(): string
- {
- return 'root package repo';
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Repository\Vcs;
- use Composer\Cache;
- use Composer\Config;
- use Composer\Pcre\Preg;
- use Composer\Util\ProcessExecutor;
- use Composer\Util\Filesystem;
- use Composer\IO\IOInterface;
- class FossilDriver extends VcsDriver
- {
- protected $tags;
- protected $branches;
- protected $rootIdentifier = null;
- protected $repoFile = null;
- protected $checkoutDir;
- public function initialize(): void
- {
- $this->checkFossil();
- $this->config->prohibitUrlByConfig($this->url, $this->io);
- if (Filesystem::isLocalPath($this->url) && is_dir($this->url)) {
- $this->checkoutDir = $this->url;
- } else {
- if (!Cache::isUsable($this->config->get('cache-repo-dir')) || !Cache::isUsable($this->config->get('cache-vcs-dir'))) {
- throw new \RuntimeException('FossilDriver requires a usable cache directory, and it looks like you set it to be disabled');
- }
- $localName = Preg::replace('{[^a-z0-9]}i', '-', $this->url);
- $this->repoFile = $this->config->get('cache-repo-dir') . '/' . $localName . '.fossil';
- $this->checkoutDir = $this->config->get('cache-vcs-dir') . '/' . $localName . '/';
- $this->updateLocalRepo();
- }
- $this->getTags();
- $this->getBranches();
- }
- protected function checkFossil(): void
- {
- if (0 !== $this->process->execute('fossil version', $ignoredOutput)) {
- throw new \RuntimeException("fossil was not found, check that it is installed and in your PATH env.\n\n" . $this->process->getErrorOutput());
- }
- }
- protected function updateLocalRepo(): void
- {
- $fs = new Filesystem();
- $fs->ensureDirectoryExists($this->checkoutDir);
- if (!is_writable(dirname($this->checkoutDir))) {
- throw new \RuntimeException('Can not clone '.$this->url.' to access package information. The "'.$this->checkoutDir.'" directory is not writable by the current user.');
- }
- if (is_file($this->repoFile) && is_dir($this->checkoutDir) && 0 === $this->process->execute('fossil info', $output, $this->checkoutDir)) {
- if (0 !== $this->process->execute('fossil pull', $output, $this->checkoutDir)) {
- $this->io->writeError('<error>Failed to update '.$this->url.', package information from this repository may be outdated ('.$this->process->getErrorOutput().')</error>');
- }
- } else {
- $fs->removeDirectory($this->checkoutDir);
- $fs->remove($this->repoFile);
- $fs->ensureDirectoryExists($this->checkoutDir);
- if (0 !== $this->process->execute(sprintf('fossil clone -- %s %s', ProcessExecutor::escape($this->url), ProcessExecutor::escape($this->repoFile)), $output)) {
- $output = $this->process->getErrorOutput();
- throw new \RuntimeException('Failed to clone '.$this->url.' to repository ' . $this->repoFile . "\n\n" .$output);
- }
- if (0 !== $this->process->execute(sprintf('fossil open --nested -- %s', ProcessExecutor::escape($this->repoFile)), $output, $this->checkoutDir)) {
- $output = $this->process->getErrorOutput();
- throw new \RuntimeException('Failed to open repository '.$this->repoFile.' in ' . $this->checkoutDir . "\n\n" .$output);
- }
- }
- }
- public function getRootIdentifier(): string
- {
- if (null === $this->rootIdentifier) {
- $this->rootIdentifier = 'trunk';
- }
- return $this->rootIdentifier;
- }
- public function getUrl(): string
- {
- return $this->url;
- }
- public function getSource(string $identifier): array
- {
- return ['type' => 'fossil', 'url' => $this->getUrl(), 'reference' => $identifier];
- }
- public function getDist(string $identifier): ?array
- {
- return null;
- }
- public function getFileContent(string $file, string $identifier): ?string
- {
- $command = sprintf('fossil cat -r %s -- %s', ProcessExecutor::escape($identifier), ProcessExecutor::escape($file));
- $this->process->execute($command, $content, $this->checkoutDir);
- if (!trim($content)) {
- return null;
- }
- return $content;
- }
- public function getChangeDate(string $identifier): ?\DateTimeImmutable
- {
- $this->process->execute('fossil finfo -b -n 1 composer.json', $output, $this->checkoutDir);
- [, $date] = explode(' ', trim($output), 3);
- return new \DateTimeImmutable($date, new \DateTimeZone('UTC'));
- }
- public function getTags(): array
- {
- if (null === $this->tags) {
- $tags = [];
- $this->process->execute('fossil tag list', $output, $this->checkoutDir);
- foreach ($this->process->splitLines($output) as $tag) {
- $tags[$tag] = $tag;
- }
- $this->tags = $tags;
- }
- return $this->tags;
- }
- public function getBranches(): array
- {
- if (null === $this->branches) {
- $branches = [];
- $this->process->execute('fossil branch list', $output, $this->checkoutDir);
- foreach ($this->process->splitLines($output) as $branch) {
- $branch = trim(Preg::replace('/^\*/', '', trim($branch)));
- $branches[$branch] = $branch;
- }
- $this->branches = $branches;
- }
- return $this->branches;
- }
- public static function supports(IOInterface $io, Config $config, string $url, bool $deep = false): bool
- {
- if (Preg::isMatch('#(^(?:https?|ssh)://(?:[^@]@)?(?:chiselapp\.com|fossil\.))#i', $url)) {
- return true;
- }
- if (Preg::isMatch('!/fossil/|\.fossil!', $url)) {
- return true;
- }
- if (Filesystem::isLocalPath($url)) {
- $url = Filesystem::getPlatformPath($url);
- if (!is_dir($url)) {
- return false;
- }
- $process = new ProcessExecutor($io);
- if ($process->execute('fossil info', $output, $url) === 0) {
- return true;
- }
- }
- return false;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Repository\Vcs;
- use Composer\Config;
- use Composer\IO\IOInterface;
- use Composer\Cache;
- use Composer\Downloader\TransportException;
- use Composer\Json\JsonFile;
- use Composer\Pcre\Preg;
- use Composer\Util\Bitbucket;
- use Composer\Util\Http\Response;
- class GitBitbucketDriver extends VcsDriver
- {
- protected $owner;
- protected $repository;
- private $hasIssues = false;
- private $rootIdentifier;
- private $tags;
- private $branches;
- private $branchesUrl = '';
- private $tagsUrl = '';
- private $homeUrl = '';
- private $website = '';
- private $cloneHttpsUrl = '';
- private $repoData;
- protected $fallbackDriver = null;
- private $vcsType;
- public function initialize(): void
- {
- if (!Preg::isMatch('#^https?://bitbucket\.org/([^/]+)/([^/]+?)(\.git|/?)?$#i', $this->url, $match)) {
- throw new \InvalidArgumentException(sprintf('The Bitbucket repository URL %s is invalid. It must be the HTTPS URL of a Bitbucket repository.', $this->url));
- }
- $this->owner = $match[1];
- $this->repository = $match[2];
- $this->originUrl = 'bitbucket.org';
- $this->cache = new Cache(
- $this->io,
- implode('/', [
- $this->config->get('cache-repo-dir'),
- $this->originUrl,
- $this->owner,
- $this->repository,
- ])
- );
- $this->cache->setReadOnly($this->config->get('cache-read-only'));
- }
- public function getUrl(): string
- {
- if ($this->fallbackDriver) {
- return $this->fallbackDriver->getUrl();
- }
- return $this->cloneHttpsUrl;
- }
- protected function getRepoData(): bool
- {
- $resource = sprintf(
- 'https://api.bitbucket.org/2.0/repositories/%s/%s?%s',
- $this->owner,
- $this->repository,
- http_build_query(
- ['fields' => '-project,-owner'],
- '',
- '&'
- )
- );
- $repoData = $this->fetchWithOAuthCredentials($resource, true)->decodeJson();
- if ($this->fallbackDriver) {
- return false;
- }
- $this->parseCloneUrls($repoData['links']['clone']);
- $this->hasIssues = !empty($repoData['has_issues']);
- $this->branchesUrl = $repoData['links']['branches']['href'];
- $this->tagsUrl = $repoData['links']['tags']['href'];
- $this->homeUrl = $repoData['links']['html']['href'];
- $this->website = $repoData['website'];
- $this->vcsType = $repoData['scm'];
- $this->repoData = $repoData;
- return true;
- }
- public function getComposerInformation(string $identifier): ?array
- {
- if ($this->fallbackDriver) {
- return $this->fallbackDriver->getComposerInformation($identifier);
- }
- if (!isset($this->infoCache[$identifier])) {
- if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier)) {
- $composer = JsonFile::parseJson($res);
- } else {
- $composer = $this->getBaseComposerInformation($identifier);
- if ($this->shouldCache($identifier)) {
- $this->cache->write($identifier, json_encode($composer));
- }
- }
- if ($composer !== null) {
- if (!isset($composer['support']['source'])) {
- $label = array_search(
- $identifier,
- $this->getTags()
- ) ?: array_search(
- $identifier,
- $this->getBranches()
- ) ?: $identifier;
- if (array_key_exists($label, $tags = $this->getTags())) {
- $hash = $tags[$label];
- } elseif (array_key_exists($label, $branches = $this->getBranches())) {
- $hash = $branches[$label];
- }
- if (!isset($hash)) {
- $composer['support']['source'] = sprintf(
- 'https://%s/%s/%s/src',
- $this->originUrl,
- $this->owner,
- $this->repository
- );
- } else {
- $composer['support']['source'] = sprintf(
- 'https://%s/%s/%s/src/%s/?at=%s',
- $this->originUrl,
- $this->owner,
- $this->repository,
- $hash,
- $label
- );
- }
- }
- if (!isset($composer['support']['issues']) && $this->hasIssues) {
- $composer['support']['issues'] = sprintf(
- 'https://%s/%s/%s/issues',
- $this->originUrl,
- $this->owner,
- $this->repository
- );
- }
- if (!isset($composer['homepage'])) {
- $composer['homepage'] = empty($this->website) ? $this->homeUrl : $this->website;
- }
- }
- $this->infoCache[$identifier] = $composer;
- }
- return $this->infoCache[$identifier];
- }
- public function getFileContent(string $file, string $identifier): ?string
- {
- if ($this->fallbackDriver) {
- return $this->fallbackDriver->getFileContent($file, $identifier);
- }
- if (strpos($identifier, '/') !== false) {
- $branches = $this->getBranches();
- if (isset($branches[$identifier])) {
- $identifier = $branches[$identifier];
- }
- }
- $resource = sprintf(
- 'https://api.bitbucket.org/2.0/repositories/%s/%s/src/%s/%s',
- $this->owner,
- $this->repository,
- $identifier,
- $file
- );
- return $this->fetchWithOAuthCredentials($resource)->getBody();
- }
- public function getChangeDate(string $identifier): ?\DateTimeImmutable
- {
- if ($this->fallbackDriver) {
- return $this->fallbackDriver->getChangeDate($identifier);
- }
- if (strpos($identifier, '/') !== false) {
- $branches = $this->getBranches();
- if (isset($branches[$identifier])) {
- $identifier = $branches[$identifier];
- }
- }
- $resource = sprintf(
- 'https://api.bitbucket.org/2.0/repositories/%s/%s/commit/%s?fields=date',
- $this->owner,
- $this->repository,
- $identifier
- );
- $commit = $this->fetchWithOAuthCredentials($resource)->decodeJson();
- return new \DateTimeImmutable($commit['date']);
- }
- public function getSource(string $identifier): array
- {
- if ($this->fallbackDriver) {
- return $this->fallbackDriver->getSource($identifier);
- }
- return ['type' => $this->vcsType, 'url' => $this->getUrl(), 'reference' => $identifier];
- }
- public function getDist(string $identifier): ?array
- {
- if ($this->fallbackDriver) {
- return $this->fallbackDriver->getDist($identifier);
- }
- $url = sprintf(
- 'https://bitbucket.org/%s/%s/get/%s.zip',
- $this->owner,
- $this->repository,
- $identifier
- );
- return ['type' => 'zip', 'url' => $url, 'reference' => $identifier, 'shasum' => ''];
- }
- public function getTags(): array
- {
- if ($this->fallbackDriver) {
- return $this->fallbackDriver->getTags();
- }
- if (null === $this->tags) {
- $tags = [];
- $resource = sprintf(
- '%s?%s',
- $this->tagsUrl,
- http_build_query(
- [
- 'pagelen' => 100,
- 'fields' => 'values.name,values.target.hash,next',
- 'sort' => '-target.date',
- ],
- '',
- '&'
- )
- );
- $hasNext = true;
- while ($hasNext) {
- $tagsData = $this->fetchWithOAuthCredentials($resource)->decodeJson();
- foreach ($tagsData['values'] as $data) {
- $tags[$data['name']] = $data['target']['hash'];
- }
- if (empty($tagsData['next'])) {
- $hasNext = false;
- } else {
- $resource = $tagsData['next'];
- }
- }
- $this->tags = $tags;
- }
- return $this->tags;
- }
- public function getBranches(): array
- {
- if ($this->fallbackDriver) {
- return $this->fallbackDriver->getBranches();
- }
- if (null === $this->branches) {
- $branches = [];
- $resource = sprintf(
- '%s?%s',
- $this->branchesUrl,
- http_build_query(
- [
- 'pagelen' => 100,
- 'fields' => 'values.name,values.target.hash,values.heads,next',
- 'sort' => '-target.date',
- ],
- '',
- '&'
- )
- );
- $hasNext = true;
- while ($hasNext) {
- $branchData = $this->fetchWithOAuthCredentials($resource)->decodeJson();
- foreach ($branchData['values'] as $data) {
- $branches[$data['name']] = $data['target']['hash'];
- }
- if (empty($branchData['next'])) {
- $hasNext = false;
- } else {
- $resource = $branchData['next'];
- }
- }
- $this->branches = $branches;
- }
- return $this->branches;
- }
- protected function fetchWithOAuthCredentials(string $url, bool $fetchingRepoData = false): Response
- {
- try {
- return parent::getContents($url);
- } catch (TransportException $e) {
- $bitbucketUtil = new Bitbucket($this->io, $this->config, $this->process, $this->httpDownloader);
- if (in_array($e->getCode(), [403, 404], true) || (401 === $e->getCode() && strpos($e->getMessage(), 'Could not authenticate against') === 0)) {
- if (!$this->io->hasAuthentication($this->originUrl)
- && $bitbucketUtil->authorizeOAuth($this->originUrl)
- ) {
- return parent::getContents($url);
- }
- if (!$this->io->isInteractive() && $fetchingRepoData) {
- $this->attemptCloneFallback();
- return new Response(['url' => 'dummy'], 200, [], 'null');
- }
- }
- throw $e;
- }
- }
- protected function generateSshUrl(): string
- {
- return 'git@' . $this->originUrl . ':' . $this->owner.'/'.$this->repository.'.git';
- }
- protected function attemptCloneFallback(): bool
- {
- try {
- $this->setupFallbackDriver($this->generateSshUrl());
- return true;
- } catch (\RuntimeException $e) {
- $this->fallbackDriver = null;
- $this->io->writeError(
- '<error>Failed to clone the ' . $this->generateSshUrl() . ' repository, try running in interactive mode'
- . ' so that you can enter your Bitbucket OAuth consumer credentials</error>'
- );
- throw $e;
- }
- }
- protected function setupFallbackDriver(string $url): void
- {
- $this->fallbackDriver = new GitDriver(
- ['url' => $url],
- $this->io,
- $this->config,
- $this->httpDownloader,
- $this->process
- );
- $this->fallbackDriver->initialize();
- }
- protected function parseCloneUrls(array $cloneLinks): void
- {
- foreach ($cloneLinks as $cloneLink) {
- if ($cloneLink['name'] === 'https') {
- $this->cloneHttpsUrl = Preg::replace('/https:\/\/([^@]+@)?/', 'https://', $cloneLink['href']);
- }
- }
- }
- public function getRootIdentifier(): string
- {
- if ($this->fallbackDriver) {
- return $this->fallbackDriver->getRootIdentifier();
- }
- if (null === $this->rootIdentifier) {
- if (!$this->getRepoData()) {
- if (!$this->fallbackDriver) {
- throw new \LogicException('A fallback driver should be setup if getRepoData returns false');
- }
- return $this->fallbackDriver->getRootIdentifier();
- }
- if ($this->vcsType !== 'git') {
- throw new \RuntimeException(
- $this->url.' does not appear to be a git repository, use '.
- $this->cloneHttpsUrl.' but remember that Bitbucket no longer supports the mercurial repositories. '.
- 'https://bitbucket.org/blog/sunsetting-mercurial-support-in-bitbucket'
- );
- }
- $this->rootIdentifier = $this->repoData['mainbranch']['name'] ?? 'master';
- }
- return $this->rootIdentifier;
- }
- public static function supports(IOInterface $io, Config $config, string $url, bool $deep = false): bool
- {
- if (!Preg::isMatch('#^https?://bitbucket\.org/([^/]+)/([^/]+?)(\.git|/?)?$#i', $url)) {
- return false;
- }
- if (!extension_loaded('openssl')) {
- $io->writeError('Skipping Bitbucket git driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
- return false;
- }
- return true;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Repository\Vcs;
- use Composer\Pcre\Preg;
- use Composer\Util\ProcessExecutor;
- use Composer\Util\Filesystem;
- use Composer\Util\Url;
- use Composer\Util\Git as GitUtil;
- use Composer\IO\IOInterface;
- use Composer\Cache;
- use Composer\Config;
- class GitDriver extends VcsDriver
- {
- protected $tags;
- protected $branches;
- protected $rootIdentifier;
- protected $repoDir;
- public function initialize(): void
- {
- if (Filesystem::isLocalPath($this->url)) {
- $this->url = Preg::replace('{[\\/]\.git/?$}', '', $this->url);
- if (!is_dir($this->url)) {
- throw new \RuntimeException('Failed to read package information from '.$this->url.' as the path does not exist');
- }
- $this->repoDir = $this->url;
- $cacheUrl = realpath($this->url);
- } else {
- if (!Cache::isUsable($this->config->get('cache-vcs-dir'))) {
- throw new \RuntimeException('GitDriver requires a usable cache directory, and it looks like you set it to be disabled');
- }
- $this->repoDir = $this->config->get('cache-vcs-dir') . '/' . Preg::replace('{[^a-z0-9.]}i', '-', $this->url) . '/';
- GitUtil::cleanEnv();
- $fs = new Filesystem();
- $fs->ensureDirectoryExists(dirname($this->repoDir));
- if (!is_writable(dirname($this->repoDir))) {
- throw new \RuntimeException('Can not clone '.$this->url.' to access package information. The "'.dirname($this->repoDir).'" directory is not writable by the current user.');
- }
- if (Preg::isMatch('{^ssh://[^@]+@[^:]+:[^0-9]+}', $this->url)) {
- 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.');
- }
- $gitUtil = new GitUtil($this->io, $this->config, $this->process, $fs);
- if (!$gitUtil->syncMirror($this->url, $this->repoDir)) {
- if (!is_dir($this->repoDir)) {
- throw new \RuntimeException('Failed to clone '.$this->url.' to read package information from it');
- }
- $this->io->writeError('<error>Failed to update '.$this->url.', package information from this repository may be outdated</error>');
- }
- $cacheUrl = $this->url;
- }
- $this->getTags();
- $this->getBranches();
- $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.Preg::replace('{[^a-z0-9.]}i', '-', Url::sanitize($cacheUrl)));
- $this->cache->setReadOnly($this->config->get('cache-read-only'));
- }
- public function getRootIdentifier(): string
- {
- if (null === $this->rootIdentifier) {
- $this->rootIdentifier = 'master';
- $gitUtil = new GitUtil($this->io, $this->config, $this->process, new Filesystem());
- if (!Filesystem::isLocalPath($this->url)) {
- $defaultBranch = $gitUtil->getMirrorDefaultBranch($this->url, $this->repoDir, false);
- if ($defaultBranch !== null) {
- return $this->rootIdentifier = $defaultBranch;
- }
- }
- $this->process->execute('git branch --no-color', $output, $this->repoDir);
- $branches = $this->process->splitLines($output);
- if (!in_array('* master', $branches)) {
- foreach ($branches as $branch) {
- if ($branch && Preg::isMatch('{^\* +(\S+)}', $branch, $match)) {
- $this->rootIdentifier = $match[1];
- break;
- }
- }
- }
- }
- return $this->rootIdentifier;
- }
- public function getUrl(): string
- {
- return $this->url;
- }
- public function getSource(string $identifier): array
- {
- return ['type' => 'git', 'url' => $this->getUrl(), 'reference' => $identifier];
- }
- public function getDist(string $identifier): ?array
- {
- return null;
- }
- public function getFileContent(string $file, string $identifier): ?string
- {
- if (isset($identifier[0]) && $identifier[0] === '-') {
- throw new \RuntimeException('Invalid git identifier detected. Identifier must not start with a -, given: ' . $identifier);
- }
- $resource = sprintf('%s:%s', ProcessExecutor::escape($identifier), ProcessExecutor::escape($file));
- $this->process->execute(sprintf('git show %s', $resource), $content, $this->repoDir);
- if (!trim($content)) {
- return null;
- }
- return $content;
- }
- public function getChangeDate(string $identifier): ?\DateTimeImmutable
- {
- $this->process->execute(sprintf(
- 'git -c log.showSignature=false log -1 --format=%%at %s',
- ProcessExecutor::escape($identifier)
- ), $output, $this->repoDir);
- return new \DateTimeImmutable('@'.trim($output), new \DateTimeZone('UTC'));
- }
- public function getTags(): array
- {
- if (null === $this->tags) {
- $this->tags = [];
- $this->process->execute('git show-ref --tags --dereference', $output, $this->repoDir);
- foreach ($output = $this->process->splitLines($output) as $tag) {
- if ($tag && Preg::isMatch('{^([a-f0-9]{40}) refs/tags/(\S+?)(\^\{\})?$}', $tag, $match)) {
- $this->tags[$match[2]] = (string) $match[1];
- }
- }
- }
- return $this->tags;
- }
- public function getBranches(): array
- {
- if (null === $this->branches) {
- $branches = [];
- $this->process->execute('git branch --no-color --no-abbrev -v', $output, $this->repoDir);
- foreach ($this->process->splitLines($output) as $branch) {
- if ($branch && !Preg::isMatch('{^ *[^/]+/HEAD }', $branch)) {
- if (Preg::isMatch('{^(?:\* )? *(\S+) *([a-f0-9]+)(?: .*)?$}', $branch, $match) && $match[1][0] !== '-') {
- $branches[$match[1]] = $match[2];
- }
- }
- }
- $this->branches = $branches;
- }
- return $this->branches;
- }
- public static function supports(IOInterface $io, Config $config, string $url, bool $deep = false): bool
- {
- if (Preg::isMatch('#(^git://|\.git/?$|git(?:olite)?@|//git\.|//github.com/)#i', $url)) {
- return true;
- }
- if (Filesystem::isLocalPath($url)) {
- $url = Filesystem::getPlatformPath($url);
- if (!is_dir($url)) {
- return false;
- }
- $process = new ProcessExecutor($io);
- if ($process->execute('git tag', $output, $url) === 0) {
- return true;
- }
- }
- if (!$deep) {
- return false;
- }
- $gitUtil = new GitUtil($io, $config, new ProcessExecutor($io), new Filesystem());
- GitUtil::cleanEnv();
- try {
- $gitUtil->runCommand(static function ($url): string {
- return 'git ls-remote --heads -- ' . ProcessExecutor::escape($url);
- }, $url, sys_get_temp_dir());
- } catch (\RuntimeException $e) {
- return false;
- }
- return true;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Repository\Vcs;
- use Composer\Config;
- use Composer\Downloader\TransportException;
- use Composer\Json\JsonFile;
- use Composer\Cache;
- use Composer\IO\IOInterface;
- use Composer\Pcre\Preg;
- use Composer\Util\GitHub;
- use Composer\Util\Http\Response;
- class GitHubDriver extends VcsDriver
- {
- protected $owner;
- protected $repository;
- protected $tags;
- protected $branches;
- protected $rootIdentifier;
- protected $repoData;
- protected $hasIssues = false;
- protected $isPrivate = false;
- private $isArchived = false;
- private $fundingInfo;
- protected $gitDriver = null;
- public function initialize(): void
- {
- if (!Preg::isMatch('#^(?:(?:https?|git)://([^/]+)/|git@([^:]+):/?)([^/]+)/([^/]+?)(?:\.git|/)?$#', $this->url, $match)) {
- throw new \InvalidArgumentException(sprintf('The GitHub repository URL %s is invalid.', $this->url));
- }
- $this->owner = $match[3];
- $this->repository = $match[4];
- $this->originUrl = strtolower(!empty($match[1]) ? $match[1] : $match[2]);
- if ($this->originUrl === 'www.github.com') {
- $this->originUrl = 'github.com';
- }
- $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.$this->originUrl.'/'.$this->owner.'/'.$this->repository);
- $this->cache->setReadOnly($this->config->get('cache-read-only'));
- if ($this->config->get('use-github-api') === false || (isset($this->repoConfig['no-api']) && $this->repoConfig['no-api'])) {
- $this->setupGitDriver($this->url);
- return;
- }
- $this->fetchRootIdentifier();
- }
- public function getRepositoryUrl(): string
- {
- return 'https://'.$this->originUrl.'/'.$this->owner.'/'.$this->repository;
- }
- public function getRootIdentifier(): string
- {
- if ($this->gitDriver) {
- return $this->gitDriver->getRootIdentifier();
- }
- return $this->rootIdentifier;
- }
- public function getUrl(): string
- {
- if ($this->gitDriver) {
- return $this->gitDriver->getUrl();
- }
- return 'https://' . $this->originUrl . '/'.$this->owner.'/'.$this->repository.'.git';
- }
- protected function getApiUrl(): string
- {
- if ('github.com' === $this->originUrl) {
- $apiUrl = 'api.github.com';
- } else {
- $apiUrl = $this->originUrl . '/api/v3';
- }
- return 'https://' . $apiUrl;
- }
- public function getSource(string $identifier): array
- {
- if ($this->gitDriver) {
- return $this->gitDriver->getSource($identifier);
- }
- if ($this->isPrivate) {
- $url = $this->generateSshUrl();
- } else {
- $url = $this->getUrl();
- }
- return ['type' => 'git', 'url' => $url, 'reference' => $identifier];
- }
- public function getDist(string $identifier): ?array
- {
- $url = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/zipball/'.$identifier;
- return ['type' => 'zip', 'url' => $url, 'reference' => $identifier, 'shasum' => ''];
- }
- public function getComposerInformation(string $identifier): ?array
- {
- if ($this->gitDriver) {
- return $this->gitDriver->getComposerInformation($identifier);
- }
- if (!isset($this->infoCache[$identifier])) {
- if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier)) {
- $composer = JsonFile::parseJson($res);
- } else {
- $composer = $this->getBaseComposerInformation($identifier);
- if ($this->shouldCache($identifier)) {
- $this->cache->write($identifier, json_encode($composer));
- }
- }
- if ($composer !== null) {
- if (!isset($composer['support']['source'])) {
- $label = array_search($identifier, $this->getTags()) ?: array_search($identifier, $this->getBranches()) ?: $identifier;
- $composer['support']['source'] = sprintf('https://%s/%s/%s/tree/%s', $this->originUrl, $this->owner, $this->repository, $label);
- }
- if (!isset($composer['support']['issues']) && $this->hasIssues) {
- $composer['support']['issues'] = sprintf('https://%s/%s/%s/issues', $this->originUrl, $this->owner, $this->repository);
- }
- if (!isset($composer['abandoned']) && $this->isArchived) {
- $composer['abandoned'] = true;
- }
- if (!isset($composer['funding']) && $funding = $this->getFundingInfo()) {
- $composer['funding'] = $funding;
- }
- }
- $this->infoCache[$identifier] = $composer;
- }
- return $this->infoCache[$identifier];
- }
- private function getFundingInfo()
- {
- if (null !== $this->fundingInfo) {
- return $this->fundingInfo;
- }
- if ($this->originUrl !== 'github.com') {
- return $this->fundingInfo = false;
- }
- foreach ([$this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/contents/.github/FUNDING.yml', $this->getApiUrl() . '/repos/'.$this->owner.'/.github/contents/FUNDING.yml'] as $file) {
- try {
- $response = $this->httpDownloader->get($file, [
- 'retry-auth-failure' => false,
- ])->decodeJson();
- } catch (TransportException $e) {
- continue;
- }
- if (empty($response['content']) || $response['encoding'] !== 'base64' || !($funding = base64_decode($response['content']))) {
- continue;
- }
- break;
- }
- if (empty($funding)) {
- return $this->fundingInfo = false;
- }
- $result = [];
- $key = null;
- foreach (Preg::split('{\r?\n}', $funding) as $line) {
- $line = trim($line);
- if (Preg::isMatch('{^(\w+)\s*:\s*(.+)$}', $line, $match)) {
- if ($match[2] === '[') {
- $key = $match[1];
- continue;
- }
- if (Preg::isMatch('{^\[(.*)\](?:\s*#.*)?$}', $match[2], $match2)) {
- foreach (array_map('trim', Preg::split('{[\'"]?\s*,\s*[\'"]?}', $match2[1])) as $item) {
- $result[] = ['type' => $match[1], 'url' => trim($item, '"\' ')];
- }
- } elseif (Preg::isMatch('{^([^#].*?)(\s+#.*)?$}', $match[2], $match2)) {
- $result[] = ['type' => $match[1], 'url' => trim($match2[1], '"\' ')];
- }
- $key = null;
- } elseif (Preg::isMatch('{^(\w+)\s*:\s*#\s*$}', $line, $match)) {
- $key = $match[1];
- } elseif ($key && (
- Preg::isMatch('{^-\s*(.+)(\s+#.*)?$}', $line, $match)
- || Preg::isMatch('{^(.+),(\s*#.*)?$}', $line, $match)
- )) {
- $result[] = ['type' => $key, 'url' => trim($match[1], '"\' ')];
- } elseif ($key && $line === ']') {
- $key = null;
- }
- }
- foreach ($result as $key => $item) {
- switch ($item['type']) {
- case 'tidelift':
- $result[$key]['url'] = 'https://tidelift.com/funding/github/' . $item['url'];
- break;
- case 'github':
- $result[$key]['url'] = 'https://github.com/' . basename($item['url']);
- break;
- case 'patreon':
- $result[$key]['url'] = 'https://www.patreon.com/' . basename($item['url']);
- break;
- case 'otechie':
- $result[$key]['url'] = 'https://otechie.com/' . basename($item['url']);
- break;
- case 'open_collective':
- $result[$key]['url'] = 'https://opencollective.com/' . basename($item['url']);
- break;
- case 'liberapay':
- $result[$key]['url'] = 'https://liberapay.com/' . basename($item['url']);
- break;
- case 'ko_fi':
- $result[$key]['url'] = 'https://ko-fi.com/' . basename($item['url']);
- break;
- case 'issuehunt':
- $result[$key]['url'] = 'https://issuehunt.io/r/' . $item['url'];
- break;
- case 'community_bridge':
- $result[$key]['url'] = 'https://funding.communitybridge.org/projects/' . basename($item['url']);
- break;
- }
- }
- return $this->fundingInfo = $result;
- }
- public function getFileContent(string $file, string $identifier): ?string
- {
- if ($this->gitDriver) {
- return $this->gitDriver->getFileContent($file, $identifier);
- }
- $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/contents/' . $file . '?ref='.urlencode($identifier);
- $resource = $this->getContents($resource)->decodeJson();
- if ((!isset($resource['content']) || $resource['content'] === '') && $resource['encoding'] === 'none' && isset($resource['git_url'])) {
- $resource = $this->getContents($resource['git_url'])->decodeJson();
- }
- if (empty($resource['content']) || $resource['encoding'] !== 'base64' || !($content = base64_decode($resource['content']))) {
- throw new \RuntimeException('Could not retrieve ' . $file . ' for '.$identifier);
- }
- return $content;
- }
- public function getChangeDate(string $identifier): ?\DateTimeImmutable
- {
- if ($this->gitDriver) {
- return $this->gitDriver->getChangeDate($identifier);
- }
- $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/commits/'.urlencode($identifier);
- $commit = $this->getContents($resource)->decodeJson();
- return new \DateTimeImmutable($commit['commit']['committer']['date']);
- }
- public function getTags(): array
- {
- if ($this->gitDriver) {
- return $this->gitDriver->getTags();
- }
- if (null === $this->tags) {
- $tags = [];
- $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/tags?per_page=100';
- do {
- $response = $this->getContents($resource);
- $tagsData = $response->decodeJson();
- foreach ($tagsData as $tag) {
- $tags[$tag['name']] = $tag['commit']['sha'];
- }
- $resource = $this->getNextPage($response);
- } while ($resource);
- $this->tags = $tags;
- }
- return $this->tags;
- }
- public function getBranches(): array
- {
- if ($this->gitDriver) {
- return $this->gitDriver->getBranches();
- }
- if (null === $this->branches) {
- $branches = [];
- $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/git/refs/heads?per_page=100';
- do {
- $response = $this->getContents($resource);
- $branchData = $response->decodeJson();
- foreach ($branchData as $branch) {
- $name = substr($branch['ref'], 11);
- if ($name !== 'gh-pages') {
- $branches[$name] = $branch['object']['sha'];
- }
- }
- $resource = $this->getNextPage($response);
- } while ($resource);
- $this->branches = $branches;
- }
- return $this->branches;
- }
- public static function supports(IOInterface $io, Config $config, string $url, bool $deep = false): bool
- {
- if (!Preg::isMatch('#^((?:https?|git)://([^/]+)/|git@([^:]+):/?)([^/]+)/([^/]+?)(?:\.git|/)?$#', $url, $matches)) {
- return false;
- }
- $originUrl = !empty($matches[2]) ? $matches[2] : $matches[3];
- if (!in_array(strtolower(Preg::replace('{^www\.}i', '', $originUrl)), $config->get('github-domains'))) {
- return false;
- }
- if (!extension_loaded('openssl')) {
- $io->writeError('Skipping GitHub driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
- return false;
- }
- return true;
- }
- public function getRepoData(): ?array
- {
- $this->fetchRootIdentifier();
- return $this->repoData;
- }
- protected function generateSshUrl(): string
- {
- if (false !== strpos($this->originUrl, ':')) {
- return 'ssh://git@' . $this->originUrl . '/'.$this->owner.'/'.$this->repository.'.git';
- }
- return 'git@' . $this->originUrl . ':'.$this->owner.'/'.$this->repository.'.git';
- }
- protected function getContents(string $url, bool $fetchingRepoData = false): Response
- {
- try {
- return parent::getContents($url);
- } catch (TransportException $e) {
- $gitHubUtil = new GitHub($this->io, $this->config, $this->process, $this->httpDownloader);
- switch ($e->getCode()) {
- case 401:
- case 404:
- if (!$fetchingRepoData) {
- throw $e;
- }
- if ($gitHubUtil->authorizeOAuth($this->originUrl)) {
- return parent::getContents($url);
- }
- if (!$this->io->isInteractive()) {
- $this->attemptCloneFallback();
- return new Response(['url' => 'dummy'], 200, [], 'null');
- }
- $scopesIssued = [];
- $scopesNeeded = [];
- if ($headers = $e->getHeaders()) {
- if ($scopes = Response::findHeaderValue($headers, 'X-OAuth-Scopes')) {
- $scopesIssued = explode(' ', $scopes);
- }
- if ($scopes = Response::findHeaderValue($headers, 'X-Accepted-OAuth-Scopes')) {
- $scopesNeeded = explode(' ', $scopes);
- }
- }
- $scopesFailed = array_diff($scopesNeeded, $scopesIssued);
- if (!$headers || !count($scopesNeeded) || count($scopesFailed)) {
- $gitHubUtil->authorizeOAuthInteractively($this->originUrl, 'Your GitHub credentials are required to fetch private repository metadata (<info>'.$this->url.'</info>)');
- }
- return parent::getContents($url);
- case 403:
- if (!$this->io->hasAuthentication($this->originUrl) && $gitHubUtil->authorizeOAuth($this->originUrl)) {
- return parent::getContents($url);
- }
- if (!$this->io->isInteractive() && $fetchingRepoData) {
- $this->attemptCloneFallback();
- return new Response(['url' => 'dummy'], 200, [], 'null');
- }
- $rateLimited = $gitHubUtil->isRateLimited((array) $e->getHeaders());
- if (!$this->io->hasAuthentication($this->originUrl)) {
- if (!$this->io->isInteractive()) {
- $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>');
- throw $e;
- }
- $gitHubUtil->authorizeOAuthInteractively($this->originUrl, 'API limit exhausted. Enter your GitHub credentials to get a larger API limit (<info>'.$this->url.'</info>)');
- return parent::getContents($url);
- }
- if ($rateLimited) {
- $rateLimit = $gitHubUtil->getRateLimit($e->getHeaders());
- $this->io->writeError(sprintf(
- '<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>',
- $rateLimit['limit'],
- $rateLimit['reset']
- ));
- }
- throw $e;
- default:
- throw $e;
- }
- }
- }
- protected function fetchRootIdentifier(): void
- {
- if ($this->repoData) {
- return;
- }
- $repoDataUrl = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository;
- try {
- $this->repoData = $this->getContents($repoDataUrl, true)->decodeJson();
- } catch (TransportException $e) {
- if ($e->getCode() === 499) {
- $this->attemptCloneFallback();
- } else {
- throw $e;
- }
- }
- if (null === $this->repoData && null !== $this->gitDriver) {
- return;
- }
- $this->owner = $this->repoData['owner']['login'];
- $this->repository = $this->repoData['name'];
- $this->isPrivate = !empty($this->repoData['private']);
- if (isset($this->repoData['default_branch'])) {
- $this->rootIdentifier = $this->repoData['default_branch'];
- } elseif (isset($this->repoData['master_branch'])) {
- $this->rootIdentifier = $this->repoData['master_branch'];
- } else {
- $this->rootIdentifier = 'master';
- }
- $this->hasIssues = !empty($this->repoData['has_issues']);
- $this->isArchived = !empty($this->repoData['archived']);
- }
- protected function attemptCloneFallback(): bool
- {
- $this->isPrivate = true;
- try {
- $this->setupGitDriver($this->generateSshUrl());
- return true;
- } catch (\RuntimeException $e) {
- $this->gitDriver = null;
- $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>');
- throw $e;
- }
- }
- protected function setupGitDriver(string $url): void
- {
- $this->gitDriver = new GitDriver(
- ['url' => $url],
- $this->io,
- $this->config,
- $this->httpDownloader,
- $this->process
- );
- $this->gitDriver->initialize();
- }
- protected function getNextPage(Response $response): ?string
- {
- $header = $response->getHeader('link');
- if (!$header) {
- return null;
- }
- $links = explode(',', $header);
- foreach ($links as $link) {
- if (Preg::isMatch('{<(.+?)>; *rel="next"}', $link, $match)) {
- return $match[1];
- }
- }
- return null;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Repository\Vcs;
- use Composer\Config;
- use Composer\Cache;
- use Composer\IO\IOInterface;
- use Composer\Json\JsonFile;
- use Composer\Downloader\TransportException;
- use Composer\Pcre\Preg;
- use Composer\Util\HttpDownloader;
- use Composer\Util\GitLab;
- use Composer\Util\Http\Response;
- class GitLabDriver extends VcsDriver
- {
- private $scheme;
- private $namespace;
- private $repository;
- private $project;
- private $commits = [];
- private $tags;
- private $branches;
- protected $gitDriver = null;
- protected $protocol;
- private $isPrivate = true;
- private $hasNonstandardOrigin = false;
- public const URL_REGEX = '#^(?:(?P<scheme>https?)://(?P<domain>.+?)(?::(?P<port>[0-9]+))?/|git@(?P<domain2>[^:]+):)(?P<parts>.+)/(?P<repo>[^/]+?)(?:\.git|/)?$#';
- public function initialize(): void
- {
- if (!Preg::isMatch(self::URL_REGEX, $this->url, $match)) {
- throw new \InvalidArgumentException(sprintf('The GitLab repository URL %s is invalid. It must be the HTTP URL of a GitLab project.', $this->url));
- }
- $guessedDomain = !empty($match['domain']) ? $match['domain'] : $match['domain2'];
- $configuredDomains = $this->config->get('gitlab-domains');
- $urlParts = explode('/', $match['parts']);
- $this->scheme = !empty($match['scheme'])
- ? $match['scheme']
- : (isset($this->repoConfig['secure-http']) && $this->repoConfig['secure-http'] === false ? 'http' : 'https')
- ;
- $origin = self::determineOrigin($configuredDomains, $guessedDomain, $urlParts, $match['port']);
- if (false === $origin) {
- throw new \LogicException('It should not be possible to create a gitlab driver with an unparseable origin URL ('.$this->url.')');
- }
- $this->originUrl = $origin;
- if (is_string($protocol = $this->config->get('gitlab-protocol'))) {
- if (!in_array($protocol, ['git', 'http', 'https'])) {
- throw new \RuntimeException('gitlab-protocol must be one of git, http.');
- }
- $this->protocol = $protocol === 'git' ? 'ssh' : 'http';
- }
- if (false !== strpos($this->originUrl, ':') || false !== strpos($this->originUrl, '/')) {
- $this->hasNonstandardOrigin = true;
- }
- $this->namespace = implode('/', $urlParts);
- $this->repository = Preg::replace('#(\.git)$#', '', $match['repo']);
- $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.$this->originUrl.'/'.$this->namespace.'/'.$this->repository);
- $this->cache->setReadOnly($this->config->get('cache-read-only'));
- $this->fetchProject();
- }
- public function setHttpDownloader(HttpDownloader $httpDownloader): void
- {
- $this->httpDownloader = $httpDownloader;
- }
- public function getComposerInformation(string $identifier): ?array
- {
- if ($this->gitDriver) {
- return $this->gitDriver->getComposerInformation($identifier);
- }
- if (!isset($this->infoCache[$identifier])) {
- if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier)) {
- $composer = JsonFile::parseJson($res);
- } else {
- $composer = $this->getBaseComposerInformation($identifier);
- if ($this->shouldCache($identifier)) {
- $this->cache->write($identifier, json_encode($composer));
- }
- }
- if (null !== $composer) {
- if (!isset($composer['support']['source']) && isset($this->project['web_url'])) {
- $label = array_search($identifier, $this->getTags(), true) ?: array_search($identifier, $this->getBranches(), true) ?: $identifier;
- $composer['support']['source'] = sprintf('%s/-/tree/%s', $this->project['web_url'], $label);
- }
- if (!isset($composer['support']['issues']) && !empty($this->project['issues_enabled']) && isset($this->project['web_url'])) {
- $composer['support']['issues'] = sprintf('%s/-/issues', $this->project['web_url']);
- }
- if (!isset($composer['abandoned']) && !empty($this->project['archived'])) {
- $composer['abandoned'] = true;
- }
- }
- $this->infoCache[$identifier] = $composer;
- }
- return $this->infoCache[$identifier];
- }
- public function getFileContent(string $file, string $identifier): ?string
- {
- if ($this->gitDriver) {
- return $this->gitDriver->getFileContent($file, $identifier);
- }
- if (!Preg::isMatch('{[a-f0-9]{40}}i', $identifier)) {
- $branches = $this->getBranches();
- if (isset($branches[$identifier])) {
- $identifier = $branches[$identifier];
- }
- }
- $resource = $this->getApiUrl().'/repository/files/'.$this->urlEncodeAll($file).'/raw?ref='.$identifier;
- try {
- $content = $this->getContents($resource)->getBody();
- } catch (TransportException $e) {
- if ($e->getCode() !== 404) {
- throw $e;
- }
- return null;
- }
- return $content;
- }
- public function getChangeDate(string $identifier): ?\DateTimeImmutable
- {
- if ($this->gitDriver) {
- return $this->gitDriver->getChangeDate($identifier);
- }
- if (isset($this->commits[$identifier])) {
- return new \DateTimeImmutable($this->commits[$identifier]['committed_date']);
- }
- return null;
- }
- public function getRepositoryUrl(): string
- {
- if ($this->protocol) {
- return $this->project["{$this->protocol}_url_to_repo"];
- }
- return $this->isPrivate ? $this->project['ssh_url_to_repo'] : $this->project['http_url_to_repo'];
- }
- public function getUrl(): string
- {
- if ($this->gitDriver) {
- return $this->gitDriver->getUrl();
- }
- return $this->project['web_url'];
- }
- public function getDist(string $identifier): ?array
- {
- $url = $this->getApiUrl().'/repository/archive.zip?sha='.$identifier;
- return ['type' => 'zip', 'url' => $url, 'reference' => $identifier, 'shasum' => ''];
- }
- public function getSource(string $identifier): array
- {
- if ($this->gitDriver) {
- return $this->gitDriver->getSource($identifier);
- }
- return ['type' => 'git', 'url' => $this->getRepositoryUrl(), 'reference' => $identifier];
- }
- public function getRootIdentifier(): string
- {
- if ($this->gitDriver) {
- return $this->gitDriver->getRootIdentifier();
- }
- return $this->project['default_branch'];
- }
- public function getBranches(): array
- {
- if ($this->gitDriver) {
- return $this->gitDriver->getBranches();
- }
- if (null === $this->branches) {
- $this->branches = $this->getReferences('branches');
- }
- return $this->branches;
- }
- public function getTags(): array
- {
- if ($this->gitDriver) {
- return $this->gitDriver->getTags();
- }
- if (null === $this->tags) {
- $this->tags = $this->getReferences('tags');
- }
- return $this->tags;
- }
- public function getApiUrl(): string
- {
- return $this->scheme.'://'.$this->originUrl.'/api/v4/projects/'.$this->urlEncodeAll($this->namespace).'%2F'.$this->urlEncodeAll($this->repository);
- }
- private function urlEncodeAll(string $string): string
- {
- $encoded = '';
- for ($i = 0; isset($string[$i]); $i++) {
- $character = $string[$i];
- if (!ctype_alnum($character) && !in_array($character, ['-', '_'], true)) {
- $character = '%' . sprintf('%02X', ord($character));
- }
- $encoded .= $character;
- }
- return $encoded;
- }
- protected function getReferences(string $type): array
- {
- $perPage = 100;
- $resource = $this->getApiUrl().'/repository/'.$type.'?per_page='.$perPage;
- $references = [];
- do {
- $response = $this->getContents($resource);
- $data = $response->decodeJson();
- foreach ($data as $datum) {
- $references[$datum['name']] = $datum['commit']['id'];
- $this->commits[$datum['commit']['id']] = $datum['commit'];
- }
- if (count($data) >= $perPage) {
- $resource = $this->getNextPage($response);
- } else {
- $resource = false;
- }
- } while ($resource);
- return $references;
- }
- protected function fetchProject(): void
- {
- $resource = $this->getApiUrl();
- $this->project = $this->getContents($resource, true)->decodeJson();
- if (isset($this->project['visibility'])) {
- $this->isPrivate = $this->project['visibility'] !== 'public';
- } else {
- $this->isPrivate = false;
- }
- }
- protected function attemptCloneFallback(): bool
- {
- if ($this->isPrivate === false) {
- $url = $this->generatePublicUrl();
- } else {
- $url = $this->generateSshUrl();
- }
- try {
- $this->setupGitDriver($url);
- return true;
- } catch (\RuntimeException $e) {
- $this->gitDriver = null;
- $this->io->writeError('<error>Failed to clone the '.$url.' repository, try running in interactive mode so that you can enter your credentials</error>');
- throw $e;
- }
- }
- protected function generateSshUrl(): string
- {
- if ($this->hasNonstandardOrigin) {
- return 'ssh://git@'.$this->originUrl.'/'.$this->namespace.'/'.$this->repository.'.git';
- }
- return 'git@' . $this->originUrl . ':'.$this->namespace.'/'.$this->repository.'.git';
- }
- protected function generatePublicUrl(): string
- {
- return $this->scheme . '://' . $this->originUrl . '/'.$this->namespace.'/'.$this->repository.'.git';
- }
- protected function setupGitDriver(string $url): void
- {
- $this->gitDriver = new GitDriver(
- ['url' => $url],
- $this->io,
- $this->config,
- $this->httpDownloader,
- $this->process
- );
- $this->gitDriver->initialize();
- }
- protected function getContents(string $url, bool $fetchingRepoData = false): Response
- {
- try {
- $response = parent::getContents($url);
- if ($fetchingRepoData) {
- $json = $response->decodeJson();
- if (!isset($json['default_branch']) && isset($json['permissions'])) {
- $this->isPrivate = $json['visibility'] !== 'public';
- $moreThanGuestAccess = false;
- foreach ($json['permissions'] as $permission) {
- if ($permission && $permission['access_level'] > 10) {
- $moreThanGuestAccess = true;
- }
- }
- if (!$moreThanGuestAccess) {
- $this->io->writeError('<warning>GitLab token with Guest only access detected</warning>');
- $this->attemptCloneFallback();
- return new Response(['url' => 'dummy'], 200, [], 'null');
- }
- }
- if (!isset($json['default_branch'])) {
- if (isset($json['repository_access_level']) && $json['repository_access_level'] === 'disabled') {
- throw new TransportException('The GitLab repository is disabled in the project', 400);
- }
- if (!empty($json['id'])) {
- $this->isPrivate = false;
- }
- throw new TransportException('GitLab API seems to not be authenticated as it did not return a default_branch', 401);
- }
- }
- return $response;
- } catch (TransportException $e) {
- $gitLabUtil = new GitLab($this->io, $this->config, $this->process, $this->httpDownloader);
- switch ($e->getCode()) {
- case 401:
- case 404:
- if (!$fetchingRepoData) {
- throw $e;
- }
- if ($gitLabUtil->authorizeOAuth($this->originUrl)) {
- return parent::getContents($url);
- }
- if ($gitLabUtil->isOAuthExpired($this->originUrl) && $gitLabUtil->authorizeOAuthRefresh($this->scheme, $this->originUrl)) {
- return parent::getContents($url);
- }
- if (!$this->io->isInteractive()) {
- $this->attemptCloneFallback();
- return new Response(['url' => 'dummy'], 200, [], 'null');
- }
- $this->io->writeError('<warning>Failed to download ' . $this->namespace . '/' . $this->repository . ':' . $e->getMessage() . '</warning>');
- $gitLabUtil->authorizeOAuthInteractively($this->scheme, $this->originUrl, 'Your credentials are required to fetch private repository metadata (<info>'.$this->url.'</info>)');
- return parent::getContents($url);
- case 403:
- if (!$this->io->hasAuthentication($this->originUrl) && $gitLabUtil->authorizeOAuth($this->originUrl)) {
- return parent::getContents($url);
- }
- if (!$this->io->isInteractive() && $fetchingRepoData) {
- $this->attemptCloneFallback();
- return new Response(['url' => 'dummy'], 200, [], 'null');
- }
- throw $e;
- default:
- throw $e;
- }
- }
- }
- public static function supports(IOInterface $io, Config $config, string $url, bool $deep = false): bool
- {
- if (!Preg::isMatch(self::URL_REGEX, $url, $match)) {
- return false;
- }
- $scheme = !empty($match['scheme']) ? $match['scheme'] : null;
- $guessedDomain = !empty($match['domain']) ? $match['domain'] : $match['domain2'];
- $urlParts = explode('/', $match['parts']);
- if (false === self::determineOrigin($config->get('gitlab-domains'), $guessedDomain, $urlParts, $match['port'])) {
- return false;
- }
- if ('https' === $scheme && !extension_loaded('openssl')) {
- $io->writeError('Skipping GitLab driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
- return false;
- }
- return true;
- }
- protected function getNextPage(Response $response): ?string
- {
- $header = $response->getHeader('link');
- $links = explode(',', $header);
- foreach ($links as $link) {
- if (Preg::isMatch('{<(.+?)>; *rel="next"}', $link, $match)) {
- return $match[1];
- }
- }
- return null;
- }
- private static function determineOrigin(array $configuredDomains, string $guessedDomain, array &$urlParts, ?string $portNumber)
- {
- $guessedDomain = strtolower($guessedDomain);
- if (in_array($guessedDomain, $configuredDomains) || (null !== $portNumber && in_array($guessedDomain.':'.$portNumber, $configuredDomains))) {
- if (null !== $portNumber) {
- return $guessedDomain.':'.$portNumber;
- }
- return $guessedDomain;
- }
- if (null !== $portNumber) {
- $guessedDomain .= ':'.$portNumber;
- }
- while (null !== ($part = array_shift($urlParts))) {
- $guessedDomain .= '/' . $part;
- if (in_array($guessedDomain, $configuredDomains) || (null !== $portNumber && in_array(Preg::replace('{:\d+}', '', $guessedDomain), $configuredDomains))) {
- return $guessedDomain;
- }
- }
- return false;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Repository\Vcs;
- use Composer\Config;
- use Composer\Cache;
- use Composer\Pcre\Preg;
- use Composer\Util\Hg as HgUtils;
- use Composer\Util\ProcessExecutor;
- use Composer\Util\Filesystem;
- use Composer\IO\IOInterface;
- class HgDriver extends VcsDriver
- {
- protected $tags;
- protected $branches;
- protected $rootIdentifier;
- protected $repoDir;
- public function initialize(): void
- {
- if (Filesystem::isLocalPath($this->url)) {
- $this->repoDir = $this->url;
- } else {
- if (!Cache::isUsable($this->config->get('cache-vcs-dir'))) {
- throw new \RuntimeException('HgDriver requires a usable cache directory, and it looks like you set it to be disabled');
- }
- $cacheDir = $this->config->get('cache-vcs-dir');
- $this->repoDir = $cacheDir . '/' . Preg::replace('{[^a-z0-9]}i', '-', $this->url) . '/';
- $fs = new Filesystem();
- $fs->ensureDirectoryExists($cacheDir);
- if (!is_writable(dirname($this->repoDir))) {
- throw new \RuntimeException('Can not clone '.$this->url.' to access package information. The "'.$cacheDir.'" directory is not writable by the current user.');
- }
- $this->config->prohibitUrlByConfig($this->url, $this->io);
- $hgUtils = new HgUtils($this->io, $this->config, $this->process);
- if (is_dir($this->repoDir) && 0 === $this->process->execute('hg summary', $output, $this->repoDir)) {
- if (0 !== $this->process->execute('hg pull', $output, $this->repoDir)) {
- $this->io->writeError('<error>Failed to update '.$this->url.', package information from this repository may be outdated ('.$this->process->getErrorOutput().')</error>');
- }
- } else {
- $fs->removeDirectory($this->repoDir);
- $repoDir = $this->repoDir;
- $command = static function ($url) use ($repoDir): string {
- return sprintf('hg clone --noupdate -- %s %s', ProcessExecutor::escape($url), ProcessExecutor::escape($repoDir));
- };
- $hgUtils->runCommand($command, $this->url, null);
- }
- }
- $this->getTags();
- $this->getBranches();
- }
- public function getRootIdentifier(): string
- {
- if (null === $this->rootIdentifier) {
- $this->process->execute('hg tip --template "{node}"', $output, $this->repoDir);
- $output = $this->process->splitLines($output);
- $this->rootIdentifier = $output[0];
- }
- return $this->rootIdentifier;
- }
- public function getUrl(): string
- {
- return $this->url;
- }
- public function getSource(string $identifier): array
- {
- return ['type' => 'hg', 'url' => $this->getUrl(), 'reference' => $identifier];
- }
- public function getDist(string $identifier): ?array
- {
- return null;
- }
- public function getFileContent(string $file, string $identifier): ?string
- {
- if (isset($identifier[0]) && $identifier[0] === '-') {
- throw new \RuntimeException('Invalid hg identifier detected. Identifier must not start with a -, given: ' . $identifier);
- }
- $resource = sprintf('hg cat -r %s -- %s', ProcessExecutor::escape($identifier), ProcessExecutor::escape($file));
- $this->process->execute($resource, $content, $this->repoDir);
- if (!trim($content)) {
- return null;
- }
- return $content;
- }
- public function getChangeDate(string $identifier): ?\DateTimeImmutable
- {
- $this->process->execute(
- sprintf(
- 'hg log --template "{date|rfc3339date}" -r %s',
- ProcessExecutor::escape($identifier)
- ),
- $output,
- $this->repoDir
- );
- return new \DateTimeImmutable(trim($output), new \DateTimeZone('UTC'));
- }
- public function getTags(): array
- {
- if (null === $this->tags) {
- $tags = [];
- $this->process->execute('hg tags', $output, $this->repoDir);
- foreach ($this->process->splitLines($output) as $tag) {
- if ($tag && Preg::isMatch('(^([^\s]+)\s+\d+:(.*)$)', $tag, $match)) {
- $tags[$match[1]] = $match[2];
- }
- }
- unset($tags['tip']);
- $this->tags = $tags;
- }
- return $this->tags;
- }
- public function getBranches(): array
- {
- if (null === $this->branches) {
- $branches = [];
- $bookmarks = [];
- $this->process->execute('hg branches', $output, $this->repoDir);
- foreach ($this->process->splitLines($output) as $branch) {
- if ($branch && Preg::isMatch('(^([^\s]+)\s+\d+:([a-f0-9]+))', $branch, $match) && $match[1][0] !== '-') {
- $branches[$match[1]] = $match[2];
- }
- }
- $this->process->execute('hg bookmarks', $output, $this->repoDir);
- foreach ($this->process->splitLines($output) as $branch) {
- if ($branch && Preg::isMatch('(^(?:[\s*]*)([^\s]+)\s+\d+:(.*)$)', $branch, $match) && $match[1][0] !== '-') {
- $bookmarks[$match[1]] = $match[2];
- }
- }
- $this->branches = array_merge($bookmarks, $branches);
- }
- return $this->branches;
- }
- public static function supports(IOInterface $io, Config $config, string $url, bool $deep = false): bool
- {
- if (Preg::isMatch('#(^(?:https?|ssh)://(?:[^@]+@)?bitbucket.org|https://(?:.*?)\.kilnhg.com)#i', $url)) {
- return true;
- }
- if (Filesystem::isLocalPath($url)) {
- $url = Filesystem::getPlatformPath($url);
- if (!is_dir($url)) {
- return false;
- }
- $process = new ProcessExecutor($io);
- if ($process->execute('hg summary', $output, $url) === 0) {
- return true;
- }
- }
- if (!$deep) {
- return false;
- }
- $process = new ProcessExecutor($io);
- $exit = $process->execute(sprintf('hg identify -- %s', ProcessExecutor::escape($url)), $ignored);
- return $exit === 0;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Repository\Vcs;
- use Composer\Config;
- use Composer\Cache;
- use Composer\IO\IOInterface;
- use Composer\Pcre\Preg;
- use Composer\Util\ProcessExecutor;
- use Composer\Util\Perforce;
- use Composer\Util\Http\Response;
- class PerforceDriver extends VcsDriver
- {
- protected $depot;
- protected $branch;
- protected $perforce = null;
- public function initialize(): void
- {
- $this->depot = $this->repoConfig['depot'];
- $this->branch = '';
- if (!empty($this->repoConfig['branch'])) {
- $this->branch = $this->repoConfig['branch'];
- }
- $this->initPerforce($this->repoConfig);
- $this->perforce->p4Login();
- $this->perforce->checkStream();
- $this->perforce->writeP4ClientSpec();
- $this->perforce->connectClient();
- }
- private function initPerforce(array $repoConfig): void
- {
- if (!empty($this->perforce)) {
- return;
- }
- if (!Cache::isUsable($this->config->get('cache-vcs-dir'))) {
- throw new \RuntimeException('PerforceDriver requires a usable cache directory, and it looks like you set it to be disabled');
- }
- $repoDir = $this->config->get('cache-vcs-dir') . '/' . $this->depot;
- $this->perforce = Perforce::create($repoConfig, $this->getUrl(), $repoDir, $this->process, $this->io);
- }
- public function getFileContent(string $file, string $identifier): ?string
- {
- return $this->perforce->getFileContent($file, $identifier);
- }
- public function getChangeDate(string $identifier): ?\DateTimeImmutable
- {
- return null;
- }
- public function getRootIdentifier(): string
- {
- return $this->branch;
- }
- public function getBranches(): array
- {
- return $this->perforce->getBranches();
- }
- public function getTags(): array
- {
- return $this->perforce->getTags();
- }
- public function getDist(string $identifier): ?array
- {
- return null;
- }
- public function getSource(string $identifier): array
- {
- return [
- 'type' => 'perforce',
- 'url' => $this->repoConfig['url'],
- 'reference' => $identifier,
- 'p4user' => $this->perforce->getUser(),
- ];
- }
- public function getUrl(): string
- {
- return $this->url;
- }
- public function hasComposerFile(string $identifier): bool
- {
- $composerInfo = $this->perforce->getComposerInformation('//' . $this->depot . '/' . $identifier);
- return !empty($composerInfo);
- }
- public function getContents(string $url): Response
- {
- throw new \BadMethodCallException('Not implemented/used in PerforceDriver');
- }
- public static function supports(IOInterface $io, Config $config, string $url, bool $deep = false): bool
- {
- if ($deep || Preg::isMatch('#\b(perforce|p4)\b#i', $url)) {
- return Perforce::checkServerExists($url, new ProcessExecutor($io));
- }
- return false;
- }
- public function cleanup(): void
- {
- $this->perforce->cleanupClientSpec();
- $this->perforce = null;
- }
- public function getDepot(): string
- {
- return $this->depot;
- }
- public function getBranch(): string
- {
- return $this->branch;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Repository\Vcs;
- use Composer\Cache;
- use Composer\Config;
- use Composer\Json\JsonFile;
- use Composer\Pcre\Preg;
- use Composer\Util\ProcessExecutor;
- use Composer\Util\Filesystem;
- use Composer\Util\Url;
- use Composer\Util\Svn as SvnUtil;
- use Composer\IO\IOInterface;
- use Composer\Downloader\TransportException;
- class SvnDriver extends VcsDriver
- {
- protected $baseUrl;
- protected $tags;
- protected $branches;
- protected $rootIdentifier;
- protected $trunkPath = 'trunk';
- protected $branchesPath = 'branches';
- protected $tagsPath = 'tags';
- protected $packagePath = '';
- protected $cacheCredentials = true;
- private $util;
- public function initialize(): void
- {
- $this->url = $this->baseUrl = rtrim(self::normalizeUrl($this->url), '/');
- SvnUtil::cleanEnv();
- if (isset($this->repoConfig['trunk-path'])) {
- $this->trunkPath = $this->repoConfig['trunk-path'];
- }
- if (isset($this->repoConfig['branches-path'])) {
- $this->branchesPath = $this->repoConfig['branches-path'];
- }
- if (isset($this->repoConfig['tags-path'])) {
- $this->tagsPath = $this->repoConfig['tags-path'];
- }
- if (array_key_exists('svn-cache-credentials', $this->repoConfig)) {
- $this->cacheCredentials = (bool) $this->repoConfig['svn-cache-credentials'];
- }
- if (isset($this->repoConfig['package-path'])) {
- $this->packagePath = '/' . trim($this->repoConfig['package-path'], '/');
- }
- if (false !== ($pos = strrpos($this->url, '/' . $this->trunkPath))) {
- $this->baseUrl = substr($this->url, 0, $pos);
- }
- $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.Preg::replace('{[^a-z0-9.]}i', '-', Url::sanitize($this->baseUrl)));
- $this->cache->setReadOnly($this->config->get('cache-read-only'));
- $this->getBranches();
- $this->getTags();
- }
- public function getRootIdentifier(): string
- {
- return $this->rootIdentifier ?: $this->trunkPath;
- }
- public function getUrl(): string
- {
- return $this->url;
- }
- public function getSource(string $identifier): array
- {
- return ['type' => 'svn', 'url' => $this->baseUrl, 'reference' => $identifier];
- }
- public function getDist(string $identifier): ?array
- {
- return null;
- }
- protected function shouldCache(string $identifier): bool
- {
- return $this->cache && Preg::isMatch('{@\d+$}', $identifier);
- }
- public function getComposerInformation(string $identifier): ?array
- {
- if (!isset($this->infoCache[$identifier])) {
- if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier.'.json')) {
- if ($res === '""') {
- $res = 'null';
- $this->cache->write($identifier.'.json', json_encode(null));
- }
- return $this->infoCache[$identifier] = JsonFile::parseJson($res);
- }
- try {
- $composer = $this->getBaseComposerInformation($identifier);
- } catch (TransportException $e) {
- $message = $e->getMessage();
- if (stripos($message, 'path not found') === false && stripos($message, 'svn: warning: W160013') === false) {
- throw $e;
- }
- $composer = null;
- }
- if ($this->shouldCache($identifier)) {
- $this->cache->write($identifier.'.json', json_encode($composer));
- }
- $this->infoCache[$identifier] = $composer;
- }
- if (!is_array($this->infoCache[$identifier])) {
- return null;
- }
- return $this->infoCache[$identifier];
- }
- public function getFileContent(string $file, string $identifier): ?string
- {
- $identifier = '/' . trim($identifier, '/') . '/';
- Preg::match('{^(.+?)(@\d+)?/$}', $identifier, $match);
- if (!empty($match[2])) {
- $path = $match[1];
- $rev = $match[2];
- } else {
- $path = $identifier;
- $rev = '';
- }
- try {
- $resource = $path.$file;
- $output = $this->execute('svn cat', $this->baseUrl . $resource . $rev);
- if (!trim($output)) {
- return null;
- }
- } catch (\RuntimeException $e) {
- throw new TransportException($e->getMessage());
- }
- return $output;
- }
- public function getChangeDate(string $identifier): ?\DateTimeImmutable
- {
- $identifier = '/' . trim($identifier, '/') . '/';
- Preg::match('{^(.+?)(@\d+)?/$}', $identifier, $match);
- if (!empty($match[2])) {
- $path = $match[1];
- $rev = $match[2];
- } else {
- $path = $identifier;
- $rev = '';
- }
- $output = $this->execute('svn info', $this->baseUrl . $path . $rev);
- foreach ($this->process->splitLines($output) as $line) {
- if ($line && Preg::isMatch('{^Last Changed Date: ([^(]+)}', $line, $match)) {
- return new \DateTimeImmutable($match[1], new \DateTimeZone('UTC'));
- }
- }
- return null;
- }
- public function getTags(): array
- {
- if (null === $this->tags) {
- $tags = [];
- if ($this->tagsPath !== false) {
- $output = $this->execute('svn ls --verbose', $this->baseUrl . '/' . $this->tagsPath);
- if ($output) {
- foreach ($this->process->splitLines($output) as $line) {
- $line = trim($line);
- if ($line && Preg::isMatch('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) {
- if (isset($match[1], $match[2]) && $match[2] !== './') {
- $tags[rtrim($match[2], '/')] = $this->buildIdentifier(
- '/' . $this->tagsPath . '/' . $match[2],
- $match[1]
- );
- }
- }
- }
- }
- }
- $this->tags = $tags;
- }
- return $this->tags;
- }
- public function getBranches(): array
- {
- if (null === $this->branches) {
- $branches = [];
- if (false === $this->trunkPath) {
- $trunkParent = $this->baseUrl . '/';
- } else {
- $trunkParent = $this->baseUrl . '/' . $this->trunkPath;
- }
- $output = $this->execute('svn ls --verbose', $trunkParent);
- if ($output) {
- foreach ($this->process->splitLines($output) as $line) {
- $line = trim($line);
- if ($line && Preg::isMatch('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) {
- if (isset($match[1], $match[2]) && $match[2] === './') {
- $branches['trunk'] = $this->buildIdentifier(
- '/' . $this->trunkPath,
- $match[1]
- );
- $this->rootIdentifier = $branches['trunk'];
- break;
- }
- }
- }
- }
- unset($output);
- if ($this->branchesPath !== false) {
- $output = $this->execute('svn ls --verbose', $this->baseUrl . '/' . $this->branchesPath);
- if ($output) {
- foreach ($this->process->splitLines(trim($output)) as $line) {
- $line = trim($line);
- if ($line && Preg::isMatch('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) {
- if (isset($match[1], $match[2]) && $match[2] !== './') {
- $branches[rtrim($match[2], '/')] = $this->buildIdentifier(
- '/' . $this->branchesPath . '/' . $match[2],
- $match[1]
- );
- }
- }
- }
- }
- }
- $this->branches = $branches;
- }
- return $this->branches;
- }
- public static function supports(IOInterface $io, Config $config, string $url, bool $deep = false): bool
- {
- $url = self::normalizeUrl($url);
- if (Preg::isMatch('#(^svn://|^svn\+ssh://|svn\.)#i', $url)) {
- return true;
- }
- if (!$deep && !Filesystem::isLocalPath($url)) {
- return false;
- }
- $process = new ProcessExecutor($io);
- $exit = $process->execute(
- "svn info --non-interactive -- ".ProcessExecutor::escape($url),
- $ignoredOutput
- );
- if ($exit === 0) {
- return true;
- }
- if (false !== stripos($process->getErrorOutput(), 'authorization failed:')) {
- return true;
- }
- if (false !== stripos($process->getErrorOutput(), 'Authentication failed')) {
- return true;
- }
- return false;
- }
- protected static function normalizeUrl(string $url): string
- {
- $fs = new Filesystem();
- if ($fs->isAbsolutePath($url)) {
- return 'file://' . strtr($url, '\\', '/');
- }
- return $url;
- }
- protected function execute(string $command, string $url): string
- {
- if (null === $this->util) {
- $this->util = new SvnUtil($this->baseUrl, $this->io, $this->config, $this->process);
- $this->util->setCacheCredentials($this->cacheCredentials);
- }
- try {
- return $this->util->execute($command, $url);
- } catch (\RuntimeException $e) {
- if (null === $this->util->binaryVersion()) {
- 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());
- }
- throw new \RuntimeException(
- 'Repository '.$this->url.' could not be processed, '.$e->getMessage()
- );
- }
- }
- protected function buildIdentifier(string $baseDir, string $revision): string
- {
- return rtrim($baseDir, '/') . $this->packagePath . '/@' . $revision;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Repository\Vcs;
- use Composer\Cache;
- use Composer\Downloader\TransportException;
- use Composer\Config;
- use Composer\IO\IOInterface;
- use Composer\Json\JsonFile;
- use Composer\Pcre\Preg;
- use Composer\Util\ProcessExecutor;
- use Composer\Util\HttpDownloader;
- use Composer\Util\Filesystem;
- use Composer\Util\Http\Response;
- abstract class VcsDriver implements VcsDriverInterface
- {
- protected $url;
- protected $originUrl;
- protected $repoConfig;
- protected $io;
- protected $config;
- protected $process;
- protected $httpDownloader;
- protected $infoCache = [];
- protected $cache;
- final public function __construct(array $repoConfig, IOInterface $io, Config $config, HttpDownloader $httpDownloader, ProcessExecutor $process)
- {
- if (Filesystem::isLocalPath($repoConfig['url'])) {
- $repoConfig['url'] = Filesystem::getPlatformPath($repoConfig['url']);
- }
- $this->url = $repoConfig['url'];
- $this->originUrl = $repoConfig['url'];
- $this->repoConfig = $repoConfig;
- $this->io = $io;
- $this->config = $config;
- $this->httpDownloader = $httpDownloader;
- $this->process = $process;
- }
- protected function shouldCache(string $identifier): bool
- {
- return $this->cache && Preg::isMatch('{^[a-f0-9]{40}$}iD', $identifier);
- }
- public function getComposerInformation(string $identifier): ?array
- {
- if (!isset($this->infoCache[$identifier])) {
- if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier)) {
- return $this->infoCache[$identifier] = JsonFile::parseJson($res);
- }
- $composer = $this->getBaseComposerInformation($identifier);
- if ($this->shouldCache($identifier)) {
- $this->cache->write($identifier, JsonFile::encode($composer, 0));
- }
- $this->infoCache[$identifier] = $composer;
- }
- return $this->infoCache[$identifier];
- }
- protected function getBaseComposerInformation(string $identifier): ?array
- {
- $composerFileContent = $this->getFileContent('composer.json', $identifier);
- if (!$composerFileContent) {
- return null;
- }
- $composer = JsonFile::parseJson($composerFileContent, $identifier . ':composer.json');
- if ([] === $composer || !is_array($composer)) {
- return null;
- }
- if (empty($composer['time']) && null !== ($changeDate = $this->getChangeDate($identifier))) {
- $composer['time'] = $changeDate->format(DATE_RFC3339);
- }
- return $composer;
- }
- public function hasComposerFile(string $identifier): bool
- {
- try {
- return null !== $this->getComposerInformation($identifier);
- } catch (TransportException $e) {
- }
- return false;
- }
- protected function getScheme(): string
- {
- if (extension_loaded('openssl')) {
- return 'https';
- }
- return 'http';
- }
- protected function getContents(string $url): Response
- {
- $options = $this->repoConfig['options'] ?? [];
- return $this->httpDownloader->get($url, $options);
- }
- public function cleanup(): void
- {
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Repository\Vcs;
- use Composer\Config;
- use Composer\IO\IOInterface;
- interface VcsDriverInterface
- {
- public function initialize(): void;
- public function getComposerInformation(string $identifier): ?array;
- public function getFileContent(string $file, string $identifier): ?string;
- public function getChangeDate(string $identifier): ?\DateTimeImmutable;
- public function getRootIdentifier(): string;
- public function getBranches(): array;
- public function getTags(): array;
- public function getDist(string $identifier): ?array;
- public function getSource(string $identifier): array;
- public function getUrl(): string;
- public function hasComposerFile(string $identifier): bool;
- public function cleanup(): void;
- public static function supports(IOInterface $io, Config $config, string $url, bool $deep = false): bool;
- }
- <?php declare(strict_types=1);
- namespace Composer\Repository;
- use Composer\Downloader\TransportException;
- use Composer\Pcre\Preg;
- use Composer\Repository\Vcs\VcsDriverInterface;
- use Composer\Package\Version\VersionParser;
- use Composer\Package\Loader\ArrayLoader;
- use Composer\Package\Loader\ValidatingArrayLoader;
- use Composer\Package\Loader\InvalidPackageException;
- use Composer\Package\Loader\LoaderInterface;
- use Composer\EventDispatcher\EventDispatcher;
- use Composer\Util\ProcessExecutor;
- use Composer\Util\HttpDownloader;
- use Composer\Util\Url;
- use Composer\Semver\Constraint\Constraint;
- use Composer\IO\IOInterface;
- use Composer\Config;
- class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInterface
- {
- protected $url;
- protected $packageName;
- protected $isVerbose;
- protected $isVeryVerbose;
- protected $io;
- protected $config;
- protected $versionParser;
- protected $type;
- protected $loader;
- protected $repoConfig;
- protected $httpDownloader;
- protected $processExecutor;
- protected $branchErrorOccurred = false;
- private $drivers;
- private $driver;
- private $versionCache;
- private $emptyReferences = [];
- private $versionTransportExceptions = [];
- public function __construct(array $repoConfig, IOInterface $io, Config $config, HttpDownloader $httpDownloader, ?EventDispatcher $dispatcher = null, ?ProcessExecutor $process = null, ?array $drivers = null, ?VersionCacheInterface $versionCache = null)
- {
- parent::__construct();
- $this->drivers = $drivers ?: [
- 'github' => 'Composer\Repository\Vcs\GitHubDriver',
- 'gitlab' => 'Composer\Repository\Vcs\GitLabDriver',
- 'bitbucket' => 'Composer\Repository\Vcs\GitBitbucketDriver',
- 'git-bitbucket' => 'Composer\Repository\Vcs\GitBitbucketDriver',
- 'git' => 'Composer\Repository\Vcs\GitDriver',
- 'hg' => 'Composer\Repository\Vcs\HgDriver',
- 'perforce' => 'Composer\Repository\Vcs\PerforceDriver',
- 'fossil' => 'Composer\Repository\Vcs\FossilDriver',
- 'svn' => 'Composer\Repository\Vcs\SvnDriver',
- ];
- $this->url = $repoConfig['url'];
- $this->io = $io;
- $this->type = $repoConfig['type'] ?? 'vcs';
- $this->isVerbose = $io->isVerbose();
- $this->isVeryVerbose = $io->isVeryVerbose();
- $this->config = $config;
- $this->repoConfig = $repoConfig;
- $this->versionCache = $versionCache;
- $this->httpDownloader = $httpDownloader;
- $this->processExecutor = $process ?? new ProcessExecutor($io);
- }
- public function getRepoName()
- {
- $driverClass = get_class($this->getDriver());
- $driverType = array_search($driverClass, $this->drivers);
- if (!$driverType) {
- $driverType = $driverClass;
- }
- return 'vcs repo ('.$driverType.' '.Url::sanitize($this->url).')';
- }
- public function getRepoConfig()
- {
- return $this->repoConfig;
- }
- public function setLoader(LoaderInterface $loader): void
- {
- $this->loader = $loader;
- }
- public function getDriver(): ?VcsDriverInterface
- {
- if ($this->driver) {
- return $this->driver;
- }
- if (isset($this->drivers[$this->type])) {
- $class = $this->drivers[$this->type];
- $this->driver = new $class($this->repoConfig, $this->io, $this->config, $this->httpDownloader, $this->processExecutor);
- $this->driver->initialize();
- return $this->driver;
- }
- foreach ($this->drivers as $driver) {
- if ($driver::supports($this->io, $this->config, $this->url)) {
- $this->driver = new $driver($this->repoConfig, $this->io, $this->config, $this->httpDownloader, $this->processExecutor);
- $this->driver->initialize();
- return $this->driver;
- }
- }
- foreach ($this->drivers as $driver) {
- if ($driver::supports($this->io, $this->config, $this->url, true)) {
- $this->driver = new $driver($this->repoConfig, $this->io, $this->config, $this->httpDownloader, $this->processExecutor);
- $this->driver->initialize();
- return $this->driver;
- }
- }
- return null;
- }
- public function hadInvalidBranches(): bool
- {
- return $this->branchErrorOccurred;
- }
- public function getEmptyReferences(): array
- {
- return $this->emptyReferences;
- }
- public function getVersionTransportExceptions(): array
- {
- return $this->versionTransportExceptions;
- }
- protected function initialize()
- {
- parent::initialize();
- $isVerbose = $this->isVerbose;
- $isVeryVerbose = $this->isVeryVerbose;
- $driver = $this->getDriver();
- if (!$driver) {
- throw new \InvalidArgumentException('No driver found to handle VCS repository '.$this->url);
- }
- $this->versionParser = new VersionParser;
- if (!$this->loader) {
- $this->loader = new ArrayLoader($this->versionParser);
- }
- $hasRootIdentifierComposerJson = false;
- try {
- $hasRootIdentifierComposerJson = $driver->hasComposerFile($driver->getRootIdentifier());
- if ($hasRootIdentifierComposerJson) {
- $data = $driver->getComposerInformation($driver->getRootIdentifier());
- $this->packageName = !empty($data['name']) ? $data['name'] : null;
- }
- } catch (\Exception $e) {
- if ($e instanceof TransportException && $this->shouldRethrowTransportException($e)) {
- throw $e;
- }
- if ($isVeryVerbose) {
- $this->io->writeError('<error>Skipped parsing '.$driver->getRootIdentifier().', '.$e->getMessage().'</error>');
- }
- }
- foreach ($driver->getTags() as $tag => $identifier) {
- $tag = (string) $tag;
- $msg = 'Reading composer.json of <info>' . ($this->packageName ?: $this->url) . '</info> (<comment>' . $tag . '</comment>)';
- if ($isVeryVerbose) {
- $this->io->writeError($msg);
- } elseif ($isVerbose) {
- $this->io->overwriteError($msg, false);
- }
- $tag = str_replace('release-', '', $tag);
- $cachedPackage = $this->getCachedPackageVersion($tag, $identifier, $isVerbose, $isVeryVerbose);
- if ($cachedPackage) {
- $this->addPackage($cachedPackage);
- continue;
- }
- if ($cachedPackage === false) {
- $this->emptyReferences[] = $identifier;
- continue;
- }
- if (!$parsedTag = $this->validateTag($tag)) {
- if ($isVeryVerbose) {
- $this->io->writeError('<warning>Skipped tag '.$tag.', invalid tag name</warning>');
- }
- continue;
- }
- try {
- $data = $driver->getComposerInformation($identifier);
- if (null === $data) {
- if ($isVeryVerbose) {
- $this->io->writeError('<warning>Skipped tag '.$tag.', no composer file</warning>');
- }
- $this->emptyReferences[] = $identifier;
- continue;
- }
- if (isset($data['version'])) {
- $data['version_normalized'] = $this->versionParser->normalize($data['version']);
- } else {
- $data['version'] = $tag;
- $data['version_normalized'] = $parsedTag;
- }
- $data['version'] = Preg::replace('{[.-]?dev$}i', '', $data['version']);
- $data['version_normalized'] = Preg::replace('{(^dev-|[.-]?dev$)}i', '', $data['version_normalized']);
- unset($data['default-branch']);
- if ($data['version_normalized'] !== $parsedTag) {
- if ($isVeryVerbose) {
- if (Preg::isMatch('{(^dev-|[.-]?dev$)}i', $parsedTag)) {
- $this->io->writeError('<warning>Skipped tag '.$tag.', invalid tag name, tags can not use dev prefixes or suffixes</warning>');
- } else {
- $this->io->writeError('<warning>Skipped tag '.$tag.', tag ('.$parsedTag.') does not match version ('.$data['version_normalized'].') in composer.json</warning>');
- }
- }
- continue;
- }
- $tagPackageName = $this->packageName ?: ($data['name'] ?? '');
- if ($existingPackage = $this->findPackage($tagPackageName, $data['version_normalized'])) {
- if ($isVeryVerbose) {
- $this->io->writeError('<warning>Skipped tag '.$tag.', it conflicts with an another tag ('.$existingPackage->getPrettyVersion().') as both resolve to '.$data['version_normalized'].' internally</warning>');
- }
- continue;
- }
- if ($isVeryVerbose) {
- $this->io->writeError('Importing tag '.$tag.' ('.$data['version_normalized'].')');
- }
- $this->addPackage($this->loader->load($this->preProcess($driver, $data, $identifier)));
- } catch (\Exception $e) {
- if ($e instanceof TransportException) {
- $this->versionTransportExceptions['tags'][$tag] = $e;
- if ($e->getCode() === 404) {
- $this->emptyReferences[] = $identifier;
- }
- if ($this->shouldRethrowTransportException($e)) {
- throw $e;
- }
- }
- if ($isVeryVerbose) {
- $this->io->writeError('<warning>Skipped tag '.$tag.', '.($e instanceof TransportException ? 'no composer file was found (' . $e->getCode() . ' HTTP status code)' : $e->getMessage()).'</warning>');
- }
- continue;
- }
- }
- if (!$isVeryVerbose) {
- $this->io->overwriteError('', false);
- }
- $branches = $driver->getBranches();
- if ($hasRootIdentifierComposerJson && isset($branches[$driver->getRootIdentifier()])) {
- $branches = [$driver->getRootIdentifier() => $branches[$driver->getRootIdentifier()]] + $branches;
- }
- foreach ($branches as $branch => $identifier) {
- $branch = (string) $branch;
- $msg = 'Reading composer.json of <info>' . ($this->packageName ?: $this->url) . '</info> (<comment>' . $branch . '</comment>)';
- if ($isVeryVerbose) {
- $this->io->writeError($msg);
- } elseif ($isVerbose) {
- $this->io->overwriteError($msg, false);
- }
- if (!$parsedBranch = $this->validateBranch($branch)) {
- if ($isVeryVerbose) {
- $this->io->writeError('<warning>Skipped branch '.$branch.', invalid name</warning>');
- }
- continue;
- }
- if (strpos($parsedBranch, 'dev-') === 0 || VersionParser::DEFAULT_BRANCH_ALIAS === $parsedBranch) {
- $version = 'dev-' . $branch;
- } else {
- $prefix = strpos($branch, 'v') === 0 ? 'v' : '';
- $version = $prefix . Preg::replace('{(\.9{7})+}', '.x', $parsedBranch);
- }
- $cachedPackage = $this->getCachedPackageVersion($version, $identifier, $isVerbose, $isVeryVerbose, $driver->getRootIdentifier() === $branch);
- if ($cachedPackage) {
- $this->addPackage($cachedPackage);
- continue;
- }
- if ($cachedPackage === false) {
- $this->emptyReferences[] = $identifier;
- continue;
- }
- try {
- $data = $driver->getComposerInformation($identifier);
- if (null === $data) {
- if ($isVeryVerbose) {
- $this->io->writeError('<warning>Skipped branch '.$branch.', no composer file</warning>');
- }
- $this->emptyReferences[] = $identifier;
- continue;
- }
- $data['version'] = $version;
- $data['version_normalized'] = $parsedBranch;
- unset($data['default-branch']);
- if ($driver->getRootIdentifier() === $branch) {
- $data['default-branch'] = true;
- }
- if ($isVeryVerbose) {
- $this->io->writeError('Importing branch '.$branch.' ('.$data['version'].')');
- }
- $packageData = $this->preProcess($driver, $data, $identifier);
- $package = $this->loader->load($packageData);
- if ($this->loader instanceof ValidatingArrayLoader && $this->loader->getWarnings()) {
- throw new InvalidPackageException($this->loader->getErrors(), $this->loader->getWarnings(), $packageData);
- }
- $this->addPackage($package);
- } catch (TransportException $e) {
- $this->versionTransportExceptions['branches'][$branch] = $e;
- if ($e->getCode() === 404) {
- $this->emptyReferences[] = $identifier;
- }
- if ($this->shouldRethrowTransportException($e)) {
- throw $e;
- }
- if ($isVeryVerbose) {
- $this->io->writeError('<warning>Skipped branch '.$branch.', no composer file was found (' . $e->getCode() . ' HTTP status code)</warning>');
- }
- continue;
- } catch (\Exception $e) {
- if (!$isVeryVerbose) {
- $this->io->writeError('');
- }
- $this->branchErrorOccurred = true;
- $this->io->writeError('<error>Skipped branch '.$branch.', '.$e->getMessage().'</error>');
- $this->io->writeError('');
- continue;
- }
- }
- $driver->cleanup();
- if (!$isVeryVerbose) {
- $this->io->overwriteError('', false);
- }
- if (!$this->getPackages()) {
- throw new InvalidRepositoryException('No valid composer.json was found in any branch or tag of '.$this->url.', could not load a package from it.');
- }
- }
- protected function preProcess(VcsDriverInterface $driver, array $data, string $identifier): array
- {
- $dataPackageName = $data['name'] ?? null;
- $data['name'] = $this->packageName ?: $dataPackageName;
- if (!isset($data['dist'])) {
- $data['dist'] = $driver->getDist($identifier);
- }
- if (!isset($data['source'])) {
- $data['source'] = $driver->getSource($identifier);
- }
- return $data;
- }
- private function validateBranch(string $branch)
- {
- try {
- $normalizedBranch = $this->versionParser->normalizeBranch($branch);
- $this->versionParser->parseConstraints($normalizedBranch);
- return $normalizedBranch;
- } catch (\Exception $e) {
- }
- return false;
- }
- private function validateTag(string $version)
- {
- try {
- return $this->versionParser->normalize($version);
- } catch (\Exception $e) {
- }
- return false;
- }
- private function getCachedPackageVersion(string $version, string $identifier, bool $isVerbose, bool $isVeryVerbose, bool $isDefaultBranch = false)
- {
- if (!$this->versionCache) {
- return null;
- }
- $cachedPackage = $this->versionCache->getVersionPackage($version, $identifier);
- if ($cachedPackage === false) {
- if ($isVeryVerbose) {
- $this->io->writeError('<warning>Skipped '.$version.', no composer file (cached from ref '.$identifier.')</warning>');
- }
- return false;
- }
- if ($cachedPackage) {
- $msg = 'Found cached composer.json of <info>' . ($this->packageName ?: $this->url) . '</info> (<comment>' . $version . '</comment>)';
- if ($isVeryVerbose) {
- $this->io->writeError($msg);
- } elseif ($isVerbose) {
- $this->io->overwriteError($msg, false);
- }
- unset($cachedPackage['default-branch']);
- if ($isDefaultBranch) {
- $cachedPackage['default-branch'] = true;
- }
- if ($existingPackage = $this->findPackage($cachedPackage['name'], new Constraint('=', $cachedPackage['version_normalized']))) {
- if ($isVeryVerbose) {
- $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>');
- }
- $cachedPackage = null;
- }
- }
- if ($cachedPackage) {
- return $this->loader->load($cachedPackage);
- }
- return null;
- }
- private function shouldRethrowTransportException(TransportException $e): bool
- {
- return in_array($e->getCode(), [401, 403, 429], true) || $e->getCode() >= 500;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Repository;
- interface VersionCacheInterface
- {
- public function getVersionPackage(string $version, string $identifier);
- }
- <?php declare(strict_types=1);
- namespace Composer\Repository;
- use Composer\Installer\InstallationManager;
- class WritableArrayRepository extends ArrayRepository implements WritableRepositoryInterface
- {
- use CanonicalPackagesTrait;
- protected $devPackageNames = [];
- private $devMode = null;
- public function getDevMode()
- {
- return $this->devMode;
- }
- public function setDevPackageNames(array $devPackageNames)
- {
- $this->devPackageNames = $devPackageNames;
- }
- public function getDevPackageNames()
- {
- return $this->devPackageNames;
- }
- public function write(bool $devMode, InstallationManager $installationManager)
- {
- $this->devMode = $devMode;
- }
- public function reload()
- {
- $this->devMode = null;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Repository;
- use Composer\Package\PackageInterface;
- use Composer\Installer\InstallationManager;
- interface WritableRepositoryInterface extends RepositoryInterface
- {
- public function write(bool $devMode, InstallationManager $installationManager);
- public function addPackage(PackageInterface $package);
- public function removePackage(PackageInterface $package);
- public function getCanonicalPackages();
- public function reload();
- public function setDevPackageNames(array $devPackageNames);
- public function getDevPackageNames();
- }
- <?php declare(strict_types=1);
- namespace Composer\Script;
- use Composer\Composer;
- use Composer\IO\IOInterface;
- use Composer\EventDispatcher\Event as BaseEvent;
- class Event extends BaseEvent
- {
- private $composer;
- private $io;
- private $devMode;
- private $originatingEvent;
- public function __construct(string $name, Composer $composer, IOInterface $io, bool $devMode = false, array $args = [], array $flags = [])
- {
- parent::__construct($name, $args, $flags);
- $this->composer = $composer;
- $this->io = $io;
- $this->devMode = $devMode;
- }
- public function getComposer(): Composer
- {
- return $this->composer;
- }
- public function getIO(): IOInterface
- {
- return $this->io;
- }
- public function isDevMode(): bool
- {
- return $this->devMode;
- }
- public function getOriginatingEvent(): ?BaseEvent
- {
- return $this->originatingEvent;
- }
- public function setOriginatingEvent(BaseEvent $event): self
- {
- $this->originatingEvent = $this->calculateOriginatingEvent($event);
- return $this;
- }
- private function calculateOriginatingEvent(BaseEvent $event): BaseEvent
- {
- if ($event instanceof Event && $event->getOriginatingEvent()) {
- return $this->calculateOriginatingEvent($event->getOriginatingEvent());
- }
- return $event;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Script;
- class ScriptEvents
- {
- public const PRE_INSTALL_CMD = 'pre-install-cmd';
- public const POST_INSTALL_CMD = 'post-install-cmd';
- public const PRE_UPDATE_CMD = 'pre-update-cmd';
- public const POST_UPDATE_CMD = 'post-update-cmd';
- public const PRE_STATUS_CMD = 'pre-status-cmd';
- public const POST_STATUS_CMD = 'post-status-cmd';
- public const PRE_AUTOLOAD_DUMP = 'pre-autoload-dump';
- public const POST_AUTOLOAD_DUMP = 'post-autoload-dump';
- public const POST_ROOT_PACKAGE_INSTALL = 'post-root-package-install';
- public const POST_CREATE_PROJECT_CMD = 'post-create-project-cmd';
- public const PRE_ARCHIVE_CMD = 'pre-archive-cmd';
- public const POST_ARCHIVE_CMD = 'post-archive-cmd';
- }
- <?php declare(strict_types=1);
- namespace Composer\SelfUpdate;
- use Composer\Pcre\Preg;
- class Keys
- {
- public static function fingerprint(string $path): string
- {
- $hash = strtoupper(hash('sha256', Preg::replace('{\s}', '', file_get_contents($path))));
- return implode(' ', [
- substr($hash, 0, 8),
- substr($hash, 8, 8),
- substr($hash, 16, 8),
- substr($hash, 24, 8),
- '',
- substr($hash, 32, 8),
- substr($hash, 40, 8),
- substr($hash, 48, 8),
- substr($hash, 56, 8),
- ]);
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\SelfUpdate;
- use Composer\IO\IOInterface;
- use Composer\Pcre\Preg;
- use Composer\Util\HttpDownloader;
- use Composer\Config;
- class Versions
- {
- public static $channels = self::CHANNELS;
- public const CHANNELS = ['stable', 'preview', 'snapshot', '1', '2', '2.2'];
- private $httpDownloader;
- private $config;
- private $channel;
- private $versionsData = null;
- public function __construct(Config $config, HttpDownloader $httpDownloader)
- {
- $this->httpDownloader = $httpDownloader;
- $this->config = $config;
- }
- public function getChannel(): string
- {
- if ($this->channel) {
- return $this->channel;
- }
- $channelFile = $this->config->get('home').'/update-channel';
- if (file_exists($channelFile)) {
- $channel = trim(file_get_contents($channelFile));
- if (in_array($channel, ['stable', 'preview', 'snapshot', '2.2'], true)) {
- return $this->channel = $channel;
- }
- }
- return $this->channel = 'stable';
- }
- public function setChannel(string $channel, ?IOInterface $io = null): void
- {
- if (!in_array($channel, self::$channels, true)) {
- throw new \InvalidArgumentException('Invalid channel '.$channel.', must be one of: ' . implode(', ', self::$channels));
- }
- $channelFile = $this->config->get('home').'/update-channel';
- $this->channel = $channel;
- $storedChannel = Preg::isMatch('{^\d+$}D', $channel) ? 'stable' : $channel;
- $previouslyStored = file_exists($channelFile) ? trim((string) file_get_contents($channelFile)) : null;
- file_put_contents($channelFile, $storedChannel.PHP_EOL);
- if ($io !== null && $previouslyStored !== $storedChannel) {
- $io->writeError('Storing "<info>'.$storedChannel.'</info>" as default update channel for the next self-update run.');
- }
- }
- public function getLatest(?string $channel = null): array
- {
- $versions = $this->getVersionsData();
- foreach ($versions[$channel ?: $this->getChannel()] as $version) {
- if ($version['min-php'] <= PHP_VERSION_ID) {
- return $version;
- }
- }
- throw new \UnexpectedValueException('There is no version of Composer available for your PHP version ('.PHP_VERSION.')');
- }
- private function getVersionsData(): array
- {
- if (null === $this->versionsData) {
- if ($this->config->get('disable-tls') === true) {
- $protocol = 'http';
- } else {
- $protocol = 'https';
- }
- $this->versionsData = $this->httpDownloader->get($protocol . '://getcomposer.org/versions')->decodeJson();
- }
- return $this->versionsData;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Util;
- use Composer\Config;
- use Composer\IO\IOInterface;
- use Composer\Downloader\TransportException;
- use Composer\Pcre\Preg;
- class AuthHelper
- {
- protected $io;
- protected $config;
- private $displayedOriginAuthentications = [];
- public function __construct(IOInterface $io, Config $config)
- {
- $this->io = $io;
- $this->config = $config;
- }
- public function storeAuth(string $origin, $storeAuth): void
- {
- $store = false;
- $configSource = $this->config->getAuthConfigSource();
- if ($storeAuth === true) {
- $store = $configSource;
- } elseif ($storeAuth === 'prompt') {
- $answer = $this->io->askAndValidate(
- 'Do you want to store credentials for '.$origin.' in '.$configSource->getName().' ? [Yn] ',
- static function ($value): string {
- $input = strtolower(substr(trim($value), 0, 1));
- if (in_array($input, ['y','n'])) {
- return $input;
- }
- throw new \RuntimeException('Please answer (y)es or (n)o');
- },
- null,
- 'y'
- );
- if ($answer === 'y') {
- $store = $configSource;
- }
- }
- if ($store) {
- $store->addConfigSetting(
- 'http-basic.'.$origin,
- $this->io->getAuthentication($origin)
- );
- }
- }
- public function promptAuthIfNeeded(string $url, string $origin, int $statusCode, ?string $reason = null, array $headers = [], int $retryCount = 0): array
- {
- $storeAuth = false;
- if (in_array($origin, $this->config->get('github-domains'), true)) {
- $gitHubUtil = new GitHub($this->io, $this->config, null);
- $message = "\n";
- $rateLimited = $gitHubUtil->isRateLimited($headers);
- $requiresSso = $gitHubUtil->requiresSso($headers);
- if ($requiresSso) {
- $ssoUrl = $gitHubUtil->getSsoUrl($headers);
- $message = 'GitHub API token requires SSO authorization. Authorize this token at ' . $ssoUrl . "\n";
- $this->io->writeError($message);
- if (!$this->io->isInteractive()) {
- throw new TransportException('Could not authenticate against ' . $origin, 403);
- }
- $this->io->ask('After authorizing your token, confirm that you would like to retry the request');
- return ['retry' => true, 'storeAuth' => $storeAuth];
- }
- if ($rateLimited) {
- $rateLimit = $gitHubUtil->getRateLimit($headers);
- if ($this->io->hasAuthentication($origin)) {
- $message = 'Review your configured GitHub OAuth token or enter a new one to go over the API rate limit.';
- } else {
- $message = 'Create a GitHub OAuth token to go over the API rate limit.';
- }
- $message = sprintf(
- '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.',
- $rateLimit['limit'],
- $rateLimit['reset']
- )."\n";
- } else {
- $message .= 'Could not fetch '.$url.', please ';
- if ($this->io->hasAuthentication($origin)) {
- $message .= 'review your configured GitHub OAuth token or enter a new one to access private repos';
- } else {
- $message .= 'create a GitHub OAuth token to access private repos';
- }
- }
- if (!$gitHubUtil->authorizeOAuth($origin)
- && (!$this->io->isInteractive() || !$gitHubUtil->authorizeOAuthInteractively($origin, $message))
- ) {
- throw new TransportException('Could not authenticate against '.$origin, 401);
- }
- } elseif (in_array($origin, $this->config->get('gitlab-domains'), true)) {
- $message = "\n".'Could not fetch '.$url.', enter your ' . $origin . ' credentials ' .($statusCode === 401 ? 'to access private repos' : 'to go over the API rate limit');
- $gitLabUtil = new GitLab($this->io, $this->config, null);
- $auth = null;
- if ($this->io->hasAuthentication($origin)) {
- $auth = $this->io->getAuthentication($origin);
- if (in_array($auth['password'], ['gitlab-ci-token', 'private-token', 'oauth2'], true)) {
- throw new TransportException("Invalid credentials for '" . $url . "', aborting.", $statusCode);
- }
- }
- if (!$gitLabUtil->authorizeOAuth($origin)
- && (!$this->io->isInteractive() || !$gitLabUtil->authorizeOAuthInteractively(parse_url($url, PHP_URL_SCHEME), $origin, $message))
- ) {
- throw new TransportException('Could not authenticate against '.$origin, 401);
- }
- if ($auth !== null && $this->io->hasAuthentication($origin)) {
- if ($auth === $this->io->getAuthentication($origin)) {
- throw new TransportException("Invalid credentials for '" . $url . "', aborting.", $statusCode);
- }
- }
- } elseif ($origin === 'bitbucket.org' || $origin === 'api.bitbucket.org') {
- $askForOAuthToken = true;
- $origin = 'bitbucket.org';
- if ($this->io->hasAuthentication($origin)) {
- $auth = $this->io->getAuthentication($origin);
- if ($auth['username'] !== 'x-token-auth') {
- $bitbucketUtil = new Bitbucket($this->io, $this->config);
- $accessToken = $bitbucketUtil->requestToken($origin, $auth['username'], $auth['password']);
- if (!empty($accessToken)) {
- $this->io->setAuthentication($origin, 'x-token-auth', $accessToken);
- $askForOAuthToken = false;
- }
- } else {
- throw new TransportException('Could not authenticate against ' . $origin, 401);
- }
- }
- if ($askForOAuthToken) {
- $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');
- $bitBucketUtil = new Bitbucket($this->io, $this->config);
- if (!$bitBucketUtil->authorizeOAuth($origin)
- && (!$this->io->isInteractive() || !$bitBucketUtil->authorizeOAuthInteractively($origin, $message))
- ) {
- throw new TransportException('Could not authenticate against ' . $origin, 401);
- }
- }
- } else {
- if ($statusCode === 404) {
- return ['retry' => false, 'storeAuth' => false];
- }
- if (!$this->io->isInteractive()) {
- if ($statusCode === 401) {
- $message = "The '" . $url . "' URL required authentication (HTTP 401).\nYou must be using the interactive console to authenticate";
- } elseif ($statusCode === 403) {
- $message = "The '" . $url . "' URL could not be accessed (HTTP 403): " . $reason;
- } else {
- $message = "Unknown error code '" . $statusCode . "', reason: " . $reason;
- }
- throw new TransportException($message, $statusCode);
- }
- if ($this->io->hasAuthentication($origin)) {
- if ($retryCount === 0) {
- return ['retry' => true, 'storeAuth' => false];
- }
- throw new TransportException("Invalid credentials (HTTP $statusCode) for '$url', aborting.", $statusCode);
- }
- $this->io->writeError(' Authentication required (<info>'.$origin.'</info>):');
- $username = $this->io->ask(' Username: ');
- $password = $this->io->askAndHideAnswer(' Password: ');
- $this->io->setAuthentication($origin, $username, $password);
- $storeAuth = $this->config->get('store-auths');
- }
- return ['retry' => true, 'storeAuth' => $storeAuth];
- }
- public function addAuthenticationHeader(array $headers, string $origin, string $url): array
- {
- if ($this->io->hasAuthentication($origin)) {
- $authenticationDisplayMessage = null;
- $auth = $this->io->getAuthentication($origin);
- if ($auth['password'] === 'bearer') {
- $headers[] = 'Authorization: Bearer '.$auth['username'];
- } elseif ('github.com' === $origin && 'x-oauth-basic' === $auth['password']) {
- if (Preg::isMatch('{^https?://api\.github\.com/}', $url)) {
- $headers[] = 'Authorization: token '.$auth['username'];
- $authenticationDisplayMessage = 'Using GitHub token authentication';
- }
- } elseif (
- in_array($origin, $this->config->get('gitlab-domains'), true)
- && in_array($auth['password'], ['oauth2', 'private-token', 'gitlab-ci-token'], true)
- ) {
- if ($auth['password'] === 'oauth2') {
- $headers[] = 'Authorization: Bearer '.$auth['username'];
- $authenticationDisplayMessage = 'Using GitLab OAuth token authentication';
- } else {
- $headers[] = 'PRIVATE-TOKEN: '.$auth['username'];
- $authenticationDisplayMessage = 'Using GitLab private token authentication';
- }
- } elseif (
- 'bitbucket.org' === $origin
- && $url !== Bitbucket::OAUTH2_ACCESS_TOKEN_URL
- && 'x-token-auth' === $auth['username']
- ) {
- if (!$this->isPublicBitBucketDownload($url)) {
- $headers[] = 'Authorization: Bearer ' . $auth['password'];
- $authenticationDisplayMessage = 'Using Bitbucket OAuth token authentication';
- }
- } else {
- $authStr = base64_encode($auth['username'] . ':' . $auth['password']);
- $headers[] = 'Authorization: Basic '.$authStr;
- $authenticationDisplayMessage = 'Using HTTP basic authentication with username "' . $auth['username'] . '"';
- }
- if ($authenticationDisplayMessage && (!isset($this->displayedOriginAuthentications[$origin]) || $this->displayedOriginAuthentications[$origin] !== $authenticationDisplayMessage)) {
- $this->io->writeError($authenticationDisplayMessage, true, IOInterface::DEBUG);
- $this->displayedOriginAuthentications[$origin] = $authenticationDisplayMessage;
- }
- } elseif (in_array($origin, ['api.bitbucket.org', 'api.github.com'], true)) {
- return $this->addAuthenticationHeader($headers, str_replace('api.', '', $origin), $url);
- }
- return $headers;
- }
- public function isPublicBitBucketDownload(string $urlToBitBucketFile): bool
- {
- $domain = parse_url($urlToBitBucketFile, PHP_URL_HOST);
- if (strpos($domain, 'bitbucket.org') === false) {
- return true;
- }
- $path = parse_url($urlToBitBucketFile, PHP_URL_PATH);
- $pathParts = explode('/', $path);
- return count($pathParts) >= 4 && $pathParts[3] === 'downloads';
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Util;
- use Composer\Factory;
- use Composer\IO\IOInterface;
- use Composer\Config;
- use Composer\Downloader\TransportException;
- class Bitbucket
- {
- private $io;
- private $config;
- private $process;
- private $httpDownloader;
- private $token = null;
- private $time;
- public const OAUTH2_ACCESS_TOKEN_URL = 'https://bitbucket.org/site/oauth2/access_token';
- public function __construct(IOInterface $io, Config $config, ?ProcessExecutor $process = null, ?HttpDownloader $httpDownloader = null, ?int $time = null)
- {
- $this->io = $io;
- $this->config = $config;
- $this->process = $process ?: new ProcessExecutor($io);
- $this->httpDownloader = $httpDownloader ?: Factory::createHttpDownloader($this->io, $config);
- $this->time = $time;
- }
- public function getToken(): string
- {
- if (!isset($this->token['access_token'])) {
- return '';
- }
- return $this->token['access_token'];
- }
- public function authorizeOAuth(string $originUrl): bool
- {
- if ($originUrl !== 'bitbucket.org') {
- return false;
- }
- if (0 === $this->process->execute('git config bitbucket.accesstoken', $output)) {
- $this->io->setAuthentication($originUrl, 'x-token-auth', trim($output));
- return true;
- }
- return false;
- }
- private function requestAccessToken(): bool
- {
- try {
- $response = $this->httpDownloader->get(self::OAUTH2_ACCESS_TOKEN_URL, [
- 'retry-auth-failure' => false,
- 'http' => [
- 'method' => 'POST',
- 'content' => 'grant_type=client_credentials',
- ],
- ]);
- $token = $response->decodeJson();
- if (!isset($token['expires_in']) || !isset($token['access_token'])) {
- throw new \LogicException('Expected a token configured with expires_in and access_token present, got '.json_encode($token));
- }
- $this->token = $token;
- } catch (TransportException $e) {
- if ($e->getCode() === 400) {
- $this->io->writeError('<error>Invalid OAuth consumer provided.</error>');
- $this->io->writeError('This can have three reasons:');
- $this->io->writeError('1. You are authenticating with a bitbucket username/password combination');
- $this->io->writeError('2. You are using an OAuth consumer, but didn\'t configure a (dummy) callback url');
- $this->io->writeError('3. You are using an OAuth consumer, but didn\'t configure it as private consumer');
- return false;
- }
- if (in_array($e->getCode(), [403, 401])) {
- $this->io->writeError('<error>Invalid OAuth consumer provided.</error>');
- $this->io->writeError('You can also add it manually later by using "composer config --global --auth bitbucket-oauth.bitbucket.org <consumer-key> <consumer-secret>"');
- return false;
- }
- throw $e;
- }
- return true;
- }
- public function authorizeOAuthInteractively(string $originUrl, ?string $message = null): bool
- {
- if ($message) {
- $this->io->writeError($message);
- }
- $url = 'https://support.atlassian.com/bitbucket-cloud/docs/use-oauth-on-bitbucket-cloud/';
- $this->io->writeError(sprintf('Follow the instructions on %s', $url));
- $this->io->writeError(sprintf('to create a consumer. It will be stored in "%s" for future use by Composer.', $this->config->getAuthConfigSource()->getName()));
- $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)');
- $consumerKey = trim((string) $this->io->askAndHideAnswer('Consumer Key (hidden): '));
- if (!$consumerKey) {
- $this->io->writeError('<warning>No consumer key given, aborting.</warning>');
- $this->io->writeError('You can also add it manually later by using "composer config --global --auth bitbucket-oauth.bitbucket.org <consumer-key> <consumer-secret>"');
- return false;
- }
- $consumerSecret = trim((string) $this->io->askAndHideAnswer('Consumer Secret (hidden): '));
- if (!$consumerSecret) {
- $this->io->writeError('<warning>No consumer secret given, aborting.</warning>');
- $this->io->writeError('You can also add it manually later by using "composer config --global --auth bitbucket-oauth.bitbucket.org <consumer-key> <consumer-secret>"');
- return false;
- }
- $this->io->setAuthentication($originUrl, $consumerKey, $consumerSecret);
- if (!$this->requestAccessToken()) {
- return false;
- }
- $this->storeInAuthConfig($originUrl, $consumerKey, $consumerSecret);
- $this->config->getAuthConfigSource()->removeConfigSetting('http-basic.' . $originUrl);
- $this->io->writeError('<info>Consumer stored successfully.</info>');
- return true;
- }
- public function requestToken(string $originUrl, string $consumerKey, string $consumerSecret): string
- {
- if ($this->token !== null || $this->getTokenFromConfig($originUrl)) {
- return $this->token['access_token'];
- }
- $this->io->setAuthentication($originUrl, $consumerKey, $consumerSecret);
- if (!$this->requestAccessToken()) {
- return '';
- }
- $this->storeInAuthConfig($originUrl, $consumerKey, $consumerSecret);
- if (!isset($this->token['access_token'])) {
- throw new \LogicException('Failed to initialize token above');
- }
- return $this->token['access_token'];
- }
- private function storeInAuthConfig(string $originUrl, string $consumerKey, string $consumerSecret): void
- {
- $this->config->getConfigSource()->removeConfigSetting('bitbucket-oauth.'.$originUrl);
- if (null === $this->token || !isset($this->token['expires_in'])) {
- throw new \LogicException('Expected a token configured with expires_in present, got '.json_encode($this->token));
- }
- $time = null === $this->time ? time() : $this->time;
- $consumer = [
- "consumer-key" => $consumerKey,
- "consumer-secret" => $consumerSecret,
- "access-token" => $this->token['access_token'],
- "access-token-expiration" => $time + $this->token['expires_in'],
- ];
- $this->config->getAuthConfigSource()->addConfigSetting('bitbucket-oauth.'.$originUrl, $consumer);
- }
- private function getTokenFromConfig(string $originUrl): bool
- {
- $authConfig = $this->config->get('bitbucket-oauth');
- if (
- !isset($authConfig[$originUrl]['access-token'], $authConfig[$originUrl]['access-token-expiration'])
- || time() > $authConfig[$originUrl]['access-token-expiration']
- ) {
- return false;
- }
- $this->token = [
- 'access_token' => $authConfig[$originUrl]['access-token'],
- ];
- return true;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Util;
- use Composer\Pcre\Preg;
- class ComposerMirror
- {
- public static function processUrl(string $mirrorUrl, string $packageName, string $version, ?string $reference, ?string $type, ?string $prettyVersion = null): string
- {
- if ($reference) {
- $reference = Preg::isMatch('{^([a-f0-9]*|%reference%)$}', $reference) ? $reference : md5($reference);
- }
- $version = strpos($version, '/') === false ? $version : md5($version);
- $from = ['%package%', '%version%', '%reference%', '%type%'];
- $to = [$packageName, $version, $reference, $type];
- if (null !== $prettyVersion) {
- $from[] = '%prettyVersion%';
- $to[] = $prettyVersion;
- }
- return str_replace($from, $to, $mirrorUrl);
- }
- public static function processGitUrl(string $mirrorUrl, string $packageName, string $url, ?string $type): string
- {
- if (Preg::isMatch('#^(?:(?:https?|git)://github\.com/|git@github\.com:)([^/]+)/(.+?)(?:\.git)?$#', $url, $match)) {
- $url = 'gh-'.$match[1].'/'.$match[2];
- } elseif (Preg::isMatch('#^https://bitbucket\.org/([^/]+)/(.+?)(?:\.git)?/?$#', $url, $match)) {
- $url = 'bb-'.$match[1].'/'.$match[2];
- } else {
- $url = Preg::replace('{[^a-z0-9_.-]}i', '-', trim($url, '/'));
- }
- return str_replace(
- ['%package%', '%normalizedUrl%', '%type%'],
- [$packageName, $url, $type],
- $mirrorUrl
- );
- }
- public static function processHgUrl(string $mirrorUrl, string $packageName, string $url, string $type): string
- {
- return self::processGitUrl($mirrorUrl, $packageName, $url, $type);
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Util;
- use Composer\Package\Loader\ArrayLoader;
- use Composer\Package\Loader\ValidatingArrayLoader;
- use Composer\Package\Loader\InvalidPackageException;
- use Composer\Json\JsonValidationException;
- use Composer\IO\IOInterface;
- use Composer\Json\JsonFile;
- use Composer\Pcre\Preg;
- use Composer\Spdx\SpdxLicenses;
- use Seld\JsonLint\DuplicateKeyException;
- use Seld\JsonLint\JsonParser;
- class ConfigValidator
- {
- public const CHECK_VERSION = 1;
- private $io;
- public function __construct(IOInterface $io)
- {
- $this->io = $io;
- }
- public function validate(string $file, int $arrayLoaderValidationFlags = ValidatingArrayLoader::CHECK_ALL, int $flags = self::CHECK_VERSION): array
- {
- $errors = [];
- $publishErrors = [];
- $warnings = [];
- $laxValid = false;
- $manifest = null;
- try {
- $json = new JsonFile($file, null, $this->io);
- $manifest = $json->read();
- $json->validateSchema(JsonFile::LAX_SCHEMA);
- $laxValid = true;
- $json->validateSchema();
- } catch (JsonValidationException $e) {
- foreach ($e->getErrors() as $message) {
- if ($laxValid) {
- $publishErrors[] = $message;
- } else {
- $errors[] = $message;
- }
- }
- } catch (\Exception $e) {
- $errors[] = $e->getMessage();
- return [$errors, $publishErrors, $warnings];
- }
- if (is_array($manifest)) {
- $jsonParser = new JsonParser();
- try {
- $jsonParser->parse((string) file_get_contents($file), JsonParser::DETECT_KEY_CONFLICTS);
- } catch (DuplicateKeyException $e) {
- $details = $e->getDetails();
- $warnings[] = 'Key '.$details['key'].' is a duplicate in '.$file.' at line '.$details['line'];
- }
- }
- if (empty($manifest['license'])) {
- $warnings[] = 'No license specified, it is recommended to do so. For closed-source software you may use "proprietary" as license.';
- } else {
- $licenses = (array) $manifest['license'];
- foreach ($licenses as $key => $license) {
- if ('proprietary' === $license) {
- unset($licenses[$key]);
- }
- }
- $licenseValidator = new SpdxLicenses();
- foreach ($licenses as $license) {
- $spdxLicense = $licenseValidator->getLicenseByIdentifier($license);
- if ($spdxLicense && $spdxLicense[3]) {
- if (Preg::isMatch('{^[AL]?GPL-[123](\.[01])?\+$}i', $license)) {
- $warnings[] = sprintf(
- 'License "%s" is a deprecated SPDX license identifier, use "'.str_replace('+', '', $license).'-or-later" instead',
- $license
- );
- } elseif (Preg::isMatch('{^[AL]?GPL-[123](\.[01])?$}i', $license)) {
- $warnings[] = sprintf(
- 'License "%s" is a deprecated SPDX license identifier, use "'.$license.'-only" or "'.$license.'-or-later" instead',
- $license
- );
- } else {
- $warnings[] = sprintf(
- 'License "%s" is a deprecated SPDX license identifier, see https://spdx.org/licenses/',
- $license
- );
- }
- }
- }
- }
- if (($flags & self::CHECK_VERSION) && isset($manifest['version'])) {
- $warnings[] = 'The version field is present, it is recommended to leave it out if the package is published on Packagist.';
- }
- if (!empty($manifest['name']) && Preg::isMatch('{[A-Z]}', $manifest['name'])) {
- $suggestName = Preg::replace('{(?:([a-z])([A-Z])|([A-Z])([A-Z][a-z]))}', '\\1\\3-\\2\\4', $manifest['name']);
- $suggestName = strtolower($suggestName);
- $publishErrors[] = sprintf(
- '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.',
- $manifest['name'],
- $suggestName
- );
- }
- if (!empty($manifest['type']) && $manifest['type'] === 'composer-installer') {
- $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.";
- }
- if (isset($manifest['require'], $manifest['require-dev'])) {
- $requireOverrides = array_intersect_key($manifest['require'], $manifest['require-dev']);
- if (!empty($requireOverrides)) {
- $plural = (count($requireOverrides) > 1) ? 'are' : 'is';
- $warnings[] = implode(', ', array_keys($requireOverrides)). " {$plural} required both in require and require-dev, this can lead to unexpected behavior";
- }
- }
- foreach (['provide', 'replace'] as $linkType) {
- if (isset($manifest[$linkType])) {
- foreach (['require', 'require-dev'] as $requireType) {
- if (isset($manifest[$requireType])) {
- foreach ($manifest[$linkType] as $provide => $constraint) {
- if (isset($manifest[$requireType][$provide])) {
- $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.';
- }
- }
- }
- }
- }
- }
- $require = $manifest['require'] ?? [];
- $requireDev = $manifest['require-dev'] ?? [];
- $packages = array_merge($require, $requireDev);
- foreach ($packages as $package => $version) {
- if (Preg::isMatch('/#/', $version)) {
- $warnings[] = sprintf(
- 'The package "%s" is pointing to a commit-ref, this is bad practice and can cause unforeseen issues.',
- $package
- );
- }
- }
- $scriptsDescriptions = $manifest['scripts-descriptions'] ?? [];
- $scripts = $manifest['scripts'] ?? [];
- foreach ($scriptsDescriptions as $scriptName => $scriptDescription) {
- if (!array_key_exists($scriptName, $scripts)) {
- $warnings[] = sprintf(
- 'Description for non-existent script "%s" found in "scripts-descriptions"',
- $scriptName
- );
- }
- }
- if (isset($manifest['autoload']['psr-0'][''])) {
- $warnings[] = "Defining autoload.psr-0 with an empty namespace prefix is a bad idea for performance";
- }
- if (isset($manifest['autoload']['psr-4'][''])) {
- $warnings[] = "Defining autoload.psr-4 with an empty namespace prefix is a bad idea for performance";
- }
- $loader = new ValidatingArrayLoader(new ArrayLoader(), true, null, $arrayLoaderValidationFlags);
- try {
- if (!isset($manifest['version'])) {
- $manifest['version'] = '1.0.0';
- }
- if (!isset($manifest['name'])) {
- $manifest['name'] = 'dummy/dummy';
- }
- $loader->load($manifest);
- } catch (InvalidPackageException $e) {
- $errors = array_merge($errors, $e->getErrors());
- }
- $warnings = array_merge($warnings, $loader->getWarnings());
- return [$errors, $publishErrors, $warnings];
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Util;
- use Composer\IO\IOInterface;
- class ErrorHandler
- {
- private static $io;
- public static function handle(int $level, string $message, string $file, int $line): bool
- {
- $isDeprecationNotice = $level === E_DEPRECATED || $level === E_USER_DEPRECATED;
- if (!$isDeprecationNotice && !(error_reporting() & $level)) {
- return true;
- }
- if (filter_var(ini_get('xdebug.scream'), FILTER_VALIDATE_BOOLEAN)) {
- $message .= "\n\nWarning: You have xdebug.scream enabled, the warning above may be".
- "\na legitimately suppressed error that you were not supposed to see.";
- }
- if (!$isDeprecationNotice) {
- throw new \ErrorException($message, 0, $level, $file, $line);
- }
- if (self::$io) {
- self::$io->writeError('<warning>Deprecation Notice: '.$message.' in '.$file.':'.$line.'</warning>');
- if (self::$io->isVerbose()) {
- self::$io->writeError('<warning>Stack trace:</warning>');
- self::$io->writeError(array_filter(array_map(static function ($a): ?string {
- if (isset($a['line'], $a['file'])) {
- return '<warning> '.$a['file'].':'.$a['line'].'</warning>';
- }
- return null;
- }, array_slice(debug_backtrace(), 2))));
- }
- }
- return true;
- }
- public static function register(?IOInterface $io = null): void
- {
- set_error_handler([__CLASS__, 'handle']);
- error_reporting(E_ALL | E_STRICT);
- self::$io = $io;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Util;
- use Composer\Pcre\Preg;
- use React\Promise\PromiseInterface;
- use RecursiveDirectoryIterator;
- use RecursiveIteratorIterator;
- use Symfony\Component\Filesystem\Exception\IOException;
- use Symfony\Component\Finder\Finder;
- class Filesystem
- {
- private $processExecutor;
- public function __construct(?ProcessExecutor $executor = null)
- {
- $this->processExecutor = $executor;
- }
- public function remove(string $file)
- {
- if (is_dir($file)) {
- return $this->removeDirectory($file);
- }
- if (file_exists($file)) {
- return $this->unlink($file);
- }
- return false;
- }
- public function isDirEmpty(string $dir)
- {
- $finder = Finder::create()
- ->ignoreVCS(false)
- ->ignoreDotFiles(false)
- ->depth(0)
- ->in($dir);
- return \count($finder) === 0;
- }
- public function emptyDirectory(string $dir, bool $ensureDirectoryExists = true)
- {
- if (is_link($dir) && file_exists($dir)) {
- $this->unlink($dir);
- }
- if ($ensureDirectoryExists) {
- $this->ensureDirectoryExists($dir);
- }
- if (is_dir($dir)) {
- $finder = Finder::create()
- ->ignoreVCS(false)
- ->ignoreDotFiles(false)
- ->depth(0)
- ->in($dir);
- foreach ($finder as $path) {
- $this->remove((string) $path);
- }
- }
- }
- public function removeDirectory(string $directory)
- {
- $edgeCaseResult = $this->removeEdgeCases($directory);
- if ($edgeCaseResult !== null) {
- return $edgeCaseResult;
- }
- if (Platform::isWindows()) {
- $cmd = sprintf('rmdir /S /Q %s', ProcessExecutor::escape(realpath($directory)));
- } else {
- $cmd = sprintf('rm -rf %s', ProcessExecutor::escape($directory));
- }
- $result = $this->getProcess()->execute($cmd, $output) === 0;
- clearstatcache();
- if ($result && !is_dir($directory)) {
- return true;
- }
- return $this->removeDirectoryPhp($directory);
- }
- public function removeDirectoryAsync(string $directory)
- {
- $edgeCaseResult = $this->removeEdgeCases($directory);
- if ($edgeCaseResult !== null) {
- return \React\Promise\resolve($edgeCaseResult);
- }
- if (Platform::isWindows()) {
- $cmd = sprintf('rmdir /S /Q %s', ProcessExecutor::escape(realpath($directory)));
- } else {
- $cmd = sprintf('rm -rf %s', ProcessExecutor::escape($directory));
- }
- $promise = $this->getProcess()->executeAsync($cmd);
- return $promise->then(function ($process) use ($directory) {
- clearstatcache();
- if ($process->isSuccessful()) {
- if (!is_dir($directory)) {
- return \React\Promise\resolve(true);
- }
- }
- return \React\Promise\resolve($this->removeDirectoryPhp($directory));
- });
- }
- private function removeEdgeCases(string $directory, bool $fallbackToPhp = true): ?bool
- {
- if ($this->isSymlinkedDirectory($directory)) {
- return $this->unlinkSymlinkedDirectory($directory);
- }
- if ($this->isJunction($directory)) {
- return $this->removeJunction($directory);
- }
- if (is_link($directory)) {
- return unlink($directory);
- }
- if (!is_dir($directory) || !file_exists($directory)) {
- return true;
- }
- if (Preg::isMatch('{^(?:[a-z]:)?[/\\\\]+$}i', $directory)) {
- throw new \RuntimeException('Aborting an attempted deletion of '.$directory.', this was probably not intended, if it is a real use case please report it.');
- }
- if (!\function_exists('proc_open') && $fallbackToPhp) {
- return $this->removeDirectoryPhp($directory);
- }
- return null;
- }
- public function removeDirectoryPhp(string $directory)
- {
- $edgeCaseResult = $this->removeEdgeCases($directory, false);
- if ($edgeCaseResult !== null) {
- return $edgeCaseResult;
- }
- try {
- $it = new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::SKIP_DOTS);
- } catch (\UnexpectedValueException $e) {
- clearstatcache();
- usleep(100000);
- if (!is_dir($directory)) {
- return true;
- }
- $it = new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::SKIP_DOTS);
- }
- $ri = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
- foreach ($ri as $file) {
- if ($file->isDir()) {
- $this->rmdir($file->getPathname());
- } else {
- $this->unlink($file->getPathname());
- }
- }
- unset($ri, $it, $file);
- return $this->rmdir($directory);
- }
- public function ensureDirectoryExists(string $directory)
- {
- if (!is_dir($directory)) {
- if (file_exists($directory)) {
- throw new \RuntimeException(
- $directory.' exists and is not a directory.'
- );
- }
- if (!@mkdir($directory, 0777, true)) {
- throw new \RuntimeException(
- $directory.' does not exist and could not be created.'
- );
- }
- }
- }
- public function unlink(string $path)
- {
- $unlinked = @$this->unlinkImplementation($path);
- if (!$unlinked) {
- if (Platform::isWindows()) {
- usleep(350000);
- $unlinked = @$this->unlinkImplementation($path);
- }
- if (!$unlinked) {
- $error = error_get_last();
- $message = 'Could not delete '.$path.': ' . ($error['message'] ?? '');
- if (Platform::isWindows()) {
- $message .= "\nThis can be due to an antivirus or the Windows Search Indexer locking the file while they are analyzed";
- }
- throw new \RuntimeException($message);
- }
- }
- return true;
- }
- public function rmdir(string $path)
- {
- $deleted = @rmdir($path);
- if (!$deleted) {
- if (Platform::isWindows()) {
- usleep(350000);
- $deleted = @rmdir($path);
- }
- if (!$deleted) {
- $error = error_get_last();
- $message = 'Could not delete '.$path.': ' . ($error['message'] ?? '');
- if (Platform::isWindows()) {
- $message .= "\nThis can be due to an antivirus or the Windows Search Indexer locking the file while they are analyzed";
- }
- throw new \RuntimeException($message);
- }
- }
- return true;
- }
- public function copyThenRemove(string $source, string $target)
- {
- $this->copy($source, $target);
- if (!is_dir($source)) {
- $this->unlink($source);
- return;
- }
- $this->removeDirectoryPhp($source);
- }
- public function copy(string $source, string $target)
- {
- if (!is_dir($source)) {
- return copy($source, $target);
- }
- $it = new RecursiveDirectoryIterator($source, RecursiveDirectoryIterator::SKIP_DOTS);
- $ri = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::SELF_FIRST);
- $this->ensureDirectoryExists($target);
- $result = true;
- foreach ($ri as $file) {
- $targetPath = $target . DIRECTORY_SEPARATOR . $ri->getSubPathname();
- if ($file->isDir()) {
- $this->ensureDirectoryExists($targetPath);
- } else {
- $result = $result && copy($file->getPathname(), $targetPath);
- }
- }
- return $result;
- }
- public function rename(string $source, string $target)
- {
- if (true === @rename($source, $target)) {
- return;
- }
- if (!\function_exists('proc_open')) {
- $this->copyThenRemove($source, $target);
- return;
- }
- if (Platform::isWindows()) {
- $command = sprintf('xcopy %s %s /E /I /Q /Y', ProcessExecutor::escape($source), ProcessExecutor::escape($target));
- $result = $this->getProcess()->execute($command, $output);
- clearstatcache();
- if (0 === $result) {
- $this->remove($source);
- return;
- }
- } else {
- $command = sprintf('mv %s %s', ProcessExecutor::escape($source), ProcessExecutor::escape($target));
- $result = $this->getProcess()->execute($command, $output);
- clearstatcache();
- if (0 === $result) {
- return;
- }
- }
- $this->copyThenRemove($source, $target);
- }
- public function findShortestPath(string $from, string $to, bool $directories = false)
- {
- if (!$this->isAbsolutePath($from) || !$this->isAbsolutePath($to)) {
- throw new \InvalidArgumentException(sprintf('$from (%s) and $to (%s) must be absolute paths.', $from, $to));
- }
- $from = $this->normalizePath($from);
- $to = $this->normalizePath($to);
- if ($directories) {
- $from = rtrim($from, '/') . '/dummy_file';
- }
- if (\dirname($from) === \dirname($to)) {
- return './'.basename($to);
- }
- $commonPath = $to;
- while (strpos($from.'/', $commonPath.'/') !== 0 && '/' !== $commonPath && !Preg::isMatch('{^[A-Z]:/?$}i', $commonPath)) {
- $commonPath = strtr(\dirname($commonPath), '\\', '/');
- }
- if (0 !== strpos($from, $commonPath) || '/' === $commonPath) {
- return $to;
- }
- $commonPath = rtrim($commonPath, '/') . '/';
- $sourcePathDepth = substr_count((string) substr($from, \strlen($commonPath)), '/');
- $commonPathCode = str_repeat('../', $sourcePathDepth);
- $result = $commonPathCode . substr($to, \strlen($commonPath));
- if (\strlen($result) === 0) {
- return './';
- }
- return $result;
- }
- public function findShortestPathCode(string $from, string $to, bool $directories = false, bool $staticCode = false)
- {
- if (!$this->isAbsolutePath($from) || !$this->isAbsolutePath($to)) {
- throw new \InvalidArgumentException(sprintf('$from (%s) and $to (%s) must be absolute paths.', $from, $to));
- }
- $from = $this->normalizePath($from);
- $to = $this->normalizePath($to);
- if ($from === $to) {
- return $directories ? '__DIR__' : '__FILE__';
- }
- $commonPath = $to;
- while (strpos($from.'/', $commonPath.'/') !== 0 && '/' !== $commonPath && !Preg::isMatch('{^[A-Z]:/?$}i', $commonPath) && '.' !== $commonPath) {
- $commonPath = strtr(\dirname($commonPath), '\\', '/');
- }
- if (0 !== strpos($from, $commonPath) || '/' === $commonPath || '.' === $commonPath) {
- return var_export($to, true);
- }
- $commonPath = rtrim($commonPath, '/') . '/';
- if (strpos($to, $from.'/') === 0) {
- return '__DIR__ . '.var_export((string) substr($to, \strlen($from)), true);
- }
- $sourcePathDepth = substr_count((string) substr($from, \strlen($commonPath)), '/') + (int) $directories;
- if ($staticCode) {
- $commonPathCode = "__DIR__ . '".str_repeat('/..', $sourcePathDepth)."'";
- } else {
- $commonPathCode = str_repeat('dirname(', $sourcePathDepth).'__DIR__'.str_repeat(')', $sourcePathDepth);
- }
- $relTarget = (string) substr($to, \strlen($commonPath));
- return $commonPathCode . (\strlen($relTarget) > 0 ? '.' . var_export('/' . $relTarget, true) : '');
- }
- public function isAbsolutePath(string $path)
- {
- return strpos($path, '/') === 0 || substr($path, 1, 1) === ':' || strpos($path, '\\\\') === 0;
- }
- public function size(string $path)
- {
- if (!file_exists($path)) {
- throw new \RuntimeException("$path does not exist.");
- }
- if (is_dir($path)) {
- return $this->directorySize($path);
- }
- return (int) filesize($path);
- }
- public function normalizePath(string $path)
- {
- $parts = [];
- $path = strtr($path, '\\', '/');
- $prefix = '';
- $absolute = '';
- if (strpos($path, '//') === 0 && \strlen($path) > 2) {
- $absolute = '//';
- $path = substr($path, 2);
- }
- if (Preg::isMatch('{^( [0-9a-z]{2,}+: (?: // (?: [a-z]: )? )? | [a-z]: )}ix', $path, $match)) {
- $prefix = $match[1];
- $path = substr($path, \strlen($prefix));
- }
- if (strpos($path, '/') === 0) {
- $absolute = '/';
- $path = substr($path, 1);
- }
- $up = false;
- foreach (explode('/', $path) as $chunk) {
- if ('..' === $chunk && (\strlen($absolute) > 0 || $up)) {
- array_pop($parts);
- $up = !(\count($parts) === 0 || '..' === end($parts));
- } elseif ('.' !== $chunk && '' !== $chunk) {
- $parts[] = $chunk;
- $up = '..' !== $chunk;
- }
- }
- $prefix = Preg::replaceCallback('{(^|://)[a-z]:$}i', static function (array $m) {
- return strtoupper($m[0]);
- }, $prefix);
- return $prefix.$absolute.implode('/', $parts);
- }
- public static function trimTrailingSlash(string $path)
- {
- if (!Preg::isMatch('{^[/\\\\]+$}', $path)) {
- $path = rtrim($path, '/\\');
- }
- return $path;
- }
- public static function isLocalPath(string $path)
- {
- return Preg::isMatch('{^(file://(?!//)|/(?!/)|/?[a-z]:[\\\\/]|\.\.[\\\\/]|[a-z0-9_.-]+[\\\\/])}i', $path);
- }
- public static function getPlatformPath(string $path)
- {
- if (Platform::isWindows()) {
- $path = Preg::replace('{^(?:file:///([a-z]):?/)}i', 'file://$1:/', $path);
- }
- return Preg::replace('{^file://}i', '', $path);
- }
- public static function isReadable(string $path)
- {
- if (is_readable($path)) {
- return true;
- }
- if (is_file($path)) {
- return false !== Silencer::call('file_get_contents', $path, false, null, 0, 1);
- }
- if (is_dir($path)) {
- return false !== Silencer::call('opendir', $path);
- }
- return false;
- }
- protected function directorySize(string $directory)
- {
- $it = new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::SKIP_DOTS);
- $ri = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
- $size = 0;
- foreach ($ri as $file) {
- if ($file->isFile()) {
- $size += $file->getSize();
- }
- }
- return $size;
- }
- protected function getProcess()
- {
- if (null === $this->processExecutor) {
- $this->processExecutor = new ProcessExecutor();
- }
- return $this->processExecutor;
- }
- private function unlinkImplementation(string $path): bool
- {
- if (Platform::isWindows() && is_dir($path) && is_link($path)) {
- return rmdir($path);
- }
- return unlink($path);
- }
- public function relativeSymlink(string $target, string $link)
- {
- if (!function_exists('symlink')) {
- return false;
- }
- $cwd = Platform::getCwd();
- $relativePath = $this->findShortestPath($link, $target);
- chdir(\dirname($link));
- $result = @symlink($relativePath, $link);
- chdir($cwd);
- return $result;
- }
- public function isSymlinkedDirectory(string $directory)
- {
- if (!is_dir($directory)) {
- return false;
- }
- $resolved = $this->resolveSymlinkedDirectorySymlink($directory);
- return is_link($resolved);
- }
- private function unlinkSymlinkedDirectory(string $directory): bool
- {
- $resolved = $this->resolveSymlinkedDirectorySymlink($directory);
- return $this->unlink($resolved);
- }
- private function resolveSymlinkedDirectorySymlink(string $pathname): string
- {
- if (!is_dir($pathname)) {
- return $pathname;
- }
- $resolved = rtrim($pathname, '/');
- if (0 === \strlen($resolved)) {
- return $pathname;
- }
- return $resolved;
- }
- public function junction(string $target, string $junction)
- {
- if (!Platform::isWindows()) {
- throw new \LogicException(sprintf('Function %s is not available on non-Windows platform', __CLASS__));
- }
- if (!is_dir($target)) {
- throw new IOException(sprintf('Cannot junction to "%s" as it is not a directory.', $target), 0, null, $target);
- }
- $cmd = sprintf(
- 'mklink /J %s %s',
- ProcessExecutor::escape(str_replace('/', DIRECTORY_SEPARATOR, $junction)),
- ProcessExecutor::escape(realpath($target))
- );
- if ($this->getProcess()->execute($cmd, $output) !== 0) {
- throw new IOException(sprintf('Failed to create junction to "%s" at "%s".', $target, $junction), 0, null, $target);
- }
- clearstatcache(true, $junction);
- }
- public function isJunction(string $junction)
- {
- if (!Platform::isWindows()) {
- return false;
- }
- clearstatcache(true, $junction);
- if (!is_dir($junction) || is_link($junction)) {
- return false;
- }
- $stat = lstat($junction);
- return is_array($stat) ? 0x4000 !== ($stat['mode'] & 0xF000) : false;
- }
- public function removeJunction(string $junction)
- {
- if (!Platform::isWindows()) {
- return false;
- }
- $junction = rtrim(str_replace('/', DIRECTORY_SEPARATOR, $junction), DIRECTORY_SEPARATOR);
- if (!$this->isJunction($junction)) {
- throw new IOException(sprintf('%s is not a junction and thus cannot be removed as one', $junction));
- }
- return $this->rmdir($junction);
- }
- public function filePutContentsIfModified(string $path, string $content)
- {
- $currentContent = Silencer::call('file_get_contents', $path);
- if (false === $currentContent || $currentContent !== $content) {
- return file_put_contents($path, $content);
- }
- return 0;
- }
- public function safeCopy(string $source, string $target)
- {
- if (!file_exists($target) || !file_exists($source) || !$this->filesAreEqual($source, $target)) {
- $sourceHandle = fopen($source, 'r');
- assert($sourceHandle !== false, 'Could not open "'.$source.'" for reading.');
- $targetHandle = fopen($target, 'w+');
- assert($targetHandle !== false, 'Could not open "'.$target.'" for writing.');
- stream_copy_to_stream($sourceHandle, $targetHandle);
- fclose($sourceHandle);
- fclose($targetHandle);
- }
- }
- private function filesAreEqual(string $a, string $b): bool
- {
- if (filesize($a) !== filesize($b)) {
- return false;
- }
- $aHandle = fopen($a, 'rb');
- assert($aHandle !== false, 'Could not open "'.$a.'" for reading.');
- $bHandle = fopen($b, 'rb');
- assert($bHandle !== false, 'Could not open "'.$b.'" for reading.');
- $result = true;
- while (!feof($aHandle)) {
- if (fread($aHandle, 8192) !== fread($bHandle, 8192)) {
- $result = false;
- break;
- }
- }
- fclose($aHandle);
- fclose($bHandle);
- return $result;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Util;
- use Composer\Config;
- use Composer\IO\IOInterface;
- use Composer\Pcre\Preg;
- class Git
- {
- private static $version = false;
- protected $io;
- protected $config;
- protected $process;
- protected $filesystem;
- public function __construct(IOInterface $io, Config $config, ProcessExecutor $process, Filesystem $fs)
- {
- $this->io = $io;
- $this->config = $config;
- $this->process = $process;
- $this->filesystem = $fs;
- }
- public function runCommand(callable $commandCallable, string $url, ?string $cwd, bool $initialClone = false, &$commandOutput = null): void
- {
- $this->config->prohibitUrlByConfig($url, $this->io);
- if ($initialClone) {
- $origCwd = $cwd;
- $cwd = null;
- }
- if (Preg::isMatch('{^ssh://[^@]+@[^:]+:[^0-9]+}', $url)) {
- 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.');
- }
- if (!$initialClone) {
- $this->process->execute('git remote -v', $output, $cwd);
- if (Preg::isMatch('{^(?:composer|origin)\s+https?://(.+):(.+)@([^/]+)}im', $output, $match) && !$this->io->hasAuthentication($match[3])) {
- $this->io->setAuthentication($match[3], rawurldecode($match[1]), rawurldecode($match[2]));
- }
- }
- $protocols = $this->config->get('github-protocols');
- if (Preg::isMatch('{^(?:https?|git)://' . self::getGitHubDomainsRegex($this->config) . '/(.*)}', $url, $match)) {
- $messages = [];
- foreach ($protocols as $protocol) {
- if ('ssh' === $protocol) {
- $protoUrl = "git@" . $match[1] . ":" . $match[2];
- } else {
- $protoUrl = $protocol . "://" . $match[1] . "/" . $match[2];
- }
- if (0 === $this->process->execute($commandCallable($protoUrl), $commandOutput, $cwd)) {
- return;
- }
- $messages[] = '- ' . $protoUrl . "\n" . Preg::replace('#^#m', ' ', $this->process->getErrorOutput());
- if ($initialClone && isset($origCwd)) {
- $this->filesystem->removeDirectory($origCwd);
- }
- }
- if (!$this->io->hasAuthentication($match[1]) && !$this->io->isInteractive()) {
- $this->throwException('Failed to clone ' . $url . ' via ' . implode(', ', $protocols) . ' protocols, aborting.' . "\n\n" . implode("\n", $messages), $url);
- }
- }
- $bypassSshForGitHub = Preg::isMatch('{^git@' . self::getGitHubDomainsRegex($this->config) . ':(.+?)\.git$}i', $url) && !in_array('ssh', $protocols, true);
- $command = $commandCallable($url);
- $auth = null;
- $credentials = [];
- if ($bypassSshForGitHub || 0 !== $this->process->execute($command, $commandOutput, $cwd)) {
- $errorMsg = $this->process->getErrorOutput();
- if (Preg::isMatch('{^git@' . self::getGitHubDomainsRegex($this->config) . ':(.+?)\.git$}i', $url, $match)
- || Preg::isMatch('{^https?://' . self::getGitHubDomainsRegex($this->config) . '/(.*?)(?:\.git)?$}i', $url, $match)
- ) {
- if (!$this->io->hasAuthentication($match[1])) {
- $gitHubUtil = new GitHub($this->io, $this->config, $this->process);
- $message = 'Cloning failed using an ssh key for authentication, enter your GitHub credentials to access private repos';
- if (!$gitHubUtil->authorizeOAuth($match[1]) && $this->io->isInteractive()) {
- $gitHubUtil->authorizeOAuthInteractively($match[1], $message);
- }
- }
- if ($this->io->hasAuthentication($match[1])) {
- $auth = $this->io->getAuthentication($match[1]);
- $authUrl = 'https://' . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[1] . '/' . $match[2] . '.git';
- $command = $commandCallable($authUrl);
- if (0 === $this->process->execute($command, $commandOutput, $cwd)) {
- return;
- }
- $credentials = [rawurlencode($auth['username']), rawurlencode($auth['password'])];
- $errorMsg = $this->process->getErrorOutput();
- }
- } elseif (Preg::isMatch('{^https://(bitbucket\.org)/(.*?)(?:\.git)?$}i', $url, $match)) {
- $bitbucketUtil = new Bitbucket($this->io, $this->config, $this->process);
- if (!$this->io->hasAuthentication($match[1])) {
- $message = 'Enter your Bitbucket credentials to access private repos';
- if (!$bitbucketUtil->authorizeOAuth($match[1]) && $this->io->isInteractive()) {
- $bitbucketUtil->authorizeOAuthInteractively($match[1], $message);
- $accessToken = $bitbucketUtil->getToken();
- $this->io->setAuthentication($match[1], 'x-token-auth', $accessToken);
- }
- } else {
- $auth = $this->io->getAuthentication($match[1]);
- if ($auth['username'] !== 'x-token-auth') {
- $accessToken = $bitbucketUtil->requestToken($match[1], $auth['username'], $auth['password']);
- if (!empty($accessToken)) {
- $this->io->setAuthentication($match[1], 'x-token-auth', $accessToken);
- }
- }
- }
- if ($this->io->hasAuthentication($match[1])) {
- $auth = $this->io->getAuthentication($match[1]);
- $authUrl = 'https://' . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[1] . '/' . $match[2] . '.git';
- $command = $commandCallable($authUrl);
- if (0 === $this->process->execute($command, $commandOutput, $cwd)) {
- return;
- }
- $credentials = [rawurlencode($auth['username']), rawurlencode($auth['password'])];
- $errorMsg = $this->process->getErrorOutput();
- } else {
- $sshUrl = 'git@bitbucket.org:' . $match[2] . '.git';
- $this->io->writeError(' No bitbucket authentication configured. Falling back to ssh.');
- $command = $commandCallable($sshUrl);
- if (0 === $this->process->execute($command, $commandOutput, $cwd)) {
- return;
- }
- $errorMsg = $this->process->getErrorOutput();
- }
- } elseif (
- Preg::isMatch('{^(git)@' . self::getGitLabDomainsRegex($this->config) . ':(.+?\.git)$}i', $url, $match)
- || Preg::isMatch('{^(https?)://' . self::getGitLabDomainsRegex($this->config) . '/(.*)}i', $url, $match)
- ) {
- if ($match[1] === 'git') {
- $match[1] = 'https';
- }
- if (!$this->io->hasAuthentication($match[2])) {
- $gitLabUtil = new GitLab($this->io, $this->config, $this->process);
- $message = 'Cloning failed, enter your GitLab credentials to access private repos';
- if (!$gitLabUtil->authorizeOAuth($match[2]) && $this->io->isInteractive()) {
- $gitLabUtil->authorizeOAuthInteractively($match[1], $match[2], $message);
- }
- }
- if ($this->io->hasAuthentication($match[2])) {
- $auth = $this->io->getAuthentication($match[2]);
- if ($auth['password'] === 'private-token' || $auth['password'] === 'oauth2' || $auth['password'] === 'gitlab-ci-token') {
- $authUrl = $match[1] . '://' . rawurlencode($auth['password']) . ':' . rawurlencode($auth['username']) . '@' . $match[2] . '/' . $match[3];
- } else {
- $authUrl = $match[1] . '://' . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[2] . '/' . $match[3];
- }
- $command = $commandCallable($authUrl);
- if (0 === $this->process->execute($command, $commandOutput, $cwd)) {
- return;
- }
- $credentials = [rawurlencode($auth['username']), rawurlencode($auth['password'])];
- $errorMsg = $this->process->getErrorOutput();
- }
- } elseif ($this->isAuthenticationFailure($url, $match)) {
- if (strpos($match[2], '@')) {
- [$authParts, $match[2]] = explode('@', $match[2], 2);
- }
- $storeAuth = false;
- if ($this->io->hasAuthentication($match[2])) {
- $auth = $this->io->getAuthentication($match[2]);
- } elseif ($this->io->isInteractive()) {
- $defaultUsername = null;
- if (isset($authParts) && $authParts) {
- if (false !== strpos($authParts, ':')) {
- [$defaultUsername, ] = explode(':', $authParts, 2);
- } else {
- $defaultUsername = $authParts;
- }
- }
- $this->io->writeError(' Authentication required (<info>' . $match[2] . '</info>):');
- $auth = [
- 'username' => $this->io->ask(' Username: ', $defaultUsername),
- 'password' => $this->io->askAndHideAnswer(' Password: '),
- ];
- $storeAuth = $this->config->get('store-auths');
- }
- if (null !== $auth) {
- $authUrl = $match[1] . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[2] . $match[3];
- $command = $commandCallable($authUrl);
- if (0 === $this->process->execute($command, $commandOutput, $cwd)) {
- $this->io->setAuthentication($match[2], $auth['username'], $auth['password']);
- $authHelper = new AuthHelper($this->io, $this->config);
- $authHelper->storeAuth($match[2], $storeAuth);
- return;
- }
- $credentials = [rawurlencode($auth['username']), rawurlencode($auth['password'])];
- $errorMsg = $this->process->getErrorOutput();
- }
- }
- if ($initialClone && isset($origCwd)) {
- $this->filesystem->removeDirectory($origCwd);
- }
- if (count($credentials) > 0) {
- $command = $this->maskCredentials($command, $credentials);
- $errorMsg = $this->maskCredentials($errorMsg, $credentials);
- }
- $this->throwException('Failed to execute ' . $command . "\n\n" . $errorMsg, $url);
- }
- }
- public function syncMirror(string $url, string $dir): bool
- {
- if (Platform::getEnv('COMPOSER_DISABLE_NETWORK') && Platform::getEnv('COMPOSER_DISABLE_NETWORK') !== 'prime') {
- $this->io->writeError('<warning>Aborting git mirror sync of '.$url.' as network is disabled</warning>');
- return false;
- }
- if (is_dir($dir) && 0 === $this->process->execute('git rev-parse --git-dir', $output, $dir) && trim($output) === '.') {
- try {
- $commandCallable = static function ($url): string {
- $sanitizedUrl = Preg::replace('{://([^@]+?):(.+?)@}', '://', $url);
- return sprintf('git remote set-url origin -- %s && git remote update --prune origin && git remote set-url origin -- %s && git gc --auto', ProcessExecutor::escape($url), ProcessExecutor::escape($sanitizedUrl));
- };
- $this->runCommand($commandCallable, $url, $dir);
- } catch (\Exception $e) {
- $this->io->writeError('<error>Sync mirror failed: ' . $e->getMessage() . '</error>', true, IOInterface::DEBUG);
- return false;
- }
- return true;
- }
- $this->filesystem->removeDirectory($dir);
- $commandCallable = static function ($url) use ($dir): string {
- return sprintf('git clone --mirror -- %s %s', ProcessExecutor::escape($url), ProcessExecutor::escape($dir));
- };
- $this->runCommand($commandCallable, $url, $dir, true);
- return true;
- }
- public function fetchRefOrSyncMirror(string $url, string $dir, string $ref, string $prettyVersion = null): bool
- {
- if ($this->checkRefIsInMirror($dir, $ref)) {
- if (Preg::isMatch('{^[a-f0-9]{40}$}', $ref) && $prettyVersion !== null) {
- $branch = Preg::replace('{(?:^dev-|(?:\.x)?-dev$)}i', '', $prettyVersion);
- $branches = null;
- $tags = null;
- if (0 === $this->process->execute('git branch', $output, $dir)) {
- $branches = $output;
- }
- if (0 === $this->process->execute('git tag', $output, $dir)) {
- $tags = $output;
- }
- if (null !== $branches && !Preg::isMatch('{^[\s*]*v?'.preg_quote($branch).'$}m', $branches)
- && null !== $tags && !Preg::isMatch('{^[\s*]*'.preg_quote($branch).'$}m', $tags)
- ) {
- $this->syncMirror($url, $dir);
- }
- }
- return true;
- }
- if ($this->syncMirror($url, $dir)) {
- return $this->checkRefIsInMirror($dir, $ref);
- }
- return false;
- }
- public static function getNoShowSignatureFlag(ProcessExecutor $process): string
- {
- $gitVersion = self::getVersion($process);
- if ($gitVersion && version_compare($gitVersion, '2.10.0-rc0', '>=')) {
- return ' --no-show-signature';
- }
- return '';
- }
- private function checkRefIsInMirror(string $dir, string $ref): bool
- {
- if (is_dir($dir) && 0 === $this->process->execute('git rev-parse --git-dir', $output, $dir) && trim($output) === '.') {
- $escapedRef = ProcessExecutor::escape($ref.'^{commit}');
- $exitCode = $this->process->execute(sprintf('git rev-parse --quiet --verify %s', $escapedRef), $ignoredOutput, $dir);
- if ($exitCode === 0) {
- return true;
- }
- }
- return false;
- }
- private function isAuthenticationFailure(string $url, array &$match): bool
- {
- if (!Preg::isMatch('{^(https?://)([^/]+)(.*)$}i', $url, $match)) {
- return false;
- }
- $authFailures = [
- 'fatal: Authentication failed',
- 'remote error: Invalid username or password.',
- 'error: 401 Unauthorized',
- 'fatal: unable to access',
- 'fatal: could not read Username',
- ];
- $errorOutput = $this->process->getErrorOutput();
- foreach ($authFailures as $authFailure) {
- if (strpos($errorOutput, $authFailure) !== false) {
- return true;
- }
- }
- return false;
- }
- public function getMirrorDefaultBranch(string $url, string $dir, bool $isLocalPathRepository): ?string
- {
- if ((bool) Platform::getEnv('COMPOSER_DISABLE_NETWORK')) {
- return null;
- }
- try {
- if ($isLocalPathRepository) {
- $this->process->execute('git remote show origin', $output, $dir);
- } else {
- $commandCallable = static function ($url): string {
- $sanitizedUrl = Preg::replace('{://([^@]+?):(.+?)@}', '://', $url);
- return sprintf('git remote set-url origin -- %s && git remote show origin && git remote set-url origin -- %s', ProcessExecutor::escape($url), ProcessExecutor::escape($sanitizedUrl));
- };
- $this->runCommand($commandCallable, $url, $dir, false, $output);
- }
- $lines = $this->process->splitLines($output);
- foreach ($lines as $line) {
- if (Preg::match('{^\s*HEAD branch:\s(.+)\s*$}m', $line, $matches) > 0) {
- return $matches[1];
- }
- }
- } catch (\Exception $e) {
- $this->io->writeError('<error>Failed to fetch root identifier from remote: ' . $e->getMessage() . '</error>', true, IOInterface::DEBUG);
- }
- return null;
- }
- public static function cleanEnv(): void
- {
- if (Platform::getEnv('GIT_ASKPASS') !== 'echo') {
- Platform::putEnv('GIT_ASKPASS', 'echo');
- }
- if (Platform::getEnv('GIT_DIR')) {
- Platform::clearEnv('GIT_DIR');
- }
- if (Platform::getEnv('GIT_WORK_TREE')) {
- Platform::clearEnv('GIT_WORK_TREE');
- }
- if (Platform::getEnv('LANGUAGE') !== 'C') {
- Platform::putEnv('LANGUAGE', 'C');
- }
- Platform::clearEnv('DYLD_LIBRARY_PATH');
- }
- public static function getGitHubDomainsRegex(Config $config): string
- {
- return '(' . implode('|', array_map('preg_quote', $config->get('github-domains'))) . ')';
- }
- public static function getGitLabDomainsRegex(Config $config): string
- {
- return '(' . implode('|', array_map('preg_quote', $config->get('gitlab-domains'))) . ')';
- }
- private function throwException($message, string $url): void
- {
- clearstatcache();
- if (0 !== $this->process->execute('git --version', $ignoredOutput)) {
- 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()));
- }
- throw new \RuntimeException(Url::sanitize($message));
- }
- public static function getVersion(ProcessExecutor $process): ?string
- {
- if (false === self::$version) {
- self::$version = null;
- if (0 === $process->execute('git --version', $output) && Preg::isMatch('/^git version (\d+(?:\.\d+)+)/m', $output, $matches)) {
- self::$version = $matches[1];
- }
- }
- return self::$version;
- }
- private function maskCredentials(string $error, array $credentials): string
- {
- $maskedCredentials = [];
- foreach ($credentials as $credential) {
- if (in_array($credential, ['private-token', 'x-token-auth', 'oauth2', 'gitlab-ci-token', 'x-oauth-basic'])) {
- $maskedCredentials[] = $credential;
- } elseif (strlen($credential) > 6) {
- $maskedCredentials[] = substr($credential, 0, 3) . '...' . substr($credential, -3);
- } elseif (strlen($credential) > 3) {
- $maskedCredentials[] = substr($credential, 0, 3) . '...';
- } else {
- $maskedCredentials[] = 'XXX';
- }
- }
- return str_replace($credentials, $maskedCredentials, $error);
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Util;
- use Composer\Factory;
- use Composer\IO\IOInterface;
- use Composer\Config;
- use Composer\Downloader\TransportException;
- use Composer\Pcre\Preg;
- class GitHub
- {
- protected $io;
- protected $config;
- protected $process;
- protected $httpDownloader;
- public function __construct(IOInterface $io, Config $config, ?ProcessExecutor $process = null, ?HttpDownloader $httpDownloader = null)
- {
- $this->io = $io;
- $this->config = $config;
- $this->process = $process ?: new ProcessExecutor($io);
- $this->httpDownloader = $httpDownloader ?: Factory::createHttpDownloader($this->io, $config);
- }
- public function authorizeOAuth(string $originUrl): bool
- {
- if (!in_array($originUrl, $this->config->get('github-domains'))) {
- return false;
- }
- if (0 === $this->process->execute('git config github.accesstoken', $output)) {
- $this->io->setAuthentication($originUrl, trim($output), 'x-oauth-basic');
- return true;
- }
- return false;
- }
- public function authorizeOAuthInteractively(string $originUrl, ?string $message = null): bool
- {
- if ($message) {
- $this->io->writeError($message);
- }
- $note = 'Composer';
- if ($this->config->get('github-expose-hostname') === true && 0 === $this->process->execute('hostname', $output)) {
- $note .= ' on ' . trim($output);
- }
- $note .= ' ' . date('Y-m-d Hi');
- $url = 'https://'.$originUrl.'/settings/tokens/new?scopes=&description=' . str_replace('%20', '+', rawurlencode($note));
- $this->io->writeError(sprintf('When working with _public_ GitHub repositories only, head to %s to retrieve a token.', $url));
- $this->io->writeError('This token will have read-only permission for public information only.');
- $url = 'https://'.$originUrl.'/settings/tokens/new?scopes=repo&description=' . str_replace('%20', '+', rawurlencode($note));
- $this->io->writeError(sprintf('When you need to access _private_ GitHub repositories as well, go to %s', $url));
- $this->io->writeError('Note that such tokens have broad read/write permissions on your behalf, even if not needed by Composer.');
- $this->io->writeError(sprintf('Tokens will be stored in plain text in "%s" for future use by Composer.', $this->config->getAuthConfigSource()->getName()));
- $this->io->writeError('For additional information, check https://getcomposer.org/doc/articles/authentication-for-private-packages.md#github-oauth');
- $token = trim((string) $this->io->askAndHideAnswer('Token (hidden): '));
- if ($token === '') {
- $this->io->writeError('<warning>No token given, aborting.</warning>');
- $this->io->writeError('You can also add it manually later by using "composer config --global --auth github-oauth.github.com <token>"');
- return false;
- }
- $this->io->setAuthentication($originUrl, $token, 'x-oauth-basic');
- try {
- $apiUrl = ('github.com' === $originUrl) ? 'api.github.com/' : $originUrl . '/api/v3/';
- $this->httpDownloader->get('https://'. $apiUrl, [
- 'retry-auth-failure' => false,
- ]);
- } catch (TransportException $e) {
- if (in_array($e->getCode(), [403, 401])) {
- $this->io->writeError('<error>Invalid token provided.</error>');
- $this->io->writeError('You can also add it manually later by using "composer config --global --auth github-oauth.github.com <token>"');
- return false;
- }
- throw $e;
- }
- $this->config->getConfigSource()->removeConfigSetting('github-oauth.'.$originUrl);
- $this->config->getAuthConfigSource()->addConfigSetting('github-oauth.'.$originUrl, $token);
- $this->io->writeError('<info>Token stored successfully.</info>');
- return true;
- }
- public function getRateLimit(array $headers): array
- {
- $rateLimit = [
- 'limit' => '?',
- 'reset' => '?',
- ];
- foreach ($headers as $header) {
- $header = trim($header);
- if (false === strpos($header, 'X-RateLimit-')) {
- continue;
- }
- [$type, $value] = explode(':', $header, 2);
- switch ($type) {
- case 'X-RateLimit-Limit':
- $rateLimit['limit'] = (int) trim($value);
- break;
- case 'X-RateLimit-Reset':
- $rateLimit['reset'] = date('Y-m-d H:i:s', (int) trim($value));
- break;
- }
- }
- return $rateLimit;
- }
- public function getSsoUrl(array $headers): ?string
- {
- foreach ($headers as $header) {
- $header = trim($header);
- if (false === stripos($header, 'x-github-sso: required')) {
- continue;
- }
- if (Preg::isMatch('{\burl=(?P<url>[^\s;]+)}', $header, $match)) {
- return $match['url'];
- }
- }
- return null;
- }
- public function isRateLimited(array $headers): bool
- {
- foreach ($headers as $header) {
- if (Preg::isMatch('{^X-RateLimit-Remaining: *0$}i', trim($header))) {
- return true;
- }
- }
- return false;
- }
- public function requiresSso(array $headers): bool
- {
- foreach ($headers as $header) {
- if (Preg::isMatch('{^X-GitHub-SSO: required}i', trim($header))) {
- return true;
- }
- }
- return false;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Util;
- use Composer\IO\IOInterface;
- use Composer\Config;
- use Composer\Factory;
- use Composer\Downloader\TransportException;
- use Composer\Pcre\Preg;
- class GitLab
- {
- protected $io;
- protected $config;
- protected $process;
- protected $httpDownloader;
- public function __construct(IOInterface $io, Config $config, ?ProcessExecutor $process = null, ?HttpDownloader $httpDownloader = null)
- {
- $this->io = $io;
- $this->config = $config;
- $this->process = $process ?: new ProcessExecutor($io);
- $this->httpDownloader = $httpDownloader ?: Factory::createHttpDownloader($this->io, $config);
- }
- public function authorizeOAuth(string $originUrl): bool
- {
- $bcOriginUrl = Preg::replace('{:\d+}', '', $originUrl);
- if (!in_array($originUrl, $this->config->get('gitlab-domains'), true) && !in_array($bcOriginUrl, $this->config->get('gitlab-domains'), true)) {
- return false;
- }
- if (0 === $this->process->execute('git config gitlab.accesstoken', $output)) {
- $this->io->setAuthentication($originUrl, trim($output), 'oauth2');
- return true;
- }
- if (0 === $this->process->execute('git config gitlab.deploytoken.user', $tokenUser) && 0 === $this->process->execute('git config gitlab.deploytoken.token', $tokenPassword)) {
- $this->io->setAuthentication($originUrl, trim($tokenUser), trim($tokenPassword));
- return true;
- }
- $authTokens = $this->config->get('gitlab-token');
- if (isset($authTokens[$originUrl])) {
- $token = $authTokens[$originUrl];
- }
- if (isset($authTokens[$bcOriginUrl])) {
- $token = $authTokens[$bcOriginUrl];
- }
- if (isset($token)) {
- $username = is_array($token) ? $token["username"] : $token;
- $password = is_array($token) ? $token["token"] : 'private-token';
- if (in_array($username, ['private-token', 'gitlab-ci-token', 'oauth2'], true)) {
- $this->io->setAuthentication($originUrl, $password, $username);
- } else {
- $this->io->setAuthentication($originUrl, $username, $password);
- }
- return true;
- }
- return false;
- }
- public function authorizeOAuthInteractively(string $scheme, string $originUrl, ?string $message = null): bool
- {
- if ($message) {
- $this->io->writeError($message);
- }
- $this->io->writeError(sprintf('A token will be created and stored in "%s", your password will never be stored', $this->config->getAuthConfigSource()->getName()));
- $this->io->writeError('To revoke access to this token you can visit '.$scheme.'://'.$originUrl.'/-/profile/applications');
- $this->io->writeError('Alternatively you can setup an personal access token on '.$scheme.'://'.$originUrl.'/-/profile/personal_access_token and store it under "gitlab-token" see https://getcomposer.org/doc/articles/authentication-for-private-packages.md#gitlab-token for more details.');
- $attemptCounter = 0;
- while ($attemptCounter++ < 5) {
- try {
- $response = $this->createToken($scheme, $originUrl);
- } catch (TransportException $e) {
- if (in_array($e->getCode(), [403, 401])) {
- if (401 === $e->getCode()) {
- $response = json_decode($e->getResponse(), true);
- if (isset($response['error']) && $response['error'] === 'invalid_grant') {
- $this->io->writeError('Bad credentials. If you have two factor authentication enabled you will have to manually create a personal access token');
- } else {
- $this->io->writeError('Bad credentials.');
- }
- } else {
- $this->io->writeError('Maximum number of login attempts exceeded. Please try again later.');
- }
- $this->io->writeError('You can also manually create a personal access token enabling the "read_api" scope at '.$scheme.'://'.$originUrl.'/profile/personal_access_tokens');
- $this->io->writeError('Add it using "composer config --global --auth gitlab-token.'.$originUrl.' <token>"');
- continue;
- }
- throw $e;
- }
- $this->io->setAuthentication($originUrl, $response['access_token'], 'oauth2');
- if (isset($response['expires_in'])) {
- $this->config->getAuthConfigSource()->addConfigSetting(
- 'gitlab-oauth.'.$originUrl,
- [
- 'expires-at' => intval($response['created_at']) + intval($response['expires_in']),
- 'refresh-token' => $response['refresh_token'],
- 'token' => $response['access_token'],
- ]
- );
- } else {
- $this->config->getAuthConfigSource()->addConfigSetting('gitlab-oauth.'.$originUrl, $response['access_token']);
- }
- return true;
- }
- throw new \RuntimeException('Invalid GitLab credentials 5 times in a row, aborting.');
- }
- public function authorizeOAuthRefresh(string $scheme, string $originUrl): bool
- {
- try {
- $response = $this->refreshToken($scheme, $originUrl);
- } catch (TransportException $e) {
- $this->io->writeError("Couldn't refresh access token: ".$e->getMessage());
- return false;
- }
- $this->io->setAuthentication($originUrl, $response['access_token'], 'oauth2');
- $this->config->getAuthConfigSource()->addConfigSetting(
- 'gitlab-oauth.'.$originUrl,
- [
- 'expires-at' => intval($response['created_at']) + intval($response['expires_in']),
- 'refresh-token' => $response['refresh_token'],
- 'token' => $response['access_token'],
- ]
- );
- return true;
- }
- private function createToken(string $scheme, string $originUrl): array
- {
- $username = $this->io->ask('Username: ');
- $password = $this->io->askAndHideAnswer('Password: ');
- $headers = ['Content-Type: application/x-www-form-urlencoded'];
- $apiUrl = $originUrl;
- $data = http_build_query([
- 'username' => $username,
- 'password' => $password,
- 'grant_type' => 'password',
- ], '', '&');
- $options = [
- 'retry-auth-failure' => false,
- 'http' => [
- 'method' => 'POST',
- 'header' => $headers,
- 'content' => $data,
- ],
- ];
- $token = $this->httpDownloader->get($scheme.'://'.$apiUrl.'/oauth/token', $options)->decodeJson();
- $this->io->writeError('Token successfully created');
- return $token;
- }
- public function isOAuthExpired(string $originUrl): bool
- {
- $authTokens = $this->config->get('gitlab-oauth');
- if (isset($authTokens[$originUrl]['expires-at'])) {
- if ($authTokens[$originUrl]['expires-at'] < time()) {
- return true;
- }
- }
- return false;
- }
- private function refreshToken(string $scheme, string $originUrl): array
- {
- $authTokens = $this->config->get('gitlab-oauth');
- if (!isset($authTokens[$originUrl]['refresh-token'])) {
- throw new \RuntimeException('No GitLab refresh token present for '.$originUrl.'.');
- }
- $refreshToken = $authTokens[$originUrl]['refresh-token'];
- $headers = ['Content-Type: application/x-www-form-urlencoded'];
- $data = http_build_query([
- 'refresh_token' => $refreshToken,
- 'grant_type' => 'refresh_token',
- ], '', '&');
- $options = [
- 'retry-auth-failure' => false,
- 'http' => [
- 'method' => 'POST',
- 'header' => $headers,
- 'content' => $data,
- ],
- ];
- $token = $this->httpDownloader->get($scheme.'://'.$originUrl.'/oauth/token', $options)->decodeJson();
- $this->io->writeError('GitLab token successfully refreshed', true, IOInterface::VERY_VERBOSE);
- $this->io->writeError('To revoke access to this token you can visit '.$scheme.'://'.$originUrl.'/-/profile/applications', true, IOInterface::VERY_VERBOSE);
- return $token;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Util;
- use Composer\Config;
- use Composer\IO\IOInterface;
- use Composer\Pcre\Preg;
- class Hg
- {
- private static $version = false;
- private $io;
- private $config;
- private $process;
- public function __construct(IOInterface $io, Config $config, ProcessExecutor $process)
- {
- $this->io = $io;
- $this->config = $config;
- $this->process = $process;
- }
- public function runCommand(callable $commandCallable, string $url, ?string $cwd): void
- {
- $this->config->prohibitUrlByConfig($url, $this->io);
- $command = $commandCallable($url);
- if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
- return;
- }
- if (Preg::isMatch('{^(https?)://((.+)(?:\:(.+))?@)?([^/]+)(/.*)?}mi', $url, $match) && $this->io->hasAuthentication($match[5])) {
- $auth = $this->io->getAuthentication($match[5]);
- $authenticatedUrl = $match[1] . '://' . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[5] . (!empty($match[6]) ? $match[6] : null);
- $command = $commandCallable($authenticatedUrl);
- if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
- return;
- }
- $error = $this->process->getErrorOutput();
- } else {
- $error = 'The given URL (' . $url . ') does not match the required format (http(s)://(username:password@)example.com/path-to-repository)';
- }
- $this->throwException('Failed to clone ' . $url . ', ' . "\n\n" . $error, $url);
- }
- private function throwException($message, string $url): void
- {
- if (null === self::getVersion($this->process)) {
- throw new \RuntimeException(Url::sanitize('Failed to clone ' . $url . ', hg was not found, check that it is installed and in your PATH env.' . "\n\n" . $this->process->getErrorOutput()));
- }
- throw new \RuntimeException(Url::sanitize($message));
- }
- public static function getVersion(ProcessExecutor $process): ?string
- {
- if (false === self::$version) {
- self::$version = null;
- if (0 === $process->execute('hg --version', $output) && Preg::isMatch('/^.+? (\d+(?:\.\d+)+)(?:\+.*?)?\)?\r?\n/', $output, $matches)) {
- self::$version = $matches[1];
- }
- }
- return self::$version;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Util\Http;
- use Composer\Config;
- use Composer\Downloader\MaxFileSizeExceededException;
- use Composer\IO\IOInterface;
- use Composer\Downloader\TransportException;
- use Composer\Pcre\Preg;
- use Composer\Util\Platform;
- use Composer\Util\StreamContextFactory;
- use Composer\Util\AuthHelper;
- use Composer\Util\Url;
- use Composer\Util\HttpDownloader;
- use React\Promise\Promise;
- class CurlDownloader
- {
- private $multiHandle;
- private $shareHandle;
- private $jobs = [];
- private $io;
- private $config;
- private $authHelper;
- private $selectTimeout = 5.0;
- private $maxRedirects = 20;
- private $maxRetries = 3;
- private $proxyManager;
- private $supportsSecureProxy;
- protected $multiErrors = [
- CURLM_BAD_HANDLE => ['CURLM_BAD_HANDLE', 'The passed-in handle is not a valid CURLM handle.'],
- 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."],
- CURLM_OUT_OF_MEMORY => ['CURLM_OUT_OF_MEMORY', 'You are doomed.'],
- CURLM_INTERNAL_ERROR => ['CURLM_INTERNAL_ERROR', 'This can only be returned if libcurl bugs. Please report it to us!'],
- ];
- private static $options = [
- 'http' => [
- 'method' => CURLOPT_CUSTOMREQUEST,
- 'content' => CURLOPT_POSTFIELDS,
- 'header' => CURLOPT_HTTPHEADER,
- 'timeout' => CURLOPT_TIMEOUT,
- ],
- 'ssl' => [
- 'cafile' => CURLOPT_CAINFO,
- 'capath' => CURLOPT_CAPATH,
- 'verify_peer' => CURLOPT_SSL_VERIFYPEER,
- 'verify_peer_name' => CURLOPT_SSL_VERIFYHOST,
- 'local_cert' => CURLOPT_SSLCERT,
- 'local_pk' => CURLOPT_SSLKEY,
- 'passphrase' => CURLOPT_SSLKEYPASSWD,
- ],
- ];
- private static $timeInfo = [
- 'total_time' => true,
- 'namelookup_time' => true,
- 'connect_time' => true,
- 'pretransfer_time' => true,
- 'starttransfer_time' => true,
- 'redirect_time' => true,
- ];
- public function __construct(IOInterface $io, Config $config, array $options = [], bool $disableTls = false)
- {
- $this->io = $io;
- $this->config = $config;
- $this->multiHandle = $mh = curl_multi_init();
- if (function_exists('curl_multi_setopt')) {
- curl_multi_setopt($mh, CURLMOPT_PIPELINING, PHP_VERSION_ID >= 70400 ? 2 : 3);
- if (defined('CURLMOPT_MAX_HOST_CONNECTIONS') && !defined('HHVM_VERSION')) {
- curl_multi_setopt($mh, CURLMOPT_MAX_HOST_CONNECTIONS, 8);
- }
- }
- if (function_exists('curl_share_init')) {
- $this->shareHandle = $sh = curl_share_init();
- curl_share_setopt($sh, CURLSHOPT_SHARE, CURL_LOCK_DATA_COOKIE);
- curl_share_setopt($sh, CURLSHOPT_SHARE, CURL_LOCK_DATA_DNS);
- curl_share_setopt($sh, CURLSHOPT_SHARE, CURL_LOCK_DATA_SSL_SESSION);
- }
- $this->authHelper = new AuthHelper($io, $config);
- $this->proxyManager = ProxyManager::getInstance();
- $version = curl_version();
- $features = $version['features'];
- $this->supportsSecureProxy = defined('CURL_VERSION_HTTPS_PROXY') && ($features & CURL_VERSION_HTTPS_PROXY);
- }
- public function download(callable $resolve, callable $reject, string $origin, string $url, array $options, ?string $copyTo = null): int
- {
- $attributes = [];
- if (isset($options['retry-auth-failure'])) {
- $attributes['retryAuthFailure'] = $options['retry-auth-failure'];
- unset($options['retry-auth-failure']);
- }
- return $this->initDownload($resolve, $reject, $origin, $url, $options, $copyTo, $attributes);
- }
- private function initDownload(callable $resolve, callable $reject, string $origin, string $url, array $options, ?string $copyTo = null, array $attributes = []): int
- {
- $attributes['retryAuthFailure'] = $attributes['retryAuthFailure'] ?? true;
- $attributes['redirects'] = $attributes['redirects'] ?? 0;
- $attributes['retries'] = $attributes['retries'] ?? 0;
- $attributes['storeAuth'] = $attributes['storeAuth'] ?? false;
- $originalOptions = $options;
- if (!Preg::isMatch('{^http://(repo\.)?packagist\.org/p/}', $url) || (false === strpos($url, '$') && false === strpos($url, '%24'))) {
- $this->config->prohibitUrlByConfig($url, $this->io, $options);
- }
- $curlHandle = curl_init();
- $headerHandle = fopen('php://temp/maxmemory:32768', 'w+b');
- if (false === $headerHandle) {
- throw new \RuntimeException('Failed to open a temp stream to store curl headers');
- }
- if ($copyTo) {
- $errorMessage = '';
- set_error_handler(static function ($code, $msg) use (&$errorMessage): void {
- if ($errorMessage) {
- $errorMessage .= "\n";
- }
- $errorMessage .= Preg::replace('{^fopen\(.*?\): }', '', $msg);
- });
- $bodyHandle = fopen($copyTo.'~', 'w+b');
- restore_error_handler();
- if (!$bodyHandle) {
- throw new TransportException('The "'.$url.'" file could not be written to '.$copyTo.': '.$errorMessage);
- }
- } else {
- $bodyHandle = @fopen('php://temp/maxmemory:524288', 'w+b');
- }
- curl_setopt($curlHandle, CURLOPT_URL, $url);
- curl_setopt($curlHandle, CURLOPT_FOLLOWLOCATION, false);
- curl_setopt($curlHandle, CURLOPT_CONNECTTIMEOUT, 10);
- curl_setopt($curlHandle, CURLOPT_TIMEOUT, max((int) ini_get("default_socket_timeout"), 300));
- curl_setopt($curlHandle, CURLOPT_WRITEHEADER, $headerHandle);
- curl_setopt($curlHandle, CURLOPT_FILE, $bodyHandle);
- curl_setopt($curlHandle, CURLOPT_ENCODING, "");
- curl_setopt($curlHandle, CURLOPT_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS);
- if (function_exists('curl_share_init')) {
- curl_setopt($curlHandle, CURLOPT_SHARE, $this->shareHandle);
- }
- if (!isset($options['http']['header'])) {
- $options['http']['header'] = [];
- }
- $options['http']['header'] = array_diff($options['http']['header'], ['Connection: close']);
- $options['http']['header'][] = 'Connection: keep-alive';
- $version = curl_version();
- $features = $version['features'];
- if (0 === strpos($url, 'https://') && \defined('CURL_VERSION_HTTP2') && \defined('CURL_HTTP_VERSION_2_0') && (CURL_VERSION_HTTP2 & $features)) {
- curl_setopt($curlHandle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2_0);
- }
- $options['http']['header'] = $this->authHelper->addAuthenticationHeader($options['http']['header'], $origin, $url);
- $options = StreamContextFactory::initOptions($url, $options, true);
- foreach (self::$options as $type => $curlOptions) {
- foreach ($curlOptions as $name => $curlOption) {
- if (isset($options[$type][$name])) {
- if ($type === 'ssl' && $name === 'verify_peer_name') {
- curl_setopt($curlHandle, $curlOption, $options[$type][$name] === true ? 2 : $options[$type][$name]);
- } else {
- curl_setopt($curlHandle, $curlOption, $options[$type][$name]);
- }
- }
- }
- }
- $proxy = $this->proxyManager->getProxyForRequest($url);
- curl_setopt($curlHandle, CURLOPT_PROXY, $proxy->getUrl());
- if ($proxy->isSecure()) {
- if (!$this->supportsSecureProxy) {
- throw new TransportException('Connecting to a secure proxy using curl is not supported on PHP versions below 7.3.0.');
- }
- if (!empty($options['ssl']['cafile'])) {
- curl_setopt($curlHandle, CURLOPT_PROXY_CAINFO, $options['ssl']['cafile']);
- }
- if (!empty($options['ssl']['capath'])) {
- curl_setopt($curlHandle, CURLOPT_PROXY_CAPATH, $options['ssl']['capath']);
- }
- }
- $progress = array_diff_key(curl_getinfo($curlHandle), self::$timeInfo);
- $this->jobs[(int) $curlHandle] = [
- 'url' => $url,
- 'origin' => $origin,
- 'attributes' => $attributes,
- 'options' => $originalOptions,
- 'progress' => $progress,
- 'curlHandle' => $curlHandle,
- 'filename' => $copyTo,
- 'headerHandle' => $headerHandle,
- 'bodyHandle' => $bodyHandle,
- 'resolve' => $resolve,
- 'reject' => $reject,
- ];
- $usingProxy = $proxy->getFormattedUrl(' using proxy (%s)');
- $ifModified = false !== stripos(implode(',', $options['http']['header']), 'if-modified-since:') ? ' if modified' : '';
- if ($attributes['redirects'] === 0 && $attributes['retries'] === 0) {
- $this->io->writeError('Downloading ' . Url::sanitize($url) . $usingProxy . $ifModified, true, IOInterface::DEBUG);
- }
- $this->checkCurlResult(curl_multi_add_handle($this->multiHandle, $curlHandle));
- return (int) $curlHandle;
- }
- public function abortRequest(int $id): void
- {
- if (isset($this->jobs[$id], $this->jobs[$id]['curlHandle'])) {
- $job = $this->jobs[$id];
- curl_multi_remove_handle($this->multiHandle, $job['curlHandle']);
- curl_close($job['curlHandle']);
- if (is_resource($job['headerHandle'])) {
- fclose($job['headerHandle']);
- }
- if (is_resource($job['bodyHandle'])) {
- fclose($job['bodyHandle']);
- }
- if (null !== $job['filename']) {
- @unlink($job['filename'].'~');
- }
- unset($this->jobs[$id]);
- }
- }
- public function tick(): void
- {
- static $timeoutWarning = false;
- if (count($this->jobs) === 0) {
- return;
- }
- $active = true;
- $this->checkCurlResult(curl_multi_exec($this->multiHandle, $active));
- if (-1 === curl_multi_select($this->multiHandle, $this->selectTimeout)) {
- usleep(150);
- }
- while ($progress = curl_multi_info_read($this->multiHandle)) {
- $curlHandle = $progress['handle'];
- $result = $progress['result'];
- $i = (int) $curlHandle;
- if (!isset($this->jobs[$i])) {
- continue;
- }
- $progress = curl_getinfo($curlHandle);
- if (false === $progress) {
- throw new \RuntimeException('Failed getting info from curl handle '.$i.' ('.$this->jobs[$i]['url'].')');
- }
- $job = $this->jobs[$i];
- unset($this->jobs[$i]);
- $error = curl_error($curlHandle);
- $errno = curl_errno($curlHandle);
- curl_multi_remove_handle($this->multiHandle, $curlHandle);
- curl_close($curlHandle);
- $headers = null;
- $statusCode = null;
- $response = null;
- try {
- if (CURLE_OK !== $errno || $error || $result !== CURLE_OK) {
- $errno = $errno ?: $result;
- if (!$error && function_exists('curl_strerror')) {
- $error = curl_strerror($errno);
- }
- $progress['error_code'] = $errno;
- if (
- (!isset($job['options']['http']['method']) || $job['options']['http']['method'] === 'GET')
- && (
- in_array($errno, [7 , 16 , 92 , 6 ], true)
- || ($errno === 35 && false !== strpos($error, 'Connection reset by peer'))
- ) && $job['attributes']['retries'] < $this->maxRetries
- ) {
- $this->io->writeError('Retrying ('.($job['attributes']['retries'] + 1).') ' . Url::sanitize($job['url']) . ' due to curl error '. $errno, true, IOInterface::DEBUG);
- $this->restartJobWithDelay($job, $job['url'], ['retries' => $job['attributes']['retries'] + 1]);
- continue;
- }
- if ($errno === 28 && PHP_VERSION_ID >= 70300 && $progress['namelookup_time'] === 0.0 && !$timeoutWarning) {
- $timeoutWarning = true;
- $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>');
- }
- throw new TransportException('curl error '.$errno.' while downloading '.Url::sanitize($progress['url']).': '.$error);
- }
- $statusCode = $progress['http_code'];
- rewind($job['headerHandle']);
- $headers = explode("\r\n", rtrim(stream_get_contents($job['headerHandle'])));
- fclose($job['headerHandle']);
- if ($statusCode === 0) {
- 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));
- }
- if (null !== $job['filename']) {
- $contents = $job['filename'].'~';
- if ($statusCode >= 300) {
- rewind($job['bodyHandle']);
- $contents = stream_get_contents($job['bodyHandle']);
- }
- $response = new CurlResponse(['url' => $progress['url']], $statusCode, $headers, $contents, $progress);
- $this->io->writeError('['.$statusCode.'] '.Url::sanitize($progress['url']), true, IOInterface::DEBUG);
- } else {
- $maxFileSize = $job['options']['max_file_size'] ?? null;
- rewind($job['bodyHandle']);
- if ($maxFileSize !== null) {
- $contents = stream_get_contents($job['bodyHandle'], $maxFileSize);
- if ($contents !== false && Platform::strlen($contents) >= $maxFileSize) {
- throw new MaxFileSizeExceededException('Maximum allowed download size reached. Downloaded ' . Platform::strlen($contents) . ' of allowed ' . $maxFileSize . ' bytes');
- }
- } else {
- $contents = stream_get_contents($job['bodyHandle']);
- }
- $response = new CurlResponse(['url' => $progress['url']], $statusCode, $headers, $contents, $progress);
- $this->io->writeError('['.$statusCode.'] '.Url::sanitize($progress['url']), true, IOInterface::DEBUG);
- }
- fclose($job['bodyHandle']);
- if ($response->getStatusCode() >= 400 && $response->getHeader('content-type') === 'application/json') {
- HttpDownloader::outputWarnings($this->io, $job['origin'], json_decode($response->getBody(), true));
- }
- $result = $this->isAuthenticatedRetryNeeded($job, $response);
- if ($result['retry']) {
- $this->restartJob($job, $job['url'], ['storeAuth' => $result['storeAuth']]);
- continue;
- }
- if ($statusCode >= 300 && $statusCode <= 399 && $statusCode !== 304 && $job['attributes']['redirects'] < $this->maxRedirects) {
- $location = $this->handleRedirect($job, $response);
- if ($location) {
- $this->restartJob($job, $location, ['redirects' => $job['attributes']['redirects'] + 1]);
- continue;
- }
- }
- if ($statusCode >= 400 && $statusCode <= 599) {
- if (
- (!isset($job['options']['http']['method']) || $job['options']['http']['method'] === 'GET')
- && in_array($statusCode, [423, 425, 500, 502, 503, 504, 507, 510], true)
- && $job['attributes']['retries'] < $this->maxRetries
- ) {
- $this->io->writeError('Retrying ('.($job['attributes']['retries'] + 1).') ' . Url::sanitize($job['url']) . ' due to status code '. $statusCode, true, IOInterface::DEBUG);
- $this->restartJobWithDelay($job, $job['url'], ['retries' => $job['attributes']['retries'] + 1]);
- continue;
- }
- throw $this->failResponse($job, $response, $response->getStatusMessage());
- }
- if ($job['attributes']['storeAuth'] !== false) {
- $this->authHelper->storeAuth($job['origin'], $job['attributes']['storeAuth']);
- }
- if (null !== $job['filename']) {
- rename($job['filename'].'~', $job['filename']);
- $job['resolve']($response);
- } else {
- $job['resolve']($response);
- }
- } catch (\Exception $e) {
- if ($e instanceof TransportException) {
- if (null !== $headers) {
- $e->setHeaders($headers);
- $e->setStatusCode($statusCode);
- }
- if (null !== $response) {
- $e->setResponse($response->getBody());
- }
- $e->setResponseInfo($progress);
- }
- $this->rejectJob($job, $e);
- }
- }
- foreach ($this->jobs as $i => $curlHandle) {
- if (!isset($this->jobs[$i])) {
- continue;
- }
- $curlHandle = $this->jobs[$i]['curlHandle'];
- $progress = array_diff_key(curl_getinfo($curlHandle), self::$timeInfo);
- if ($this->jobs[$i]['progress'] !== $progress) {
- $this->jobs[$i]['progress'] = $progress;
- if (isset($this->jobs[$i]['options']['max_file_size'])) {
- if ($this->jobs[$i]['options']['max_file_size'] < $progress['download_content_length']) {
- $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'));
- }
- if ($this->jobs[$i]['options']['max_file_size'] < $progress['size_download']) {
- $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'));
- }
- }
- }
- }
- }
- private function handleRedirect(array $job, Response $response): string
- {
- if ($locationHeader = $response->getHeader('location')) {
- if (parse_url($locationHeader, PHP_URL_SCHEME)) {
- $targetUrl = $locationHeader;
- } elseif (parse_url($locationHeader, PHP_URL_HOST)) {
- $targetUrl = parse_url($job['url'], PHP_URL_SCHEME).':'.$locationHeader;
- } elseif ('/' === $locationHeader[0]) {
- $urlHost = parse_url($job['url'], PHP_URL_HOST);
- $targetUrl = Preg::replace('{^(.+(?://|@)'.preg_quote($urlHost).'(?::\d+)?)(?:[/\?].*)?$}', '\1'.$locationHeader, $job['url']);
- } else {
- $targetUrl = Preg::replace('{^(.+/)[^/?]*(?:\?.*)?$}', '\1'.$locationHeader, $job['url']);
- }
- }
- if (!empty($targetUrl)) {
- $this->io->writeError(sprintf('Following redirect (%u) %s', $job['attributes']['redirects'] + 1, Url::sanitize($targetUrl)), true, IOInterface::DEBUG);
- return $targetUrl;
- }
- throw new TransportException('The "'.$job['url'].'" file could not be downloaded, got redirect without Location ('.$response->getStatusMessage().')');
- }
- private function isAuthenticatedRetryNeeded(array $job, Response $response): array
- {
- if (in_array($response->getStatusCode(), [401, 403]) && $job['attributes']['retryAuthFailure']) {
- $result = $this->authHelper->promptAuthIfNeeded($job['url'], $job['origin'], $response->getStatusCode(), $response->getStatusMessage(), $response->getHeaders(), $job['attributes']['retries']);
- if ($result['retry']) {
- return $result;
- }
- }
- $locationHeader = $response->getHeader('location');
- $needsAuthRetry = false;
- if (
- $job['origin'] === 'bitbucket.org'
- && !$this->authHelper->isPublicBitBucketDownload($job['url'])
- && substr($job['url'], -4) === '.zip'
- && (!$locationHeader || substr($locationHeader, -4) !== '.zip')
- && Preg::isMatch('{^text/html\b}i', $response->getHeader('content-type'))
- ) {
- $needsAuthRetry = 'Bitbucket requires authentication and it was not provided';
- }
- if (
- $response->getStatusCode() === 404
- && in_array($job['origin'], $this->config->get('gitlab-domains'), true)
- && false !== strpos($job['url'], 'archive.zip')
- ) {
- $needsAuthRetry = 'GitLab requires authentication and it was not provided';
- }
- if ($needsAuthRetry) {
- if ($job['attributes']['retryAuthFailure']) {
- $result = $this->authHelper->promptAuthIfNeeded($job['url'], $job['origin'], 401, null, [], $job['attributes']['retries']);
- if ($result['retry']) {
- return $result;
- }
- }
- throw $this->failResponse($job, $response, $needsAuthRetry);
- }
- return ['retry' => false, 'storeAuth' => false];
- }
- private function restartJob(array $job, string $url, array $attributes = []): void
- {
- if (null !== $job['filename']) {
- @unlink($job['filename'].'~');
- }
- $attributes = array_merge($job['attributes'], $attributes);
- $origin = Url::getOrigin($this->config, $url);
- $this->initDownload($job['resolve'], $job['reject'], $origin, $url, $job['options'], $job['filename'], $attributes);
- }
- private function restartJobWithDelay(array $job, string $url, array $attributes): void
- {
- if ($attributes['retries'] >= 3) {
- usleep(500000);
- } elseif ($attributes['retries'] >= 2) {
- usleep(100000);
- }
- $this->restartJob($job, $url, $attributes);
- }
- private function failResponse(array $job, Response $response, string $errorMessage): TransportException
- {
- if (null !== $job['filename']) {
- @unlink($job['filename'].'~');
- }
- $details = '';
- if (in_array(strtolower((string) $response->getHeader('content-type')), ['application/json', 'application/json; charset=utf-8'], true)) {
- $details = ':'.PHP_EOL.substr($response->getBody(), 0, 200).(strlen($response->getBody()) > 200 ? '...' : '');
- }
- return new TransportException('The "'.$job['url'].'" file could not be downloaded ('.$errorMessage.')' . $details, $response->getStatusCode());
- }
- private function rejectJob(array $job, \Exception $e): void
- {
- if (is_resource($job['headerHandle'])) {
- fclose($job['headerHandle']);
- }
- if (is_resource($job['bodyHandle'])) {
- fclose($job['bodyHandle']);
- }
- if (null !== $job['filename']) {
- @unlink($job['filename'].'~');
- }
- $job['reject']($e);
- }
- private function checkCurlResult(int $code): void
- {
- if ($code !== CURLM_OK && $code !== CURLM_CALL_MULTI_PERFORM) {
- throw new \RuntimeException(
- isset($this->multiErrors[$code])
- ? "cURL error: {$code} ({$this->multiErrors[$code][0]}): cURL message: {$this->multiErrors[$code][1]}"
- : 'Unexpected cURL error: ' . $code
- );
- }
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Util\Http;
- class CurlResponse extends Response
- {
- private $curlInfo;
- public function __construct(array $request, ?int $code, array $headers, ?string $body, array $curlInfo)
- {
- parent::__construct($request, $code, $headers, $body);
- $this->curlInfo = $curlInfo;
- }
- public function getCurlInfo(): array
- {
- return $this->curlInfo;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Util\Http;
- class ProxyHelper
- {
- public static function getProxyData(): array
- {
- $httpProxy = null;
- $httpsProxy = null;
- if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
- if ($env = self::getProxyEnv(['http_proxy', 'HTTP_PROXY'], $name)) {
- $httpProxy = self::checkProxy($env, $name);
- }
- }
- if ($env = self::getProxyEnv(['CGI_HTTP_PROXY'], $name)) {
- $httpProxy = self::checkProxy($env, $name);
- }
- if ($env = self::getProxyEnv(['https_proxy', 'HTTPS_PROXY'], $name)) {
- $httpsProxy = self::checkProxy($env, $name);
- } else {
- $httpsProxy = $httpProxy;
- }
- $noProxy = self::getProxyEnv(['no_proxy', 'NO_PROXY'], $name);
- return [$httpProxy, $httpsProxy, $noProxy];
- }
- public static function getContextOptions(string $proxyUrl): array
- {
- $proxy = parse_url($proxyUrl);
- $proxyUrl = self::formatParsedUrl($proxy, false);
- $proxyUrl = str_replace(['http://', 'https://'], ['tcp://', 'ssl://'], $proxyUrl);
- $options['http']['proxy'] = $proxyUrl;
- if (isset($proxy['user'])) {
- $auth = rawurldecode($proxy['user']);
- if (isset($proxy['pass'])) {
- $auth .= ':' . rawurldecode($proxy['pass']);
- }
- $auth = base64_encode($auth);
- $options['http']['header'] = "Proxy-Authorization: Basic {$auth}";
- }
- return $options;
- }
- public static function setRequestFullUri(string $requestUrl, array &$options): void
- {
- if ('http' === parse_url($requestUrl, PHP_URL_SCHEME)) {
- $options['http']['request_fulluri'] = true;
- } else {
- unset($options['http']['request_fulluri']);
- }
- }
- private static function getProxyEnv(array $names, ?string &$name): ?string
- {
- foreach ($names as $name) {
- if (!empty($_SERVER[$name])) {
- return $_SERVER[$name];
- }
- }
- return null;
- }
- private static function checkProxy(string $proxyUrl, string $envName): string
- {
- $error = sprintf('malformed %s url', $envName);
- $proxy = parse_url($proxyUrl);
- if (!isset($proxy['host'])) {
- throw new \RuntimeException($error);
- }
- $proxyUrl = self::formatParsedUrl($proxy, true);
- if (!parse_url($proxyUrl, PHP_URL_PORT)) {
- throw new \RuntimeException($error);
- }
- return $proxyUrl;
- }
- private static function formatParsedUrl(array $proxy, bool $includeAuth): string
- {
- $proxyUrl = isset($proxy['scheme']) ? strtolower($proxy['scheme']) . '://' : '';
- if ($includeAuth && isset($proxy['user'])) {
- $proxyUrl .= $proxy['user'];
- if (isset($proxy['pass'])) {
- $proxyUrl .= ':' . $proxy['pass'];
- }
- $proxyUrl .= '@';
- }
- $proxyUrl .= $proxy['host'];
- if (isset($proxy['port'])) {
- $proxyUrl .= ':' . $proxy['port'];
- } elseif (strpos($proxyUrl, 'http://') === 0) {
- $proxyUrl .= ':80';
- } elseif (strpos($proxyUrl, 'https://') === 0) {
- $proxyUrl .= ':443';
- }
- return $proxyUrl;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Util\Http;
- use Composer\Downloader\TransportException;
- use Composer\Util\NoProxyPattern;
- use Composer\Util\Url;
- class ProxyManager
- {
- private $error = null;
- private $fullProxy;
- private $safeProxy;
- private $streams;
- private $hasProxy;
- private $info = null;
- private $noProxyHandler = null;
- private static $instance = null;
- private function __construct()
- {
- $this->fullProxy = $this->safeProxy = [
- 'http' => null,
- 'https' => null,
- ];
- $this->streams['http'] = $this->streams['https'] = [
- 'options' => null,
- ];
- $this->hasProxy = false;
- $this->initProxyData();
- }
- public static function getInstance(): ProxyManager
- {
- if (!self::$instance) {
- self::$instance = new self();
- }
- return self::$instance;
- }
- public static function reset(): void
- {
- self::$instance = null;
- }
- public function getProxyForRequest(string $requestUrl): RequestProxy
- {
- if ($this->error) {
- throw new TransportException('Unable to use a proxy: '.$this->error);
- }
- $scheme = parse_url($requestUrl, PHP_URL_SCHEME) ?: 'http';
- $proxyUrl = '';
- $options = [];
- $formattedProxyUrl = '';
- if ($this->hasProxy && in_array($scheme, ['http', 'https'], true) && $this->fullProxy[$scheme]) {
- if ($this->noProxy($requestUrl)) {
- $formattedProxyUrl = 'excluded by no_proxy';
- } else {
- $proxyUrl = $this->fullProxy[$scheme];
- $options = $this->streams[$scheme]['options'];
- ProxyHelper::setRequestFullUri($requestUrl, $options);
- $formattedProxyUrl = $this->safeProxy[$scheme];
- }
- }
- return new RequestProxy($proxyUrl, $options, $formattedProxyUrl);
- }
- public function isProxying(): bool
- {
- return $this->hasProxy;
- }
- public function getFormattedProxy(): ?string
- {
- return $this->hasProxy ? $this->info : $this->error;
- }
- private function initProxyData(): void
- {
- try {
- [$httpProxy, $httpsProxy, $noProxy] = ProxyHelper::getProxyData();
- } catch (\RuntimeException $e) {
- $this->error = $e->getMessage();
- return;
- }
- $info = [];
- if ($httpProxy) {
- $info[] = $this->setData($httpProxy, 'http');
- }
- if ($httpsProxy) {
- $info[] = $this->setData($httpsProxy, 'https');
- }
- if ($this->hasProxy) {
- $this->info = implode(', ', $info);
- if ($noProxy) {
- $this->noProxyHandler = new NoProxyPattern($noProxy);
- }
- }
- }
- private function setData($url, $scheme): string
- {
- $safeProxy = Url::sanitize($url);
- $this->fullProxy[$scheme] = $url;
- $this->safeProxy[$scheme] = $safeProxy;
- $this->streams[$scheme]['options'] = ProxyHelper::getContextOptions($url);
- $this->hasProxy = true;
- return sprintf('%s=%s', $scheme, $safeProxy);
- }
- private function noProxy(string $requestUrl): bool
- {
- return $this->noProxyHandler && $this->noProxyHandler->test($requestUrl);
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Util\Http;
- use Composer\Util\Url;
- class RequestProxy
- {
- private $contextOptions;
- private $isSecure;
- private $formattedUrl;
- private $url;
- public function __construct(string $url, array $contextOptions, string $formattedUrl)
- {
- $this->url = $url;
- $this->contextOptions = $contextOptions;
- $this->formattedUrl = $formattedUrl;
- $this->isSecure = 0 === strpos($url, 'https://');
- }
- public function getContextOptions(): array
- {
- return $this->contextOptions;
- }
- public function getFormattedUrl(?string $format = ''): string
- {
- $result = '';
- if ($this->formattedUrl) {
- $format = $format ?: '%s';
- $result = sprintf($format, $this->formattedUrl);
- }
- return $result;
- }
- public function getUrl(): string
- {
- return $this->url;
- }
- public function isSecure(): bool
- {
- return $this->isSecure;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Util\Http;
- use Composer\Json\JsonFile;
- use Composer\Pcre\Preg;
- use Composer\Util\HttpDownloader;
- class Response
- {
- private $request;
- private $code;
- private $headers;
- private $body;
- public function __construct(array $request, ?int $code, array $headers, ?string $body)
- {
- if (!isset($request['url'])) {
- throw new \LogicException('url key missing from request array');
- }
- $this->request = $request;
- $this->code = (int) $code;
- $this->headers = $headers;
- $this->body = $body;
- }
- public function getStatusCode(): int
- {
- return $this->code;
- }
- public function getStatusMessage(): ?string
- {
- $value = null;
- foreach ($this->headers as $header) {
- if (Preg::isMatch('{^HTTP/\S+ \d+}i', $header)) {
- $value = $header;
- }
- }
- return $value;
- }
- public function getHeaders(): array
- {
- return $this->headers;
- }
- public function getHeader(string $name): ?string
- {
- return self::findHeaderValue($this->headers, $name);
- }
- public function getBody(): ?string
- {
- return $this->body;
- }
- public function decodeJson()
- {
- return JsonFile::parseJson($this->body, $this->request['url']);
- }
- public function collect(): void
- {
- $this->request = $this->code = $this->headers = $this->body = null;
- }
- public static function findHeaderValue(array $headers, string $name): ?string
- {
- $value = null;
- foreach ($headers as $header) {
- if (Preg::isMatch('{^'.preg_quote($name).':\s*(.+?)\s*$}i', $header, $match)) {
- $value = $match[1];
- }
- }
- return $value;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Util;
- use Composer\Config;
- use Composer\IO\IOInterface;
- use Composer\Downloader\TransportException;
- use Composer\Pcre\Preg;
- use Composer\Util\Http\Response;
- use Composer\Util\Http\CurlDownloader;
- use Composer\Composer;
- use Composer\Package\Version\VersionParser;
- use Composer\Semver\Constraint\Constraint;
- use Composer\Exception\IrrecoverableDownloadException;
- use React\Promise\Promise;
- use React\Promise\PromiseInterface;
- class HttpDownloader
- {
- private const STATUS_QUEUED = 1;
- private const STATUS_STARTED = 2;
- private const STATUS_COMPLETED = 3;
- private const STATUS_FAILED = 4;
- private const STATUS_ABORTED = 5;
- private $io;
- private $config;
- private $jobs = [];
- private $options = [];
- private $runningJobs = 0;
- private $maxJobs = 12;
- private $curl;
- private $rfs;
- private $idGen = 0;
- private $disabled;
- private $allowAsync = false;
- public function __construct(IOInterface $io, Config $config, array $options = [], bool $disableTls = false)
- {
- $this->io = $io;
- $this->disabled = (bool) Platform::getEnv('COMPOSER_DISABLE_NETWORK');
- if ($disableTls === false) {
- $this->options = StreamContextFactory::getTlsDefaults($options, $io);
- }
- $this->options = array_replace_recursive($this->options, $options);
- $this->config = $config;
- if (self::isCurlEnabled()) {
- $this->curl = new CurlDownloader($io, $config, $options, $disableTls);
- }
- $this->rfs = new RemoteFilesystem($io, $config, $options, $disableTls);
- if (is_numeric($maxJobs = Platform::getEnv('COMPOSER_MAX_PARALLEL_HTTP'))) {
- $this->maxJobs = max(1, min(50, (int) $maxJobs));
- }
- }
- public function get(string $url, array $options = [])
- {
- [$job] = $this->addJob(['url' => $url, 'options' => $options, 'copyTo' => null], true);
- $this->wait($job['id']);
- $response = $this->getResponse($job['id']);
- return $response;
- }
- public function add(string $url, array $options = [])
- {
- [, $promise] = $this->addJob(['url' => $url, 'options' => $options, 'copyTo' => null]);
- return $promise;
- }
- public function copy(string $url, string $to, array $options = [])
- {
- [$job] = $this->addJob(['url' => $url, 'options' => $options, 'copyTo' => $to], true);
- $this->wait($job['id']);
- return $this->getResponse($job['id']);
- }
- public function addCopy(string $url, string $to, array $options = [])
- {
- [, $promise] = $this->addJob(['url' => $url, 'options' => $options, 'copyTo' => $to]);
- return $promise;
- }
- public function getOptions()
- {
- return $this->options;
- }
- public function setOptions(array $options)
- {
- $this->options = array_replace_recursive($this->options, $options);
- }
- private function addJob(array $request, bool $sync = false): array
- {
- $request['options'] = array_replace_recursive($this->options, $request['options']);
- $job = [
- 'id' => $this->idGen++,
- 'status' => self::STATUS_QUEUED,
- 'request' => $request,
- 'sync' => $sync,
- 'origin' => Url::getOrigin($this->config, $request['url']),
- ];
- if (!$sync && !$this->allowAsync) {
- 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');
- }
- if (Preg::isMatch('{^https?://([^:/]+):([^@/]+)@([^/]+)}i', $request['url'], $match)) {
- $this->io->setAuthentication($job['origin'], rawurldecode($match[1]), rawurldecode($match[2]));
- }
- $rfs = $this->rfs;
- if ($this->canUseCurl($job)) {
- $resolver = static function ($resolve, $reject) use (&$job): void {
- $job['status'] = HttpDownloader::STATUS_QUEUED;
- $job['resolve'] = $resolve;
- $job['reject'] = $reject;
- };
- } else {
- $resolver = static function ($resolve, $reject) use (&$job, $rfs): void {
- $url = $job['request']['url'];
- $options = $job['request']['options'];
- $job['status'] = HttpDownloader::STATUS_STARTED;
- if ($job['request']['copyTo']) {
- $rfs->copy($job['origin'], $url, $job['request']['copyTo'], false , $options);
- $headers = $rfs->getLastHeaders();
- $response = new Http\Response($job['request'], $rfs->findStatusCode($headers), $headers, $job['request']['copyTo'].'~');
- $resolve($response);
- } else {
- $body = $rfs->getContents($job['origin'], $url, false , $options);
- $headers = $rfs->getLastHeaders();
- $response = new Http\Response($job['request'], $rfs->findStatusCode($headers), $headers, $body);
- $resolve($response);
- }
- };
- }
- $curl = $this->curl;
- $canceler = static function () use (&$job, $curl): void {
- if ($job['status'] === HttpDownloader::STATUS_QUEUED) {
- $job['status'] = HttpDownloader::STATUS_ABORTED;
- }
- if ($job['status'] !== HttpDownloader::STATUS_STARTED) {
- return;
- }
- $job['status'] = HttpDownloader::STATUS_ABORTED;
- if (isset($job['curl_id'])) {
- $curl->abortRequest($job['curl_id']);
- }
- throw new IrrecoverableDownloadException('Download of ' . Url::sanitize($job['request']['url']) . ' canceled');
- };
- $promise = new Promise($resolver, $canceler);
- $promise = $promise->then(function ($response) use (&$job) {
- $job['status'] = HttpDownloader::STATUS_COMPLETED;
- $job['response'] = $response;
- $this->markJobDone();
- return $response;
- }, function ($e) use (&$job): void {
- $job['status'] = HttpDownloader::STATUS_FAILED;
- $job['exception'] = $e;
- $this->markJobDone();
- throw $e;
- });
- $this->jobs[$job['id']] = &$job;
- if ($this->runningJobs < $this->maxJobs) {
- $this->startJob($job['id']);
- }
- return [$job, $promise];
- }
- private function startJob(int $id): void
- {
- $job = &$this->jobs[$id];
- if ($job['status'] !== self::STATUS_QUEUED) {
- return;
- }
- $job['status'] = self::STATUS_STARTED;
- $this->runningJobs++;
- $resolve = $job['resolve'];
- $reject = $job['reject'];
- $url = $job['request']['url'];
- $options = $job['request']['options'];
- $origin = $job['origin'];
- if ($this->disabled) {
- if (isset($job['request']['options']['http']['header']) && false !== stripos(implode('', $job['request']['options']['http']['header']), 'if-modified-since')) {
- $resolve(new Response(['url' => $url], 304, [], ''));
- } else {
- $e = new TransportException('Network disabled, request canceled: '.Url::sanitize($url), 499);
- $e->setStatusCode(499);
- $reject($e);
- }
- return;
- }
- try {
- if ($job['request']['copyTo']) {
- $job['curl_id'] = $this->curl->download($resolve, $reject, $origin, $url, $options, $job['request']['copyTo']);
- } else {
- $job['curl_id'] = $this->curl->download($resolve, $reject, $origin, $url, $options);
- }
- } catch (\Exception $exception) {
- $reject($exception);
- }
- }
- private function markJobDone(): void
- {
- $this->runningJobs--;
- }
- public function wait(?int $index = null)
- {
- do {
- $jobCount = $this->countActiveJobs($index);
- } while ($jobCount);
- }
- public function enableAsync(): void
- {
- $this->allowAsync = true;
- }
- public function countActiveJobs(?int $index = null): int
- {
- if ($this->runningJobs < $this->maxJobs) {
- foreach ($this->jobs as $job) {
- if ($job['status'] === self::STATUS_QUEUED && $this->runningJobs < $this->maxJobs) {
- $this->startJob($job['id']);
- }
- }
- }
- if ($this->curl) {
- $this->curl->tick();
- }
- if (null !== $index) {
- return $this->jobs[$index]['status'] < self::STATUS_COMPLETED ? 1 : 0;
- }
- $active = 0;
- foreach ($this->jobs as $job) {
- if ($job['status'] < self::STATUS_COMPLETED) {
- $active++;
- } elseif (!$job['sync']) {
- unset($this->jobs[$job['id']]);
- }
- }
- return $active;
- }
- private function getResponse(int $index): Response
- {
- if (!isset($this->jobs[$index])) {
- throw new \LogicException('Invalid request id');
- }
- if ($this->jobs[$index]['status'] === self::STATUS_FAILED) {
- throw $this->jobs[$index]['exception'];
- }
- if (!isset($this->jobs[$index]['response'])) {
- throw new \LogicException('Response not available yet, call wait() first');
- }
- $resp = $this->jobs[$index]['response'];
- unset($this->jobs[$index]);
- return $resp;
- }
- public static function outputWarnings(IOInterface $io, string $url, $data): void
- {
- $cleanMessage = static function ($msg) use ($io) {
- if (!$io->isDecorated()) {
- $msg = Preg::replace('{'.chr(27).'\\[[;\d]*m}u', '', $msg);
- }
- return $msg;
- };
- foreach (['warning', 'info'] as $type) {
- if (empty($data[$type])) {
- continue;
- }
- if (!empty($data[$type . '-versions'])) {
- $versionParser = new VersionParser();
- $constraint = $versionParser->parseConstraints($data[$type . '-versions']);
- $composer = new Constraint('==', $versionParser->normalize(Composer::getVersion()));
- if (!$constraint->matches($composer)) {
- continue;
- }
- }
- $io->writeError('<'.$type.'>'.ucfirst($type).' from '.Url::sanitize($url).': '.$cleanMessage($data[$type]).'</'.$type.'>');
- }
- foreach (['warnings', 'infos'] as $key) {
- if (empty($data[$key])) {
- continue;
- }
- $versionParser = new VersionParser();
- foreach ($data[$key] as $spec) {
- $type = substr($key, 0, -1);
- $constraint = $versionParser->parseConstraints($spec['versions']);
- $composer = new Constraint('==', $versionParser->normalize(Composer::getVersion()));
- if (!$constraint->matches($composer)) {
- continue;
- }
- $io->writeError('<'.$type.'>'.ucfirst($type).' from '.Url::sanitize($url).': '.$cleanMessage($spec['message']).'</'.$type.'>');
- }
- }
- }
- public static function getExceptionHints(\Throwable $e): ?array
- {
- if (!$e instanceof TransportException) {
- return null;
- }
- if (
- false !== strpos($e->getMessage(), 'Resolving timed out')
- || false !== strpos($e->getMessage(), 'Could not resolve host')
- ) {
- Silencer::suppress();
- $testConnectivity = file_get_contents('https://8.8.8.8', false, stream_context_create([
- 'ssl' => ['verify_peer' => false],
- 'http' => ['follow_location' => false, 'ignore_errors' => true],
- ]));
- Silencer::restore();
- if (false !== $testConnectivity) {
- return [
- '<error>The following exception probably indicates you have misconfigured DNS resolver(s)</error>',
- ];
- }
- return [
- '<error>The following exception probably indicates you are offline or have misconfigured DNS resolver(s)</error>',
- ];
- }
- return null;
- }
- private function canUseCurl(array $job): bool
- {
- if (!$this->curl) {
- return false;
- }
- if (!Preg::isMatch('{^https?://}i', $job['request']['url'])) {
- return false;
- }
- if (!empty($job['request']['options']['ssl']['allow_self_signed'])) {
- return false;
- }
- return true;
- }
- public static function isCurlEnabled(): bool
- {
- return \extension_loaded('curl') && \function_exists('curl_multi_exec') && \function_exists('curl_multi_init');
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Util;
- use Composer\XdebugHandler\XdebugHandler;
- class IniHelper
- {
- public static function getAll(): array
- {
- return XdebugHandler::getAllIniFiles();
- }
- public static function getMessage(): string
- {
- $paths = self::getAll();
- if (empty($paths[0])) {
- array_shift($paths);
- }
- $ini = array_shift($paths);
- if (empty($ini)) {
- return 'A php.ini file does not exist. You will have to create one.';
- }
- if (!empty($paths)) {
- return 'Your command-line PHP is using multiple ini files. Run `php --ini` to show them.';
- }
- return 'The php.ini used by your command-line PHP is: '.$ini;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Util;
- use React\Promise\CancellablePromiseInterface;
- use Symfony\Component\Console\Helper\ProgressBar;
- use React\Promise\PromiseInterface;
- class Loop
- {
- private $httpDownloader;
- private $processExecutor;
- private $currentPromises = [];
- private $waitIndex = 0;
- public function __construct(HttpDownloader $httpDownloader, ?ProcessExecutor $processExecutor = null)
- {
- $this->httpDownloader = $httpDownloader;
- $this->httpDownloader->enableAsync();
- $this->processExecutor = $processExecutor;
- if ($this->processExecutor) {
- $this->processExecutor->enableAsync();
- }
- }
- public function getHttpDownloader(): HttpDownloader
- {
- return $this->httpDownloader;
- }
- public function getProcessExecutor(): ?ProcessExecutor
- {
- return $this->processExecutor;
- }
- public function wait(array $promises, ?ProgressBar $progress = null): void
- {
- $uncaught = null;
- \React\Promise\all($promises)->then(
- static function (): void {
- },
- static function ($e) use (&$uncaught): void {
- $uncaught = $e;
- }
- );
- $waitIndex = $this->waitIndex++;
- $this->currentPromises[$waitIndex] = $promises;
- if ($progress) {
- $totalJobs = 0;
- $totalJobs += $this->httpDownloader->countActiveJobs();
- if ($this->processExecutor) {
- $totalJobs += $this->processExecutor->countActiveJobs();
- }
- $progress->start($totalJobs);
- }
- $lastUpdate = 0;
- while (true) {
- $activeJobs = 0;
- $activeJobs += $this->httpDownloader->countActiveJobs();
- if ($this->processExecutor) {
- $activeJobs += $this->processExecutor->countActiveJobs();
- }
- if ($progress && microtime(true) - $lastUpdate > 0.1) {
- $lastUpdate = microtime(true);
- $progress->setProgress($progress->getMaxSteps() - $activeJobs);
- }
- if (!$activeJobs) {
- break;
- }
- }
- if ($progress) {
- $progress->finish();
- }
- unset($this->currentPromises[$waitIndex]);
- if ($uncaught) {
- throw $uncaught;
- }
- }
- public function abortJobs(): void
- {
- foreach ($this->currentPromises as $promiseGroup) {
- foreach ($promiseGroup as $promise) {
- if ($promise instanceof CancellablePromiseInterface) {
- $promise->cancel();
- }
- }
- }
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Util;
- @trigger_error('Composer\Util\MetadataMinifier is deprecated, use Composer\MetadataMinifier\MetadataMinifier from composer/metadata-minifier instead.', E_USER_DEPRECATED);
- class MetadataMinifier extends \Composer\MetadataMinifier\MetadataMinifier
- {
- }
- <?php declare(strict_types=1);
- namespace Composer\Util;
- use Composer\Pcre\Preg;
- use stdClass;
- class NoProxyPattern
- {
- protected $hostNames = [];
- protected $rules = [];
- protected $noproxy;
- public function __construct(string $pattern)
- {
- $this->hostNames = Preg::split('{[\s,]+}', $pattern, -1, PREG_SPLIT_NO_EMPTY);
- $this->noproxy = empty($this->hostNames) || '*' === $this->hostNames[0];
- }
- public function test(string $url): bool
- {
- if ($this->noproxy) {
- return true;
- }
- if (!$urlData = $this->getUrlData($url)) {
- return false;
- }
- foreach ($this->hostNames as $index => $hostName) {
- if ($this->match($index, $hostName, $urlData)) {
- return true;
- }
- }
- return false;
- }
- protected function getUrlData(string $url)
- {
- if (!$host = parse_url($url, PHP_URL_HOST)) {
- return false;
- }
- $port = parse_url($url, PHP_URL_PORT);
- if (empty($port)) {
- switch (parse_url($url, PHP_URL_SCHEME)) {
- case 'http':
- $port = 80;
- break;
- case 'https':
- $port = 443;
- break;
- }
- }
- $hostName = $host . ($port ? ':' . $port : '');
- [$host, $port, $err] = $this->splitHostPort($hostName);
- if ($err || !$this->ipCheckData($host, $ipdata)) {
- return false;
- }
- return $this->makeData($host, $port, $ipdata);
- }
- protected function match(int $index, string $hostName, stdClass $url): bool
- {
- if (!$rule = $this->getRule($index, $hostName)) {
- return false;
- }
- if ($rule->ipdata) {
- if (!$url->ipdata) {
- return false;
- }
- if ($rule->ipdata->netmask) {
- return $this->matchRange($rule->ipdata, $url->ipdata);
- }
- $match = $rule->ipdata->ip === $url->ipdata->ip;
- } else {
- $haystack = substr($url->name, -strlen($rule->name));
- $match = stripos($haystack, $rule->name) === 0;
- }
- if ($match && $rule->port) {
- $match = $rule->port === $url->port;
- }
- return $match;
- }
- protected function matchRange(stdClass $network, stdClass $target): bool
- {
- $net = unpack('C*', $network->ip);
- $mask = unpack('C*', $network->netmask);
- $ip = unpack('C*', $target->ip);
- if (false === $net) {
- throw new \RuntimeException('Could not parse network IP '.$network->ip);
- }
- if (false === $mask) {
- throw new \RuntimeException('Could not parse netmask '.$network->netmask);
- }
- if (false === $ip) {
- throw new \RuntimeException('Could not parse target IP '.$target->ip);
- }
- for ($i = 1; $i < 17; ++$i) {
- if (($net[$i] & $mask[$i]) !== ($ip[$i] & $mask[$i])) {
- return false;
- }
- }
- return true;
- }
- private function getRule(int $index, string $hostName): ?stdClass
- {
- if (array_key_exists($index, $this->rules)) {
- return $this->rules[$index];
- }
- $this->rules[$index] = null;
- [$host, $port, $err] = $this->splitHostPort($hostName);
- if ($err || !$this->ipCheckData($host, $ipdata, true)) {
- return null;
- }
- $this->rules[$index] = $this->makeData($host, $port, $ipdata);
- return $this->rules[$index];
- }
- private function ipCheckData(string $host, ?stdClass &$ipdata, bool $allowPrefix = false): bool
- {
- $ipdata = null;
- $netmask = null;
- $prefix = null;
- $modified = false;
- if (strpos($host, '/') !== false) {
- [$host, $prefix] = explode('/', $host);
- if (!$allowPrefix || !$this->validateInt($prefix, 0, 128)) {
- return false;
- }
- $prefix = (int) $prefix;
- $modified = true;
- }
- if (!filter_var($host, FILTER_VALIDATE_IP)) {
- return !$modified;
- }
- [$ip, $size] = $this->ipGetAddr($host);
- if ($prefix !== null) {
- if ($prefix > $size * 8) {
- return false;
- }
- [$ip, $netmask] = $this->ipGetNetwork($ip, $size, $prefix);
- }
- $ipdata = $this->makeIpData($ip, $size, $netmask);
- return true;
- }
- private function ipGetAddr(string $host): array
- {
- $ip = inet_pton($host);
- $size = strlen($ip);
- $mapped = $this->ipMapTo6($ip, $size);
- return [$mapped, $size];
- }
- private function ipGetMask(int $prefix, int $size): string
- {
- $mask = '';
- if ($ones = floor($prefix / 8)) {
- $mask = str_repeat(chr(255), (int) $ones);
- }
- if ($remainder = $prefix % 8) {
- $mask .= chr(0xff ^ (0xff >> $remainder));
- }
- $mask = str_pad($mask, $size, chr(0));
- return $this->ipMapTo6($mask, $size);
- }
- private function ipGetNetwork(string $rangeIp, int $size, int $prefix): array
- {
- $netmask = $this->ipGetMask($prefix, $size);
- $mask = unpack('C*', $netmask);
- $ip = unpack('C*', $rangeIp);
- $net = '';
- if (false === $mask) {
- throw new \RuntimeException('Could not parse netmask '.$netmask);
- }
- if (false === $ip) {
- throw new \RuntimeException('Could not parse range IP '.$rangeIp);
- }
- for ($i = 1; $i < 17; ++$i) {
- $net .= chr($ip[$i] & $mask[$i]);
- }
- return [$net, $netmask];
- }
- private function ipMapTo6(string $binary, int $size): string
- {
- if ($size === 4) {
- $prefix = str_repeat(chr(0), 10) . str_repeat(chr(255), 2);
- $binary = $prefix . $binary;
- }
- return $binary;
- }
- private function makeData(string $host, int $port, ?stdClass $ipdata): stdClass
- {
- return (object) [
- 'host' => $host,
- 'name' => '.' . ltrim($host, '.'),
- 'port' => $port,
- 'ipdata' => $ipdata,
- ];
- }
- private function makeIpData(string $ip, int $size, ?string $netmask): stdClass
- {
- return (object) [
- 'ip' => $ip,
- 'size' => $size,
- 'netmask' => $netmask,
- ];
- }
- private function splitHostPort(string $hostName): array
- {
- $error = ['', '', true];
- $port = 0;
- $ip6 = '';
- if ($hostName[0] === '[') {
- $index = strpos($hostName, ']');
- if (false === $index || $index < 3) {
- return $error;
- }
- $ip6 = substr($hostName, 1, $index - 1);
- $hostName = substr($hostName, $index + 1);
- if (strpbrk($hostName, '[]') !== false || substr_count($hostName, ':') > 1) {
- return $error;
- }
- }
- if (substr_count($hostName, ':') === 1) {
- $index = strpos($hostName, ':');
- $port = substr($hostName, $index + 1);
- $hostName = substr($hostName, 0, $index);
- if (!$this->validateInt($port, 1, 65535)) {
- return $error;
- }
- $port = (int) $port;
- }
- $host = $ip6 . $hostName;
- return [$host, $port, false];
- }
- private function validateInt(string $int, int $min, int $max): bool
- {
- $options = [
- 'options' => [
- 'min_range' => $min,
- 'max_range' => $max,
- ],
- ];
- return false !== filter_var($int, FILTER_VALIDATE_INT, $options);
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Util;
- use Composer\Package\CompletePackageInterface;
- use Composer\Package\PackageInterface;
- class PackageInfo
- {
- public static function getViewSourceUrl(PackageInterface $package): ?string
- {
- if ($package instanceof CompletePackageInterface && isset($package->getSupport()['source'])) {
- return $package->getSupport()['source'];
- }
- return $package->getSourceUrl();
- }
- public static function getViewSourceOrHomepageUrl(PackageInterface $package): ?string
- {
- return self::getViewSourceUrl($package) ?? ($package instanceof CompletePackageInterface ? $package->getHomepage() : null);
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Util;
- use Composer\Package\PackageInterface;
- use Composer\Package\RootPackageInterface;
- class PackageSorter
- {
- public static function getMostCurrentVersion(array $packages): ?PackageInterface
- {
- return array_reduce($packages, static function ($carry, $pkg) {
- if ($carry === null) {
- return $pkg;
- }
- if ($pkg->isDefaultBranch()) {
- return $pkg;
- }
- if (!$carry->isDefaultBranch() && version_compare($carry->getVersion(), $pkg->getVersion(), '<')) {
- return $pkg;
- }
- return $carry;
- });
- }
- public static function sortPackagesAlphabetically(array $packages): array
- {
- usort($packages, static function (PackageInterface $a, PackageInterface $b) {
- return $a->getName() <=> $b->getName();
- });
- return $packages;
- }
- public static function sortPackages(array $packages, array $weights = []): array
- {
- $usageList = [];
- foreach ($packages as $package) {
- $links = $package->getRequires();
- if ($package instanceof RootPackageInterface) {
- $links = array_merge($links, $package->getDevRequires());
- }
- foreach ($links as $link) {
- $target = $link->getTarget();
- $usageList[$target][] = $package->getName();
- }
- }
- $computing = [];
- $computed = [];
- $computeImportance = static function ($name) use (&$computeImportance, &$computing, &$computed, $usageList, $weights) {
- if (isset($computed[$name])) {
- return $computed[$name];
- }
- if (isset($computing[$name])) {
- return 0;
- }
- $computing[$name] = true;
- $weight = $weights[$name] ?? 0;
- if (isset($usageList[$name])) {
- foreach ($usageList[$name] as $user) {
- $weight -= 1 - $computeImportance($user);
- }
- }
- unset($computing[$name]);
- $computed[$name] = $weight;
- return $weight;
- };
- $weightedPackages = [];
- foreach ($packages as $index => $package) {
- $name = $package->getName();
- $weight = $computeImportance($name);
- $weightedPackages[] = ['name' => $name, 'weight' => $weight, 'index' => $index];
- }
- usort($weightedPackages, static function (array $a, array $b): int {
- if ($a['weight'] !== $b['weight']) {
- return $a['weight'] - $b['weight'];
- }
- return strnatcasecmp($a['name'], $b['name']);
- });
- $sortedPackages = [];
- foreach ($weightedPackages as $pkg) {
- $sortedPackages[] = $packages[$pkg['index']];
- }
- return $sortedPackages;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Util;
- use Composer\IO\IOInterface;
- use Composer\Pcre\Preg;
- use Symfony\Component\Process\Process;
- class Perforce
- {
- protected $path;
- protected $p4Depot;
- protected $p4Client;
- protected $p4User;
- protected $p4Password;
- protected $p4Port;
- protected $p4Stream;
- protected $p4ClientSpec;
- protected $p4DepotType;
- protected $p4Branch;
- protected $process;
- protected $uniquePerforceClientName;
- protected $windowsFlag;
- protected $commandResult;
- protected $io;
- protected $filesystem;
- public function __construct($repoConfig, string $port, string $path, ProcessExecutor $process, bool $isWindows, IOInterface $io)
- {
- $this->windowsFlag = $isWindows;
- $this->p4Port = $port;
- $this->initializePath($path);
- $this->process = $process;
- $this->initialize($repoConfig);
- $this->io = $io;
- }
- public static function create($repoConfig, string $port, string $path, ProcessExecutor $process, IOInterface $io): self
- {
- return new Perforce($repoConfig, $port, $path, $process, Platform::isWindows(), $io);
- }
- public static function checkServerExists(string $url, ProcessExecutor $processExecutor): bool
- {
- return 0 === $processExecutor->execute('p4 -p ' . ProcessExecutor::escape($url) . ' info -s', $ignoredOutput);
- }
- public function initialize($repoConfig): void
- {
- $this->uniquePerforceClientName = $this->generateUniquePerforceClientName();
- if (!$repoConfig) {
- return;
- }
- if (isset($repoConfig['unique_perforce_client_name'])) {
- $this->uniquePerforceClientName = $repoConfig['unique_perforce_client_name'];
- }
- if (isset($repoConfig['depot'])) {
- $this->p4Depot = $repoConfig['depot'];
- }
- if (isset($repoConfig['branch'])) {
- $this->p4Branch = $repoConfig['branch'];
- }
- if (isset($repoConfig['p4user'])) {
- $this->p4User = $repoConfig['p4user'];
- } else {
- $this->p4User = $this->getP4variable('P4USER');
- }
- if (isset($repoConfig['p4password'])) {
- $this->p4Password = $repoConfig['p4password'];
- }
- }
- public function initializeDepotAndBranch(?string $depot, ?string $branch): void
- {
- if (isset($depot)) {
- $this->p4Depot = $depot;
- }
- if (isset($branch)) {
- $this->p4Branch = $branch;
- }
- }
- public function generateUniquePerforceClientName(): string
- {
- return gethostname() . "_" . time();
- }
- public function cleanupClientSpec(): void
- {
- $client = $this->getClient();
- $task = 'client -d ' . ProcessExecutor::escape($client);
- $useP4Client = false;
- $command = $this->generateP4Command($task, $useP4Client);
- $this->executeCommand($command);
- $clientSpec = $this->getP4ClientSpec();
- $fileSystem = $this->getFilesystem();
- $fileSystem->remove($clientSpec);
- }
- protected function executeCommand($command): int
- {
- $this->commandResult = '';
- return $this->process->execute($command, $this->commandResult);
- }
- public function getClient(): string
- {
- if (!isset($this->p4Client)) {
- $cleanStreamName = str_replace(['//', '/', '@'], ['', '_', ''], $this->getStream());
- $this->p4Client = 'composer_perforce_' . $this->uniquePerforceClientName . '_' . $cleanStreamName;
- }
- return $this->p4Client;
- }
- protected function getPath(): string
- {
- return $this->path;
- }
- public function initializePath(string $path): void
- {
- $this->path = $path;
- $fs = $this->getFilesystem();
- $fs->ensureDirectoryExists($path);
- }
- protected function getPort(): string
- {
- return $this->p4Port;
- }
- public function setStream(string $stream): void
- {
- $this->p4Stream = $stream;
- $index = strrpos($stream, '/');
- if ($index > 2) {
- $this->p4DepotType = 'stream';
- }
- }
- public function isStream(): bool
- {
- return is_string($this->p4DepotType) && (strcmp($this->p4DepotType, 'stream') === 0);
- }
- public function getStream(): string
- {
- if (!isset($this->p4Stream)) {
- if ($this->isStream()) {
- $this->p4Stream = '//' . $this->p4Depot . '/' . $this->p4Branch;
- } else {
- $this->p4Stream = '//' . $this->p4Depot;
- }
- }
- return $this->p4Stream;
- }
- public function getStreamWithoutLabel(string $stream): string
- {
- $index = strpos($stream, '@');
- if ($index === false) {
- return $stream;
- }
- return substr($stream, 0, $index);
- }
- public function getP4ClientSpec(): string
- {
- return $this->path . '/' . $this->getClient() . '.p4.spec';
- }
- public function getUser(): ?string
- {
- return $this->p4User;
- }
- public function setUser(?string $user): void
- {
- $this->p4User = $user;
- }
- public function queryP4User(): void
- {
- $this->getUser();
- if (strlen((string) $this->p4User) > 0) {
- return;
- }
- $this->p4User = $this->getP4variable('P4USER');
- if (strlen((string) $this->p4User) > 0) {
- return;
- }
- $this->p4User = $this->io->ask('Enter P4 User:');
- if ($this->windowsFlag) {
- $command = 'p4 set P4USER=' . $this->p4User;
- } else {
- $command = 'export P4USER=' . $this->p4User;
- }
- $this->executeCommand($command);
- }
- protected function getP4variable(string $name): ?string
- {
- if ($this->windowsFlag) {
- $command = 'p4 set';
- $this->executeCommand($command);
- $result = trim($this->commandResult);
- $resArray = explode(PHP_EOL, $result);
- foreach ($resArray as $line) {
- $fields = explode('=', $line);
- if (strcmp($name, $fields[0]) === 0) {
- $index = strpos($fields[1], ' ');
- if ($index === false) {
- $value = $fields[1];
- } else {
- $value = substr($fields[1], 0, $index);
- }
- $value = trim($value);
- return $value;
- }
- }
- return null;
- }
- $command = 'echo $' . $name;
- $this->executeCommand($command);
- $result = trim($this->commandResult);
- return $result;
- }
- public function queryP4Password(): ?string
- {
- if (isset($this->p4Password)) {
- return $this->p4Password;
- }
- $password = $this->getP4variable('P4PASSWD');
- if (strlen((string) $password) <= 0) {
- $password = $this->io->askAndHideAnswer('Enter password for Perforce user ' . $this->getUser() . ': ');
- }
- $this->p4Password = $password;
- return $password;
- }
- public function generateP4Command(string $command, bool $useClient = true): string
- {
- $p4Command = 'p4 ';
- $p4Command .= '-u ' . $this->getUser() . ' ';
- if ($useClient) {
- $p4Command .= '-c ' . $this->getClient() . ' ';
- }
- $p4Command .= '-p ' . $this->getPort() . ' ' . $command;
- return $p4Command;
- }
- public function isLoggedIn(): bool
- {
- $command = $this->generateP4Command('login -s', false);
- $exitCode = $this->executeCommand($command);
- if ($exitCode) {
- $errorOutput = $this->process->getErrorOutput();
- $index = strpos($errorOutput, $this->getUser());
- if ($index === false) {
- $index = strpos($errorOutput, 'p4');
- if ($index === false) {
- return false;
- }
- throw new \Exception('p4 command not found in path: ' . $errorOutput);
- }
- throw new \Exception('Invalid user name: ' . $this->getUser());
- }
- return true;
- }
- public function connectClient(): void
- {
- $p4CreateClientCommand = $this->generateP4Command(
- 'client -i < ' . str_replace(" ", "\\ ", $this->getP4ClientSpec())
- );
- $this->executeCommand($p4CreateClientCommand);
- }
- public function syncCodeBase(?string $sourceReference): void
- {
- $prevDir = Platform::getCwd();
- chdir($this->path);
- $p4SyncCommand = $this->generateP4Command('sync -f ');
- if (null !== $sourceReference) {
- $p4SyncCommand .= '@' . $sourceReference;
- }
- $this->executeCommand($p4SyncCommand);
- chdir($prevDir);
- }
- public function writeClientSpecToFile($spec): void
- {
- fwrite($spec, 'Client: ' . $this->getClient() . PHP_EOL . PHP_EOL);
- fwrite($spec, 'Update: ' . date('Y/m/d H:i:s') . PHP_EOL . PHP_EOL);
- fwrite($spec, 'Access: ' . date('Y/m/d H:i:s') . PHP_EOL);
- fwrite($spec, 'Owner: ' . $this->getUser() . PHP_EOL . PHP_EOL);
- fwrite($spec, 'Description:' . PHP_EOL);
- fwrite($spec, ' Created by ' . $this->getUser() . ' from composer.' . PHP_EOL . PHP_EOL);
- fwrite($spec, 'Root: ' . $this->getPath() . PHP_EOL . PHP_EOL);
- fwrite($spec, 'Options: noallwrite noclobber nocompress unlocked modtime rmdir' . PHP_EOL . PHP_EOL);
- fwrite($spec, 'SubmitOptions: revertunchanged' . PHP_EOL . PHP_EOL);
- fwrite($spec, 'LineEnd: local' . PHP_EOL . PHP_EOL);
- if ($this->isStream()) {
- fwrite($spec, 'Stream:' . PHP_EOL);
- fwrite($spec, ' ' . $this->getStreamWithoutLabel($this->p4Stream) . PHP_EOL);
- } else {
- fwrite(
- $spec,
- 'View: ' . $this->getStream() . '/... //' . $this->getClient() . '/... ' . PHP_EOL
- );
- }
- }
- public function writeP4ClientSpec(): void
- {
- $clientSpec = $this->getP4ClientSpec();
- $spec = fopen($clientSpec, 'w');
- try {
- $this->writeClientSpecToFile($spec);
- } catch (\Exception $e) {
- fclose($spec);
- throw $e;
- }
- fclose($spec);
- }
- protected function read($pipe, $name): void
- {
- if (feof($pipe)) {
- return;
- }
- $line = fgets($pipe);
- while ($line !== false) {
- $line = fgets($pipe);
- }
- }
- public function windowsLogin(?string $password): int
- {
- $command = $this->generateP4Command(' login -a');
- $process = Process::fromShellCommandline($command, null, null, $password);
- return $process->run();
- }
- public function p4Login(): void
- {
- $this->queryP4User();
- if (!$this->isLoggedIn()) {
- $password = $this->queryP4Password();
- if ($this->windowsFlag) {
- $this->windowsLogin($password);
- } else {
- $command = 'echo ' . ProcessExecutor::escape($password) . ' | ' . $this->generateP4Command(' login -a', false);
- $exitCode = $this->executeCommand($command);
- if ($exitCode) {
- throw new \Exception("Error logging in:" . $this->process->getErrorOutput());
- }
- }
- }
- }
- public function getComposerInformation(string $identifier): ?array
- {
- $composerFileContent = $this->getFileContent('composer.json', $identifier);
- if (!$composerFileContent) {
- return null;
- }
- return json_decode($composerFileContent, true);
- }
- public function getFileContent(string $file, string $identifier): ?string
- {
- $path = $this->getFilePath($file, $identifier);
- $command = $this->generateP4Command(' print ' . ProcessExecutor::escape($path));
- $this->executeCommand($command);
- $result = $this->commandResult;
- if (!trim($result)) {
- return null;
- }
- return $result;
- }
- public function getFilePath(string $file, string $identifier): ?string
- {
- $index = strpos($identifier, '@');
- if ($index === false) {
- return $identifier. '/' . $file;
- }
- $path = substr($identifier, 0, $index) . '/' . $file . substr($identifier, $index);
- $command = $this->generateP4Command(' files ' . ProcessExecutor::escape($path), false);
- $this->executeCommand($command);
- $result = $this->commandResult;
- $index2 = strpos($result, 'no such file(s).');
- if ($index2 === false) {
- $index3 = strpos($result, 'change');
- if ($index3 !== false) {
- $phrase = trim(substr($result, $index3));
- $fields = explode(' ', $phrase);
- return substr($identifier, 0, $index) . '/' . $file . '@' . $fields[1];
- }
- }
- return null;
- }
- public function getBranches(): array
- {
- $possibleBranches = [];
- if (!$this->isStream()) {
- $possibleBranches[$this->p4Branch] = $this->getStream();
- } else {
- $command = $this->generateP4Command('streams '.ProcessExecutor::escape('//' . $this->p4Depot . '/...'));
- $this->executeCommand($command);
- $result = $this->commandResult;
- $resArray = explode(PHP_EOL, $result);
- foreach ($resArray as $line) {
- $resBits = explode(' ', $line);
- if (count($resBits) > 4) {
- $branch = Preg::replace('/[^A-Za-z0-9 ]/', '', $resBits[4]);
- $possibleBranches[$branch] = $resBits[1];
- }
- }
- }
- $command = $this->generateP4Command('changes '. ProcessExecutor::escape($this->getStream() . '/...'), false);
- $this->executeCommand($command);
- $result = $this->commandResult;
- $resArray = explode(PHP_EOL, $result);
- $lastCommit = $resArray[0];
- $lastCommitArr = explode(' ', $lastCommit);
- $lastCommitNum = $lastCommitArr[1];
- return ['master' => $possibleBranches[$this->p4Branch] . '@'. $lastCommitNum];
- }
- public function getTags(): array
- {
- $command = $this->generateP4Command('labels');
- $this->executeCommand($command);
- $result = $this->commandResult;
- $resArray = explode(PHP_EOL, $result);
- $tags = [];
- foreach ($resArray as $line) {
- if (strpos($line, 'Label') !== false) {
- $fields = explode(' ', $line);
- $tags[$fields[1]] = $this->getStream() . '@' . $fields[1];
- }
- }
- return $tags;
- }
- public function checkStream(): bool
- {
- $command = $this->generateP4Command('depots', false);
- $this->executeCommand($command);
- $result = $this->commandResult;
- $resArray = explode(PHP_EOL, $result);
- foreach ($resArray as $line) {
- if (strpos($line, 'Depot') !== false) {
- $fields = explode(' ', $line);
- if (strcmp($this->p4Depot, $fields[1]) === 0) {
- $this->p4DepotType = $fields[3];
- return $this->isStream();
- }
- }
- }
- return false;
- }
- protected function getChangeList(string $reference): mixed
- {
- $index = strpos($reference, '@');
- if ($index === false) {
- return null;
- }
- $label = substr($reference, $index);
- $command = $this->generateP4Command(' changes -m1 ' . ProcessExecutor::escape($label));
- $this->executeCommand($command);
- $changes = $this->commandResult;
- if (strpos($changes, 'Change') !== 0) {
- return null;
- }
- $fields = explode(' ', $changes);
- return $fields[1];
- }
- public function getCommitLogs(string $fromReference, string $toReference): mixed
- {
- $fromChangeList = $this->getChangeList($fromReference);
- if ($fromChangeList === null) {
- return null;
- }
- $toChangeList = $this->getChangeList($toReference);
- if ($toChangeList === null) {
- return null;
- }
- $index = strpos($fromReference, '@');
- $main = substr($fromReference, 0, $index) . '/...';
- $command = $this->generateP4Command('filelog ' . ProcessExecutor::escape($main . '@' . $fromChangeList. ',' . $toChangeList));
- $this->executeCommand($command);
- return $this->commandResult;
- }
- public function getFilesystem(): Filesystem
- {
- if (null === $this->filesystem) {
- $this->filesystem = new Filesystem($this->process);
- }
- return $this->filesystem;
- }
- public function setFilesystem(Filesystem $fs): void
- {
- $this->filesystem = $fs;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Util;
- use Composer\Pcre\Preg;
- class Platform
- {
- private static $isVirtualBoxGuest = null;
- private static $isWindowsSubsystemForLinux = null;
- public static function getCwd(bool $allowEmpty = false): string
- {
- $cwd = getcwd();
- if (false === $cwd) {
- $cwd = realpath('');
- }
- if (false === $cwd) {
- if ($allowEmpty) {
- return '';
- }
- throw new \RuntimeException('Could not determine the current working directory');
- }
- return $cwd;
- }
- public static function getEnv(string $name)
- {
- if (array_key_exists($name, $_SERVER)) {
- return (string) $_SERVER[$name];
- }
- if (array_key_exists($name, $_ENV)) {
- return (string) $_ENV[$name];
- }
- return getenv($name);
- }
- public static function putEnv(string $name, string $value): void
- {
- $value = (string) $value;
- putenv($name . '=' . $value);
- $_SERVER[$name] = $_ENV[$name] = $value;
- }
- public static function clearEnv(string $name): void
- {
- putenv($name);
- unset($_SERVER[$name], $_ENV[$name]);
- }
- public static function expandPath(string $path): string
- {
- if (Preg::isMatch('#^~[\\/]#', $path)) {
- return self::getUserDirectory() . substr($path, 1);
- }
- return Preg::replaceCallback('#^(\$|(?P<percent>%))(?P<var>\w++)(?(percent)%)(?P<path>.*)#', static function ($matches): string {
- if (Platform::isWindows() && $matches['var'] === 'HOME') {
- return (Platform::getEnv('HOME') ?: Platform::getEnv('USERPROFILE')) . $matches['path'];
- }
- return Platform::getEnv($matches['var']) . $matches['path'];
- }, $path);
- }
- public static function getUserDirectory(): string
- {
- if (false !== ($home = self::getEnv('HOME'))) {
- return $home;
- }
- if (self::isWindows() && false !== ($home = self::getEnv('USERPROFILE'))) {
- return $home;
- }
- if (\function_exists('posix_getuid') && \function_exists('posix_getpwuid')) {
- $info = posix_getpwuid(posix_getuid());
- return $info['dir'];
- }
- throw new \RuntimeException('Could not determine user directory');
- }
- public static function isWindowsSubsystemForLinux(): bool
- {
- if (null === self::$isWindowsSubsystemForLinux) {
- self::$isWindowsSubsystemForLinux = false;
- if (self::isWindows()) {
- return self::$isWindowsSubsystemForLinux = false;
- }
- if (
- !ini_get('open_basedir')
- && is_readable('/proc/version')
- && false !== stripos(Silencer::call('file_get_contents', '/proc/version'), 'microsoft')
- && !file_exists('/.dockerenv')
- ) {
- return self::$isWindowsSubsystemForLinux = true;
- }
- }
- return self::$isWindowsSubsystemForLinux;
- }
- public static function isWindows(): bool
- {
- return \defined('PHP_WINDOWS_VERSION_BUILD');
- }
- public static function strlen(string $str): int
- {
- static $useMbString = null;
- if (null === $useMbString) {
- $useMbString = \function_exists('mb_strlen') && ini_get('mbstring.func_overload');
- }
- if ($useMbString) {
- return mb_strlen($str, '8bit');
- }
- return \strlen($str);
- }
- public static function isTty($fd = null): bool
- {
- if ($fd === null) {
- $fd = defined('STDOUT') ? STDOUT : fopen('php://stdout', 'w');
- if ($fd === false) {
- return false;
- }
- }
- if (in_array(strtoupper(self::getEnv('MSYSTEM') ?: ''), ['MINGW32', 'MINGW64'], true)) {
- return true;
- }
- if (function_exists('stream_isatty')) {
- return stream_isatty($fd);
- }
- if (function_exists('posix_isatty') && posix_isatty($fd)) {
- return true;
- }
- $stat = @fstat($fd);
- return $stat ? 0020000 === ($stat['mode'] & 0170000) : false;
- }
- public static function isInputCompletionProcess(): bool
- {
- return '_complete' === ($_SERVER['argv'][1] ?? null);
- }
- public static function workaroundFilesystemIssues(): void
- {
- if (self::isVirtualBoxGuest()) {
- usleep(200000);
- }
- }
- private static function isVirtualBoxGuest(): bool
- {
- if (null === self::$isVirtualBoxGuest) {
- self::$isVirtualBoxGuest = false;
- if (self::isWindows()) {
- return self::$isVirtualBoxGuest;
- }
- if (function_exists('posix_getpwuid') && function_exists('posix_geteuid')) {
- $processUser = posix_getpwuid(posix_geteuid());
- if ($processUser && $processUser['name'] === 'vagrant') {
- return self::$isVirtualBoxGuest = true;
- }
- }
- if (self::getEnv('COMPOSER_RUNTIME_ENV') === 'virtualbox') {
- return self::$isVirtualBoxGuest = true;
- }
- if (defined('PHP_OS_FAMILY') && PHP_OS_FAMILY === 'Linux') {
- $process = new ProcessExecutor();
- try {
- if (0 === $process->execute('lsmod | grep vboxguest', $ignoredOutput)) {
- return self::$isVirtualBoxGuest = true;
- }
- } catch (\Exception $e) {
- }
- }
- }
- return self::$isVirtualBoxGuest;
- }
- public static function getDevNull(): string
- {
- if (self::isWindows()) {
- return 'NUL';
- }
- return '/dev/null';
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Util;
- use Composer\IO\IOInterface;
- use Composer\Pcre\Preg;
- use Seld\Signal\SignalHandler;
- use Symfony\Component\Process\Exception\ProcessSignaledException;
- use Symfony\Component\Process\Process;
- use Symfony\Component\Process\Exception\RuntimeException;
- use React\Promise\Promise;
- use React\Promise\PromiseInterface;
- class ProcessExecutor
- {
- private const STATUS_QUEUED = 1;
- private const STATUS_STARTED = 2;
- private const STATUS_COMPLETED = 3;
- private const STATUS_FAILED = 4;
- private const STATUS_ABORTED = 5;
- protected static $timeout = 300;
- protected $captureOutput = false;
- protected $errorOutput = '';
- protected $io;
- private $jobs = [];
- private $runningJobs = 0;
- private $maxJobs = 10;
- private $idGen = 0;
- private $allowAsync = false;
- public function __construct(?IOInterface $io = null)
- {
- $this->io = $io;
- }
- public function execute($command, &$output = null, ?string $cwd = null): int
- {
- if (func_num_args() > 1) {
- return $this->doExecute($command, $cwd, false, $output);
- }
- return $this->doExecute($command, $cwd, false);
- }
- public function executeTty($command, ?string $cwd = null): int
- {
- if (Platform::isTty()) {
- return $this->doExecute($command, $cwd, true);
- }
- return $this->doExecute($command, $cwd, false);
- }
- private function doExecute($command, ?string $cwd, bool $tty, &$output = null): int
- {
- $this->outputCommandRun($command, $cwd, false);
- $this->captureOutput = func_num_args() > 3;
- $this->errorOutput = '';
- if (is_string($command)) {
- $process = Process::fromShellCommandline($command, $cwd, null, null, static::getTimeout());
- } else {
- $process = new Process($command, $cwd, null, null, static::getTimeout());
- }
- if (!Platform::isWindows() && $tty) {
- try {
- $process->setTty(true);
- } catch (RuntimeException $e) {
- }
- }
- $callback = is_callable($output) ? $output : function (string $type, string $buffer): void {
- $this->outputHandler($type, $buffer);
- };
- $signalHandler = SignalHandler::create([SignalHandler::SIGINT, SignalHandler::SIGTERM, SignalHandler::SIGHUP], function (string $signal) {
- if ($this->io !== null) {
- $this->io->writeError('Received '.$signal.', aborting when child process is done', true, IOInterface::DEBUG);
- }
- });
- try {
- $process->run($callback);
- if ($this->captureOutput && !is_callable($output)) {
- $output = $process->getOutput();
- }
- $this->errorOutput = $process->getErrorOutput();
- } catch (ProcessSignaledException $e) {
- if ($signalHandler->isTriggered()) {
- $signalHandler->exitWithLastSignal();
- }
- } finally {
- $signalHandler->unregister();
- }
- return $process->getExitCode();
- }
- public function executeAsync($command, ?string $cwd = null): PromiseInterface
- {
- if (!$this->allowAsync) {
- throw new \LogicException('You must use the ProcessExecutor instance which is part of a Composer\Loop instance to be able to run async processes');
- }
- $job = [
- 'id' => $this->idGen++,
- 'status' => self::STATUS_QUEUED,
- 'command' => $command,
- 'cwd' => $cwd,
- ];
- $resolver = static function ($resolve, $reject) use (&$job): void {
- $job['status'] = ProcessExecutor::STATUS_QUEUED;
- $job['resolve'] = $resolve;
- $job['reject'] = $reject;
- };
- $canceler = static function () use (&$job): void {
- if ($job['status'] === ProcessExecutor::STATUS_QUEUED) {
- $job['status'] = ProcessExecutor::STATUS_ABORTED;
- }
- if ($job['status'] !== ProcessExecutor::STATUS_STARTED) {
- return;
- }
- $job['status'] = ProcessExecutor::STATUS_ABORTED;
- try {
- if (defined('SIGINT')) {
- $job['process']->signal(SIGINT);
- }
- } catch (\Exception $e) {
- }
- $job['process']->stop(1);
- throw new \RuntimeException('Aborted process');
- };
- $promise = new Promise($resolver, $canceler);
- $promise = $promise->then(function () use (&$job) {
- if ($job['process']->isSuccessful()) {
- $job['status'] = ProcessExecutor::STATUS_COMPLETED;
- } else {
- $job['status'] = ProcessExecutor::STATUS_FAILED;
- }
- $this->markJobDone();
- return $job['process'];
- }, function ($e) use (&$job): void {
- $job['status'] = ProcessExecutor::STATUS_FAILED;
- $this->markJobDone();
- throw $e;
- });
- $this->jobs[$job['id']] = &$job;
- if ($this->runningJobs < $this->maxJobs) {
- $this->startJob($job['id']);
- }
- return $promise;
- }
- protected function outputHandler(string $type, string $buffer): void
- {
- if ($this->captureOutput) {
- return;
- }
- if (null === $this->io) {
- echo $buffer;
- return;
- }
- if (Process::ERR === $type) {
- $this->io->writeErrorRaw($buffer, false);
- } else {
- $this->io->writeRaw($buffer, false);
- }
- }
- private function startJob(int $id): void
- {
- $job = &$this->jobs[$id];
- if ($job['status'] !== self::STATUS_QUEUED) {
- return;
- }
- $job['status'] = self::STATUS_STARTED;
- $this->runningJobs++;
- $command = $job['command'];
- $cwd = $job['cwd'];
- $this->outputCommandRun($command, $cwd, true);
- try {
- if (is_string($command)) {
- $process = Process::fromShellCommandline($command, $cwd, null, null, static::getTimeout());
- } else {
- $process = new Process($command, $cwd, null, null, static::getTimeout());
- }
- } catch (\Throwable $e) {
- $job['reject']($e);
- return;
- }
- $job['process'] = $process;
- try {
- $process->start();
- } catch (\Throwable $e) {
- $job['reject']($e);
- return;
- }
- }
- public function setMaxJobs(int $maxJobs): void
- {
- $this->maxJobs = $maxJobs;
- }
- public function resetMaxJobs(): void
- {
- $this->maxJobs = 10;
- }
- public function wait($index = null): void
- {
- while (true) {
- if (0 === $this->countActiveJobs($index)) {
- return;
- }
- usleep(1000);
- }
- }
- public function enableAsync(): void
- {
- $this->allowAsync = true;
- }
- public function countActiveJobs($index = null): int
- {
- foreach ($this->jobs as $job) {
- if ($job['status'] === self::STATUS_STARTED) {
- if (!$job['process']->isRunning()) {
- call_user_func($job['resolve'], $job['process']);
- }
- $job['process']->checkTimeout();
- }
- if ($this->runningJobs < $this->maxJobs) {
- if ($job['status'] === self::STATUS_QUEUED) {
- $this->startJob($job['id']);
- }
- }
- }
- if (null !== $index) {
- return $this->jobs[$index]['status'] < self::STATUS_COMPLETED ? 1 : 0;
- }
- $active = 0;
- foreach ($this->jobs as $job) {
- if ($job['status'] < self::STATUS_COMPLETED) {
- $active++;
- } else {
- unset($this->jobs[$job['id']]);
- }
- }
- return $active;
- }
- private function markJobDone(): void
- {
- $this->runningJobs--;
- }
- public function splitLines(?string $output): array
- {
- $output = trim((string) $output);
- return $output === '' ? [] : Preg::split('{\r?\n}', $output);
- }
- public function getErrorOutput(): string
- {
- return $this->errorOutput;
- }
- public static function getTimeout(): int
- {
- return static::$timeout;
- }
- public static function setTimeout(int $timeout): void
- {
- static::$timeout = $timeout;
- }
- public static function escape($argument): string
- {
- return self::escapeArgument($argument);
- }
- private function outputCommandRun($command, ?string $cwd, bool $async): void
- {
- if (null === $this->io || !$this->io->isDebug()) {
- return;
- }
- $commandString = is_string($command) ? $command : implode(' ', array_map(self::class.'::escape', $command));
- $safeCommand = Preg::replaceCallback('{://(?P<user>[^:/\s]+):(?P<password>[^@\s/]+)@}i', static function ($m): string {
- if (Preg::isMatch('{^([a-f0-9]{12,}|gh[a-z]_[a-zA-Z0-9_]+)$}', $m['user'])) {
- return '://***:***@';
- }
- if (Preg::isMatch('{^[a-f0-9]{12,}$}', $m['user'])) {
- return '://***:***@';
- }
- return '://'.$m['user'].':***@';
- }, $commandString);
- $safeCommand = Preg::replace("{--password (.*[^\\\\]\') }", '--password \'***\' ', $safeCommand);
- $this->io->writeError('Executing'.($async ? ' async' : '').' command ('.($cwd ?: 'CWD').'): '.$safeCommand);
- }
- private static function escapeArgument($argument): string
- {
- if ('' === ($argument = (string) $argument)) {
- return escapeshellarg($argument);
- }
- if (!Platform::isWindows()) {
- return "'".str_replace("'", "'\\''", $argument)."'";
- }
- $argument = strtr($argument, "\n", ' ');
- $quote = strpbrk($argument, " \t,") !== false;
- $argument = Preg::replace('/(\\\\*)"/', '$1$1\\"', $argument, -1, $dquotes);
- $meta = $dquotes || Preg::isMatch('/%[^%]+%|![^!]+!/', $argument);
- if (!$meta && !$quote) {
- $quote = strpbrk($argument, '^&|<>()') !== false;
- }
- if ($quote) {
- $argument = '"'.Preg::replace('/(\\\\*)$/', '$1$1', $argument).'"';
- }
- if ($meta) {
- $argument = Preg::replace('/(["^&|<>()%])/', '^$1', $argument);
- $argument = Preg::replace('/(!)/', '^^$1', $argument);
- }
- return $argument;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Util;
- use Composer\Config;
- use Composer\Downloader\MaxFileSizeExceededException;
- use Composer\IO\IOInterface;
- use Composer\Downloader\TransportException;
- use Composer\Pcre\Preg;
- use Composer\Util\Http\Response;
- use Composer\Util\Http\ProxyManager;
- class RemoteFilesystem
- {
- private $io;
- private $config;
- private $scheme;
- private $bytesMax;
- private $originUrl;
- private $fileUrl;
- private $fileName;
- private $retry = false;
- private $progress;
- private $lastProgress;
- private $options = [];
- private $disableTls = false;
- private $lastHeaders;
- private $storeAuth = false;
- private $authHelper;
- private $degradedMode = false;
- private $redirects;
- private $maxRedirects = 20;
- private $proxyManager;
- public function __construct(IOInterface $io, Config $config, array $options = [], bool $disableTls = false, ?AuthHelper $authHelper = null)
- {
- $this->io = $io;
- if ($disableTls === false) {
- $this->options = StreamContextFactory::getTlsDefaults($options, $io);
- } else {
- $this->disableTls = true;
- }
- $this->options = array_replace_recursive($this->options, $options);
- $this->config = $config;
- $this->authHelper = $authHelper ?? new AuthHelper($io, $config);
- $this->proxyManager = ProxyManager::getInstance();
- }
- public function copy(string $originUrl, string $fileUrl, string $fileName, bool $progress = true, array $options = [])
- {
- return $this->get($originUrl, $fileUrl, $options, $fileName, $progress);
- }
- public function getContents(string $originUrl, string $fileUrl, bool $progress = true, array $options = [])
- {
- return $this->get($originUrl, $fileUrl, $options, null, $progress);
- }
- public function getOptions()
- {
- return $this->options;
- }
- public function setOptions(array $options)
- {
- $this->options = array_replace_recursive($this->options, $options);
- }
- public function isTlsDisabled()
- {
- return $this->disableTls === true;
- }
- public function getLastHeaders()
- {
- return $this->lastHeaders;
- }
- public static function findStatusCode(array $headers)
- {
- $value = null;
- foreach ($headers as $header) {
- if (Preg::isMatch('{^HTTP/\S+ (\d+)}i', $header, $match)) {
- $value = (int) $match[1];
- }
- }
- return $value;
- }
- public function findStatusMessage(array $headers)
- {
- $value = null;
- foreach ($headers as $header) {
- if (Preg::isMatch('{^HTTP/\S+ \d+}i', $header)) {
- $value = $header;
- }
- }
- return $value;
- }
- protected function get(string $originUrl, string $fileUrl, array $additionalOptions = [], ?string $fileName = null, bool $progress = true)
- {
- $this->scheme = parse_url(strtr($fileUrl, '\\', '/'), PHP_URL_SCHEME);
- $this->bytesMax = 0;
- $this->originUrl = $originUrl;
- $this->fileUrl = $fileUrl;
- $this->fileName = $fileName;
- $this->progress = $progress;
- $this->lastProgress = null;
- $retryAuthFailure = true;
- $this->lastHeaders = [];
- $this->redirects = 1;
- $tempAdditionalOptions = $additionalOptions;
- if (isset($tempAdditionalOptions['retry-auth-failure'])) {
- $retryAuthFailure = (bool) $tempAdditionalOptions['retry-auth-failure'];
- unset($tempAdditionalOptions['retry-auth-failure']);
- }
- $isRedirect = false;
- if (isset($tempAdditionalOptions['redirects'])) {
- $this->redirects = $tempAdditionalOptions['redirects'];
- $isRedirect = true;
- unset($tempAdditionalOptions['redirects']);
- }
- $options = $this->getOptionsForUrl($originUrl, $tempAdditionalOptions);
- unset($tempAdditionalOptions);
- $origFileUrl = $fileUrl;
- if (isset($options['gitlab-token'])) {
- $fileUrl .= (false === strpos($fileUrl, '?') ? '?' : '&') . 'access_token='.$options['gitlab-token'];
- unset($options['gitlab-token']);
- }
- if (isset($options['http'])) {
- $options['http']['ignore_errors'] = true;
- }
- if ($this->degradedMode && strpos($fileUrl, 'http://repo.packagist.org/') === 0) {
- $fileUrl = 'http://' . gethostbyname('repo.packagist.org') . substr($fileUrl, 20);
- $degradedPackagist = true;
- }
- $maxFileSize = null;
- if (isset($options['max_file_size'])) {
- $maxFileSize = $options['max_file_size'];
- unset($options['max_file_size']);
- }
- $ctx = StreamContextFactory::getContext($fileUrl, $options, ['notification' => [$this, 'callbackGet']]);
- $proxy = $this->proxyManager->getProxyForRequest($fileUrl);
- $usingProxy = $proxy->getFormattedUrl(' using proxy (%s)');
- $this->io->writeError((strpos($origFileUrl, 'http') === 0 ? 'Downloading ' : 'Reading ') . Url::sanitize($origFileUrl) . $usingProxy, true, IOInterface::DEBUG);
- unset($origFileUrl, $proxy, $usingProxy);
- if ((!Preg::isMatch('{^http://(repo\.)?packagist\.org/p/}', $fileUrl) || (false === strpos($fileUrl, '$') && false === strpos($fileUrl, '%24'))) && empty($degradedPackagist)) {
- $this->config->prohibitUrlByConfig($fileUrl, $this->io);
- }
- if ($this->progress && !$isRedirect) {
- $this->io->writeError("Downloading (<comment>connecting...</comment>)", false);
- }
- $errorMessage = '';
- $errorCode = 0;
- $result = false;
- set_error_handler(static function ($code, $msg) use (&$errorMessage): bool {
- if ($errorMessage) {
- $errorMessage .= "\n";
- }
- $errorMessage .= Preg::replace('{^file_get_contents\(.*?\): }', '', $msg);
- return true;
- });
- $http_response_header = [];
- try {
- $result = $this->getRemoteContents($originUrl, $fileUrl, $ctx, $http_response_header, $maxFileSize);
- if (!empty($http_response_header[0])) {
- $statusCode = self::findStatusCode($http_response_header);
- if ($statusCode >= 400 && Response::findHeaderValue($http_response_header, 'content-type') === 'application/json') {
- HttpDownloader::outputWarnings($this->io, $originUrl, json_decode($result, true));
- }
- if (in_array($statusCode, [401, 403]) && $retryAuthFailure) {
- $this->promptAuthAndRetry($statusCode, $this->findStatusMessage($http_response_header), $http_response_header);
- }
- }
- $contentLength = !empty($http_response_header[0]) ? Response::findHeaderValue($http_response_header, 'content-length') : null;
- if ($contentLength && Platform::strlen($result) < $contentLength) {
- $e = new TransportException('Content-Length mismatch, received '.Platform::strlen($result).' bytes out of the expected '.$contentLength);
- $e->setHeaders($http_response_header);
- $e->setStatusCode(self::findStatusCode($http_response_header));
- try {
- $e->setResponse($this->decodeResult($result, $http_response_header));
- } catch (\Exception $discarded) {
- $e->setResponse($this->normalizeResult($result));
- }
- $this->io->writeError('Content-Length mismatch, received '.Platform::strlen($result).' out of '.$contentLength.' bytes: (' . base64_encode($result).')', true, IOInterface::DEBUG);
- throw $e;
- }
- } catch (\Exception $e) {
- if ($e instanceof TransportException && !empty($http_response_header[0])) {
- $e->setHeaders($http_response_header);
- $e->setStatusCode(self::findStatusCode($http_response_header));
- }
- if ($e instanceof TransportException && $result !== false) {
- $e->setResponse($this->decodeResult($result, $http_response_header));
- }
- $result = false;
- }
- if ($errorMessage && !filter_var(ini_get('allow_url_fopen'), FILTER_VALIDATE_BOOLEAN)) {
- $errorMessage = 'allow_url_fopen must be enabled in php.ini ('.$errorMessage.')';
- }
- restore_error_handler();
- if (isset($e) && !$this->retry) {
- if (!$this->degradedMode && false !== strpos($e->getMessage(), 'Operation timed out')) {
- $this->degradedMode = true;
- $this->io->writeError('');
- $this->io->writeError([
- '<error>'.$e->getMessage().'</error>',
- '<error>Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info</error>',
- ]);
- return $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
- }
- throw $e;
- }
- $statusCode = null;
- $contentType = null;
- $locationHeader = null;
- if (!empty($http_response_header[0])) {
- $statusCode = self::findStatusCode($http_response_header);
- $contentType = Response::findHeaderValue($http_response_header, 'content-type');
- $locationHeader = Response::findHeaderValue($http_response_header, 'location');
- }
- if ($originUrl === 'bitbucket.org'
- && !$this->authHelper->isPublicBitBucketDownload($fileUrl)
- && substr($fileUrl, -4) === '.zip'
- && (!$locationHeader || substr(parse_url($locationHeader, PHP_URL_PATH), -4) !== '.zip')
- && $contentType && Preg::isMatch('{^text/html\b}i', $contentType)
- ) {
- $result = false;
- if ($retryAuthFailure) {
- $this->promptAuthAndRetry(401);
- }
- }
- if ($statusCode === 404
- && in_array($originUrl, $this->config->get('gitlab-domains'), true)
- && false !== strpos($fileUrl, 'archive.zip')
- ) {
- $result = false;
- if ($retryAuthFailure) {
- $this->promptAuthAndRetry(401);
- }
- }
- $hasFollowedRedirect = false;
- if ($statusCode >= 300 && $statusCode <= 399 && $statusCode !== 304 && $this->redirects < $this->maxRedirects) {
- $hasFollowedRedirect = true;
- $result = $this->handleRedirect($http_response_header, $additionalOptions, $result);
- }
- if ($statusCode && $statusCode >= 400 && $statusCode <= 599) {
- if (!$this->retry) {
- if ($this->progress && !$isRedirect) {
- $this->io->overwriteError("Downloading (<error>failed</error>)", false);
- }
- $e = new TransportException('The "'.$this->fileUrl.'" file could not be downloaded ('.$http_response_header[0].')', $statusCode);
- $e->setHeaders($http_response_header);
- $e->setResponse($this->decodeResult($result, $http_response_header));
- $e->setStatusCode($statusCode);
- throw $e;
- }
- $result = false;
- }
- if ($this->progress && !$this->retry && !$isRedirect) {
- $this->io->overwriteError("Downloading (".($result === false ? '<error>failed</error>' : '<comment>100%</comment>').")", false);
- }
- if ($result && extension_loaded('zlib') && strpos($fileUrl, 'http') === 0 && !$hasFollowedRedirect) {
- try {
- $result = $this->decodeResult($result, $http_response_header);
- } catch (\Exception $e) {
- if ($this->degradedMode) {
- throw $e;
- }
- $this->degradedMode = true;
- $this->io->writeError([
- '',
- '<error>Failed to decode response: '.$e->getMessage().'</error>',
- '<error>Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info</error>',
- ]);
- return $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
- }
- }
- if (false !== $result && null !== $fileName && !$isRedirect) {
- if ('' === $result) {
- throw new TransportException('"'.$this->fileUrl.'" appears broken, and returned an empty 200 response');
- }
- $errorMessage = '';
- set_error_handler(static function ($code, $msg) use (&$errorMessage): bool {
- if ($errorMessage) {
- $errorMessage .= "\n";
- }
- $errorMessage .= Preg::replace('{^file_put_contents\(.*?\): }', '', $msg);
- return true;
- });
- $result = (bool) file_put_contents($fileName, $result);
- restore_error_handler();
- if (false === $result) {
- throw new TransportException('The "'.$this->fileUrl.'" file could not be written to '.$fileName.': '.$errorMessage);
- }
- }
- if ($this->retry) {
- $this->retry = false;
- $result = $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
- if ($this->storeAuth) {
- $this->authHelper->storeAuth($this->originUrl, $this->storeAuth);
- $this->storeAuth = false;
- }
- return $result;
- }
- if (false === $result) {
- $e = new TransportException('The "'.$this->fileUrl.'" file could not be downloaded: '.$errorMessage, $errorCode);
- if (!empty($http_response_header[0])) {
- $e->setHeaders($http_response_header);
- }
- if (!$this->degradedMode && false !== strpos($e->getMessage(), 'Operation timed out')) {
- $this->degradedMode = true;
- $this->io->writeError('');
- $this->io->writeError([
- '<error>'.$e->getMessage().'</error>',
- '<error>Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info</error>',
- ]);
- return $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
- }
- throw $e;
- }
- if (!empty($http_response_header[0])) {
- $this->lastHeaders = $http_response_header;
- }
- return $result;
- }
- protected function getRemoteContents(string $originUrl, string $fileUrl, $context, ?array &$responseHeaders = null, ?int $maxFileSize = null)
- {
- $result = false;
- try {
- $e = null;
- if ($maxFileSize !== null) {
- $result = file_get_contents($fileUrl, false, $context, 0, $maxFileSize);
- } else {
- $result = file_get_contents($fileUrl, false, $context);
- }
- } catch (\Throwable $e) {
- }
- if ($result !== false && $maxFileSize !== null && Platform::strlen($result) >= $maxFileSize) {
- throw new MaxFileSizeExceededException('Maximum allowed download size reached. Downloaded ' . Platform::strlen($result) . ' of allowed ' . $maxFileSize . ' bytes');
- }
- $responseHeaders = $http_response_header ?? [];
- if (null !== $e) {
- throw $e;
- }
- return $result;
- }
- protected function callbackGet(int $notificationCode, int $severity, ?string $message, int $messageCode, int $bytesTransferred, int $bytesMax)
- {
- switch ($notificationCode) {
- case STREAM_NOTIFY_FAILURE:
- if (400 === $messageCode) {
- throw new TransportException("The '" . $this->fileUrl . "' URL could not be accessed: " . $message, $messageCode);
- }
- break;
- case STREAM_NOTIFY_FILE_SIZE_IS:
- $this->bytesMax = $bytesMax;
- break;
- case STREAM_NOTIFY_PROGRESS:
- if ($this->bytesMax > 0 && $this->progress) {
- $progression = min(100, (int) round($bytesTransferred / $this->bytesMax * 100));
- if ((0 === $progression % 5) && 100 !== $progression && $progression !== $this->lastProgress) {
- $this->lastProgress = $progression;
- $this->io->overwriteError("Downloading (<comment>$progression%</comment>)", false);
- }
- }
- break;
- default:
- break;
- }
- }
- protected function promptAuthAndRetry($httpStatus, ?string $reason = null, array $headers = [])
- {
- $result = $this->authHelper->promptAuthIfNeeded($this->fileUrl, $this->originUrl, $httpStatus, $reason, $headers, 1 );
- $this->storeAuth = $result['storeAuth'];
- $this->retry = $result['retry'];
- if ($this->retry) {
- throw new TransportException('RETRY');
- }
- }
- protected function getOptionsForUrl(string $originUrl, array $additionalOptions)
- {
- $tlsOptions = [];
- $headers = [];
- if (extension_loaded('zlib')) {
- $headers[] = 'Accept-Encoding: gzip';
- }
- $options = array_replace_recursive($this->options, $tlsOptions, $additionalOptions);
- if (!$this->degradedMode) {
- $options['http']['protocol_version'] = 1.1;
- $headers[] = 'Connection: close';
- }
- $headers = $this->authHelper->addAuthenticationHeader($headers, $originUrl, $this->fileUrl);
- $options['http']['follow_location'] = 0;
- if (isset($options['http']['header']) && !is_array($options['http']['header'])) {
- $options['http']['header'] = explode("\r\n", trim($options['http']['header'], "\r\n"));
- }
- foreach ($headers as $header) {
- $options['http']['header'][] = $header;
- }
- return $options;
- }
- private function handleRedirect(array $http_response_header, array $additionalOptions, $result)
- {
- if ($locationHeader = Response::findHeaderValue($http_response_header, 'location')) {
- if (parse_url($locationHeader, PHP_URL_SCHEME)) {
- $targetUrl = $locationHeader;
- } elseif (parse_url($locationHeader, PHP_URL_HOST)) {
- $targetUrl = $this->scheme.':'.$locationHeader;
- } elseif ('/' === $locationHeader[0]) {
- $urlHost = parse_url($this->fileUrl, PHP_URL_HOST);
- $targetUrl = Preg::replace('{^(.+(?://|@)'.preg_quote($urlHost).'(?::\d+)?)(?:[/\?].*)?$}', '\1'.$locationHeader, $this->fileUrl);
- } else {
- $targetUrl = Preg::replace('{^(.+/)[^/?]*(?:\?.*)?$}', '\1'.$locationHeader, $this->fileUrl);
- }
- }
- if (!empty($targetUrl)) {
- $this->redirects++;
- $this->io->writeError('', true, IOInterface::DEBUG);
- $this->io->writeError(sprintf('Following redirect (%u) %s', $this->redirects, Url::sanitize($targetUrl)), true, IOInterface::DEBUG);
- $additionalOptions['redirects'] = $this->redirects;
- return $this->get(parse_url($targetUrl, PHP_URL_HOST), $targetUrl, $additionalOptions, $this->fileName, $this->progress);
- }
- if (!$this->retry) {
- $e = new TransportException('The "'.$this->fileUrl.'" file could not be downloaded, got redirect without Location ('.$http_response_header[0].')');
- $e->setHeaders($http_response_header);
- $e->setResponse($this->decodeResult($result, $http_response_header));
- throw $e;
- }
- return false;
- }
- private function decodeResult($result, array $http_response_header): ?string
- {
- if ($result && extension_loaded('zlib')) {
- $contentEncoding = Response::findHeaderValue($http_response_header, 'content-encoding');
- $decode = $contentEncoding && 'gzip' === strtolower($contentEncoding);
- if ($decode) {
- $result = zlib_decode($result);
- if ($result === false) {
- throw new TransportException('Failed to decode zlib stream');
- }
- }
- }
- return $this->normalizeResult($result);
- }
- private function normalizeResult($result): ?string
- {
- if ($result === false) {
- return null;
- }
- return $result;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Util;
- class Silencer
- {
- private static $stack = [];
- public static function suppress(?int $mask = null): int
- {
- if (!isset($mask)) {
- $mask = E_WARNING | E_NOTICE | E_USER_WARNING | E_USER_NOTICE | E_DEPRECATED | E_USER_DEPRECATED | E_STRICT;
- }
- $old = error_reporting();
- self::$stack[] = $old;
- error_reporting($old & ~$mask);
- return $old;
- }
- public static function restore(): void
- {
- if (!empty(self::$stack)) {
- error_reporting(array_pop(self::$stack));
- }
- }
- public static function call(callable $callable, ...$parameters)
- {
- try {
- self::suppress();
- $result = $callable(...$parameters);
- self::restore();
- return $result;
- } catch (\Exception $e) {
- self::restore();
- throw $e;
- }
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Util;
- use Composer\Composer;
- use Composer\CaBundle\CaBundle;
- use Composer\Downloader\TransportException;
- use Composer\Repository\PlatformRepository;
- use Composer\Util\Http\ProxyManager;
- use Psr\Log\LoggerInterface;
- final class StreamContextFactory
- {
- public static function getContext(string $url, array $defaultOptions = [], array $defaultParams = [])
- {
- $options = ['http' => [
- 'follow_location' => 1,
- 'max_redirects' => 20,
- ]];
- $options = array_replace_recursive($options, self::initOptions($url, $defaultOptions));
- unset($defaultOptions['http']['header']);
- $options = array_replace_recursive($options, $defaultOptions);
- if (isset($options['http']['header'])) {
- $options['http']['header'] = self::fixHttpHeaderField($options['http']['header']);
- }
- return stream_context_create($options, $defaultParams);
- }
- public static function initOptions(string $url, array $options, bool $forCurl = false): array
- {
- if (!isset($options['http']['header'])) {
- $options['http']['header'] = [];
- }
- if (is_string($options['http']['header'])) {
- $options['http']['header'] = explode("\r\n", $options['http']['header']);
- }
- if (!$forCurl) {
- $proxy = ProxyManager::getInstance()->getProxyForRequest($url);
- if ($proxyOptions = $proxy->getContextOptions()) {
- $isHttpsRequest = 0 === strpos($url, 'https://');
- if ($proxy->isSecure()) {
- if (!extension_loaded('openssl')) {
- throw new TransportException('You must enable the openssl extension to use a secure proxy.');
- }
- if ($isHttpsRequest) {
- throw new TransportException('You must enable the curl extension to make https requests through a secure proxy.');
- }
- } elseif ($isHttpsRequest && !extension_loaded('openssl')) {
- throw new TransportException('You must enable the openssl extension to make https requests through a proxy.');
- }
- if (isset($proxyOptions['http']['header'])) {
- $options['http']['header'][] = $proxyOptions['http']['header'];
- unset($proxyOptions['http']['header']);
- }
- $options = array_replace_recursive($options, $proxyOptions);
- }
- }
- if (defined('HHVM_VERSION')) {
- $phpVersion = 'HHVM ' . HHVM_VERSION;
- } else {
- $phpVersion = 'PHP ' . PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION . '.' . PHP_RELEASE_VERSION;
- }
- if ($forCurl) {
- $curl = curl_version();
- $httpVersion = 'cURL '.$curl['version'];
- } else {
- $httpVersion = 'streams';
- }
- if (!isset($options['http']['header']) || false === stripos(implode('', $options['http']['header']), 'user-agent')) {
- $platformPhpVersion = PlatformRepository::getPlatformPhpVersion();
- $options['http']['header'][] = sprintf(
- 'User-Agent: Composer/%s (%s; %s; %s; %s%s%s)',
- Composer::getVersion(),
- function_exists('php_uname') ? php_uname('s') : 'Unknown',
- function_exists('php_uname') ? php_uname('r') : 'Unknown',
- $phpVersion,
- $httpVersion,
- $platformPhpVersion ? '; Platform-PHP '.$platformPhpVersion : '',
- Platform::getEnv('CI') ? '; CI' : ''
- );
- }
- return $options;
- }
- public static function getTlsDefaults(array $options, ?LoggerInterface $logger = null): array
- {
- $ciphers = implode(':', [
- 'ECDHE-RSA-AES128-GCM-SHA256',
- 'ECDHE-ECDSA-AES128-GCM-SHA256',
- 'ECDHE-RSA-AES256-GCM-SHA384',
- 'ECDHE-ECDSA-AES256-GCM-SHA384',
- 'DHE-RSA-AES128-GCM-SHA256',
- 'DHE-DSS-AES128-GCM-SHA256',
- 'kEDH+AESGCM',
- 'ECDHE-RSA-AES128-SHA256',
- 'ECDHE-ECDSA-AES128-SHA256',
- 'ECDHE-RSA-AES128-SHA',
- 'ECDHE-ECDSA-AES128-SHA',
- 'ECDHE-RSA-AES256-SHA384',
- 'ECDHE-ECDSA-AES256-SHA384',
- 'ECDHE-RSA-AES256-SHA',
- 'ECDHE-ECDSA-AES256-SHA',
- 'DHE-RSA-AES128-SHA256',
- 'DHE-RSA-AES128-SHA',
- 'DHE-DSS-AES128-SHA256',
- 'DHE-RSA-AES256-SHA256',
- 'DHE-DSS-AES256-SHA',
- 'DHE-RSA-AES256-SHA',
- 'AES128-GCM-SHA256',
- 'AES256-GCM-SHA384',
- 'AES128-SHA256',
- 'AES256-SHA256',
- 'AES128-SHA',
- 'AES256-SHA',
- 'AES',
- 'CAMELLIA',
- 'DES-CBC3-SHA',
- '!aNULL',
- '!eNULL',
- '!EXPORT',
- '!DES',
- '!RC4',
- '!MD5',
- '!PSK',
- '!aECDH',
- '!EDH-DSS-DES-CBC3-SHA',
- '!EDH-RSA-DES-CBC3-SHA',
- '!KRB5-DES-CBC3-SHA',
- ]);
- $defaults = [
- 'ssl' => [
- 'ciphers' => $ciphers,
- 'verify_peer' => true,
- 'verify_depth' => 7,
- 'SNI_enabled' => true,
- 'capture_peer_cert' => true,
- ],
- ];
- if (isset($options['ssl'])) {
- $defaults['ssl'] = array_replace_recursive($defaults['ssl'], $options['ssl']);
- }
- if (!isset($defaults['ssl']['cafile']) && !isset($defaults['ssl']['capath'])) {
- $result = CaBundle::getSystemCaRootBundlePath($logger);
- if (is_dir($result)) {
- $defaults['ssl']['capath'] = $result;
- } else {
- $defaults['ssl']['cafile'] = $result;
- }
- }
- if (isset($defaults['ssl']['cafile']) && (!Filesystem::isReadable($defaults['ssl']['cafile']) || !CaBundle::validateCaFile($defaults['ssl']['cafile'], $logger))) {
- throw new TransportException('The configured cafile was not valid or could not be read.');
- }
- if (isset($defaults['ssl']['capath']) && (!is_dir($defaults['ssl']['capath']) || !Filesystem::isReadable($defaults['ssl']['capath']))) {
- throw new TransportException('The configured capath was not valid or could not be read.');
- }
- $defaults['ssl']['disable_compression'] = true;
- return $defaults;
- }
- private static function fixHttpHeaderField($header): array
- {
- if (!is_array($header)) {
- $header = explode("\r\n", $header);
- }
- uasort($header, static function ($el): int {
- return stripos($el, 'content-type') === 0 ? 1 : -1;
- });
- return $header;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Util;
- use Composer\Config;
- use Composer\IO\IOInterface;
- use Composer\Pcre\Preg;
- class Svn
- {
- private const MAX_QTY_AUTH_TRIES = 5;
- protected $credentials;
- protected $hasAuth;
- protected $io;
- protected $url;
- protected $cacheCredentials = true;
- protected $process;
- protected $qtyAuthTries = 0;
- protected $config;
- private static $version;
- public function __construct(string $url, IOInterface $io, Config $config, ?ProcessExecutor $process = null)
- {
- $this->url = $url;
- $this->io = $io;
- $this->config = $config;
- $this->process = $process ?: new ProcessExecutor($io);
- }
- public static function cleanEnv(): void
- {
- Platform::clearEnv('DYLD_LIBRARY_PATH');
- }
- public function execute(string $command, string $url, ?string $cwd = null, ?string $path = null, bool $verbose = false): string
- {
- $this->config->prohibitUrlByConfig($url, $this->io);
- return $this->executeWithAuthRetry($command, $cwd, $url, $path, $verbose);
- }
- public function executeLocal(string $command, string $path, ?string $cwd = null, bool $verbose = false): string
- {
- return $this->executeWithAuthRetry($command, $cwd, '', $path, $verbose);
- }
- private function executeWithAuthRetry(string $svnCommand, ?string $cwd, string $url, ?string $path, bool $verbose): ?string
- {
- $command = $this->getCommand($svnCommand, $url, $path);
- $output = null;
- $io = $this->io;
- $handler = static function ($type, $buffer) use (&$output, $io, $verbose) {
- if ($type !== 'out') {
- return null;
- }
- if (strpos($buffer, 'Redirecting to URL ') === 0) {
- return null;
- }
- $output .= $buffer;
- if ($verbose) {
- $io->writeError($buffer, false);
- }
- };
- $status = $this->process->execute($command, $handler, $cwd);
- if (0 === $status) {
- return $output;
- }
- $errorOutput = $this->process->getErrorOutput();
- $fullOutput = trim(implode("\n", [$output, $errorOutput]));
- if (false === stripos($fullOutput, 'Could not authenticate to server:')
- && false === stripos($fullOutput, 'authorization failed')
- && false === stripos($fullOutput, 'svn: E170001:')
- && false === stripos($fullOutput, 'svn: E215004:')) {
- throw new \RuntimeException($fullOutput);
- }
- if (!$this->hasAuth()) {
- $this->doAuthDance();
- }
- if ($this->qtyAuthTries++ < self::MAX_QTY_AUTH_TRIES) {
- return $this->executeWithAuthRetry($svnCommand, $cwd, $url, $path, $verbose);
- }
- throw new \RuntimeException(
- 'wrong credentials provided ('.$fullOutput.')'
- );
- }
- public function setCacheCredentials(bool $cacheCredentials): void
- {
- $this->cacheCredentials = $cacheCredentials;
- }
- protected function doAuthDance(): Svn
- {
- if (!$this->io->isInteractive()) {
- throw new \RuntimeException(
- 'can not ask for authentication in non interactive mode'
- );
- }
- $this->io->writeError("The Subversion server ({$this->url}) requested credentials:");
- $this->hasAuth = true;
- $this->credentials = [
- 'username' => (string) $this->io->ask("Username: ", ''),
- 'password' => (string) $this->io->askAndHideAnswer("Password: "),
- ];
- $this->cacheCredentials = $this->io->askConfirmation("Should Subversion cache these credentials? (yes/no) ");
- return $this;
- }
- protected function getCommand(string $cmd, string $url, ?string $path = null): string
- {
- $cmd = sprintf(
- '%s %s%s -- %s',
- $cmd,
- '--non-interactive ',
- $this->getCredentialString(),
- ProcessExecutor::escape($url)
- );
- if ($path) {
- $cmd .= ' ' . ProcessExecutor::escape($path);
- }
- return $cmd;
- }
- protected function getCredentialString(): string
- {
- if (!$this->hasAuth()) {
- return '';
- }
- return sprintf(
- ' %s--username %s --password %s ',
- $this->getAuthCache(),
- ProcessExecutor::escape($this->getUsername()),
- ProcessExecutor::escape($this->getPassword())
- );
- }
- protected function getPassword(): string
- {
- if ($this->credentials === null) {
- throw new \LogicException("No svn auth detected.");
- }
- return $this->credentials['password'];
- }
- protected function getUsername(): string
- {
- if ($this->credentials === null) {
- throw new \LogicException("No svn auth detected.");
- }
- return $this->credentials['username'];
- }
- protected function hasAuth(): bool
- {
- if (null !== $this->hasAuth) {
- return $this->hasAuth;
- }
- if (false === $this->createAuthFromConfig()) {
- $this->createAuthFromUrl();
- }
- return (bool) $this->hasAuth;
- }
- protected function getAuthCache(): string
- {
- return $this->cacheCredentials ? '' : '--no-auth-cache ';
- }
- private function createAuthFromConfig(): bool
- {
- if (!$this->config->has('http-basic')) {
- return $this->hasAuth = false;
- }
- $authConfig = $this->config->get('http-basic');
- $host = parse_url($this->url, PHP_URL_HOST);
- if (isset($authConfig[$host])) {
- $this->credentials = [
- 'username' => $authConfig[$host]['username'],
- 'password' => $authConfig[$host]['password'],
- ];
- return $this->hasAuth = true;
- }
- return $this->hasAuth = false;
- }
- private function createAuthFromUrl(): bool
- {
- $uri = parse_url($this->url);
- if (empty($uri['user'])) {
- return $this->hasAuth = false;
- }
- $this->credentials = [
- 'username' => $uri['user'],
- 'password' => !empty($uri['pass']) ? $uri['pass'] : '',
- ];
- return $this->hasAuth = true;
- }
- public function binaryVersion(): ?string
- {
- if (!self::$version) {
- if (0 === $this->process->execute('svn --version', $output)) {
- if (Preg::isMatch('{(\d+(?:\.\d+)+)}', $output, $match)) {
- self::$version = $match[1];
- }
- }
- }
- return self::$version;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Util;
- use Composer\Downloader\DownloaderInterface;
- use Composer\Package\PackageInterface;
- use React\Promise\PromiseInterface;
- class SyncHelper
- {
- public static function downloadAndInstallPackageSync(Loop $loop, DownloaderInterface $downloader, string $path, PackageInterface $package, ?PackageInterface $prevPackage = null): void
- {
- $type = $prevPackage ? 'update' : 'install';
- try {
- self::await($loop, $downloader->download($package, $path, $prevPackage));
- self::await($loop, $downloader->prepare($type, $package, $path, $prevPackage));
- if ($type === 'update') {
- self::await($loop, $downloader->update($package, $prevPackage, $path));
- } else {
- self::await($loop, $downloader->install($package, $path));
- }
- } catch (\Exception $e) {
- self::await($loop, $downloader->cleanup($type, $package, $path, $prevPackage));
- throw $e;
- }
- self::await($loop, $downloader->cleanup($type, $package, $path, $prevPackage));
- }
- public static function await(Loop $loop, ?PromiseInterface $promise = null): void
- {
- if ($promise) {
- $loop->wait([$promise]);
- }
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Util;
- class Tar
- {
- public static function getComposerJson(string $pathToArchive): ?string
- {
- $phar = new \PharData($pathToArchive);
- if (!$phar->valid()) {
- return null;
- }
- return self::extractComposerJsonFromFolder($phar);
- }
- private static function extractComposerJsonFromFolder(\PharData $phar): string
- {
- if (isset($phar['composer.json'])) {
- return $phar['composer.json']->getContent();
- }
- $topLevelPaths = [];
- foreach ($phar as $folderFile) {
- $name = $folderFile->getBasename();
- if ($folderFile->isDir()) {
- $topLevelPaths[$name] = true;
- if (\count($topLevelPaths) > 1) {
- 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)));
- }
- }
- }
- $composerJsonPath = key($topLevelPaths).'/composer.json';
- if ($topLevelPaths && isset($phar[$composerJsonPath])) {
- return $phar[$composerJsonPath]->getContent();
- }
- throw new \RuntimeException('No composer.json found either at the top level or within the topmost directory');
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Util;
- use Composer\CaBundle\CaBundle;
- use Composer\Pcre\Preg;
- final class TlsHelper
- {
- public static function checkCertificateHost($certificate, string $hostname, ?string &$cn = null): bool
- {
- $names = self::getCertificateNames($certificate);
- if (empty($names)) {
- return false;
- }
- $combinedNames = array_merge($names['san'], [$names['cn']]);
- $hostname = strtolower($hostname);
- foreach ($combinedNames as $certName) {
- $matcher = self::certNameMatcher($certName);
- if ($matcher && $matcher($hostname)) {
- $cn = $names['cn'];
- return true;
- }
- }
- return false;
- }
- public static function getCertificateNames($certificate): ?array
- {
- if (is_array($certificate)) {
- $info = $certificate;
- } elseif (CaBundle::isOpensslParseSafe()) {
- $info = openssl_x509_parse($certificate, false);
- }
- if (!isset($info['subject']['commonName'])) {
- return null;
- }
- $commonName = strtolower($info['subject']['commonName']);
- $subjectAltNames = [];
- if (isset($info['extensions']['subjectAltName'])) {
- $subjectAltNames = Preg::split('{\s*,\s*}', $info['extensions']['subjectAltName']);
- $subjectAltNames = array_filter(array_map(static function ($name): ?string {
- if (0 === strpos($name, 'DNS:')) {
- return strtolower(ltrim(substr($name, 4)));
- }
- return null;
- }, $subjectAltNames));
- $subjectAltNames = array_values($subjectAltNames);
- }
- return [
- 'cn' => $commonName,
- 'san' => $subjectAltNames,
- ];
- }
- public static function getCertificateFingerprint(string $certificate): string
- {
- $pubkey = openssl_get_publickey($certificate);
- if ($pubkey === false) {
- throw new \RuntimeException('Failed to retrieve the public key from certificate');
- }
- $pubkeydetails = openssl_pkey_get_details($pubkey);
- $pubkeypem = $pubkeydetails['key'];
- $start = '-----BEGIN PUBLIC KEY-----';
- $end = '-----END PUBLIC KEY-----';
- $pemtrim = substr($pubkeypem, strpos($pubkeypem, $start) + strlen($start), (strlen($pubkeypem) - strpos($pubkeypem, $end)) * (-1));
- $der = base64_decode($pemtrim);
- return sha1($der);
- }
- public static function isOpensslParseSafe(): bool
- {
- return CaBundle::isOpensslParseSafe();
- }
- private static function certNameMatcher(string $certName): ?callable
- {
- $wildcards = substr_count($certName, '*');
- if (0 === $wildcards) {
- return static function ($hostname) use ($certName): bool {
- return $hostname === $certName;
- };
- }
- if (1 === $wildcards) {
- $components = explode('.', $certName);
- if (3 > count($components)) {
- return null;
- }
- $firstComponent = $components[0];
- if ('*' !== $firstComponent[strlen($firstComponent) - 1]) {
- return null;
- }
- $wildcardRegex = preg_quote($certName);
- $wildcardRegex = str_replace('\\*', '[a-z0-9-]+', $wildcardRegex);
- $wildcardRegex = "{^{$wildcardRegex}$}";
- return static function ($hostname) use ($wildcardRegex): bool {
- return Preg::isMatch($wildcardRegex, $hostname);
- };
- }
- return null;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Util;
- use Composer\Config;
- use Composer\Pcre\Preg;
- class Url
- {
- public static function updateDistReference(Config $config, string $url, string $ref): string
- {
- $host = parse_url($url, PHP_URL_HOST);
- if ($host === 'api.github.com' || $host === 'github.com' || $host === 'www.github.com') {
- if (Preg::isMatch('{^https?://(?:www\.)?github\.com/([^/]+)/([^/]+)/(zip|tar)ball/(.+)$}i', $url, $match)) {
- $url = 'https://api.github.com/repos/' . $match[1] . '/'. $match[2] . '/' . $match[3] . 'ball/' . $ref;
- } elseif (Preg::isMatch('{^https?://(?:www\.)?github\.com/([^/]+)/([^/]+)/archive/.+\.(zip|tar)(?:\.gz)?$}i', $url, $match)) {
- $url = 'https://api.github.com/repos/' . $match[1] . '/'. $match[2] . '/' . $match[3] . 'ball/' . $ref;
- } elseif (Preg::isMatch('{^https?://api\.github\.com/repos/([^/]+)/([^/]+)/(zip|tar)ball(?:/.+)?$}i', $url, $match)) {
- $url = 'https://api.github.com/repos/' . $match[1] . '/'. $match[2] . '/' . $match[3] . 'ball/' . $ref;
- }
- } elseif ($host === 'bitbucket.org' || $host === 'www.bitbucket.org') {
- if (Preg::isMatch('{^https?://(?:www\.)?bitbucket\.org/([^/]+)/([^/]+)/get/(.+)\.(zip|tar\.gz|tar\.bz2)$}i', $url, $match)) {
- $url = 'https://bitbucket.org/' . $match[1] . '/'. $match[2] . '/get/' . $ref . '.' . $match[4];
- }
- } elseif ($host === 'gitlab.com' || $host === 'www.gitlab.com') {
- if (Preg::isMatch('{^https?://(?:www\.)?gitlab\.com/api/v[34]/projects/([^/]+)/repository/archive\.(zip|tar\.gz|tar\.bz2|tar)\?sha=.+$}i', $url, $match)) {
- $url = 'https://gitlab.com/api/v4/projects/' . $match[1] . '/repository/archive.' . $match[2] . '?sha=' . $ref;
- }
- } elseif (in_array($host, $config->get('github-domains'), true)) {
- $url = Preg::replace('{(/repos/[^/]+/[^/]+/(zip|tar)ball)(?:/.+)?$}i', '$1/'.$ref, $url);
- } elseif (in_array($host, $config->get('gitlab-domains'), true)) {
- $url = Preg::replace('{(/api/v[34]/projects/[^/]+/repository/archive\.(?:zip|tar\.gz|tar\.bz2|tar)\?sha=).+$}i', '${1}'.$ref, $url);
- }
- return $url;
- }
- public static function getOrigin(Config $config, string $url): string
- {
- if (0 === strpos($url, 'file://')) {
- return $url;
- }
- $origin = (string) parse_url($url, PHP_URL_HOST);
- if ($port = parse_url($url, PHP_URL_PORT)) {
- $origin .= ':'.$port;
- }
- if (strpos($origin, '.github.com') === (strlen($origin) - 11)) {
- return 'github.com';
- }
- if ($origin === 'repo.packagist.org') {
- return 'packagist.org';
- }
- if ($origin === '') {
- $origin = $url;
- }
- if (
- false === strpos($origin, '/')
- && !in_array($origin, $config->get('gitlab-domains'), true)
- ) {
- foreach ($config->get('gitlab-domains') as $gitlabDomain) {
- if (0 === strpos($gitlabDomain, $origin)) {
- return $gitlabDomain;
- }
- }
- }
- return $origin;
- }
- public static function sanitize(string $url): string
- {
- $url = Preg::replace('{([&?]access_token=)[^&]+}', '$1***', $url);
- $url = Preg::replaceCallback('{^(?P<prefix>[a-z0-9]+://)?(?P<user>[^:/\s@]+):(?P<password>[^@\s/]+)@}i', static function ($m): string {
- if (Preg::isMatch('{^([a-f0-9]{12,}|gh[a-z]_[a-zA-Z0-9_]+)$}', $m['user'])) {
- return $m['prefix'].'***:***@';
- }
- return $m['prefix'].$m['user'].':***@';
- }, $url);
- return $url;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\Util;
- class Zip
- {
- public static function getComposerJson(string $pathToZip): ?string
- {
- if (!extension_loaded('zip')) {
- throw new \RuntimeException('The Zip Util requires PHP\'s zip extension');
- }
- $zip = new \ZipArchive();
- if ($zip->open($pathToZip) !== true) {
- return null;
- }
- if (0 === $zip->numFiles) {
- $zip->close();
- return null;
- }
- $foundFileIndex = self::locateFile($zip, 'composer.json');
- $content = null;
- $configurationFileName = $zip->getNameIndex($foundFileIndex);
- $stream = $zip->getStream($configurationFileName);
- if (false !== $stream) {
- $content = stream_get_contents($stream);
- }
- $zip->close();
- return $content;
- }
- private static function locateFile(\ZipArchive $zip, string $filename): int
- {
- if (false !== ($index = $zip->locateName($filename)) && $zip->getFromIndex($index) !== false) {
- return $index;
- }
- $topLevelPaths = [];
- for ($i = 0; $i < $zip->numFiles; $i++) {
- $name = $zip->getNameIndex($i);
- $dirname = dirname($name);
- if (strpos($name, '__MACOSX') !== false) {
- continue;
- }
- if ($dirname === '.') {
- $topLevelPaths[$name] = true;
- if (\count($topLevelPaths) > 1) {
- 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)));
- }
- continue;
- }
- if (false === strpos($dirname, '\\') && false === strpos($dirname, '/')) {
- $topLevelPaths[$dirname.'/'] = true;
- if (\count($topLevelPaths) > 1) {
- 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)));
- }
- }
- }
- if ($topLevelPaths && false !== ($index = $zip->locateName(key($topLevelPaths).$filename)) && $zip->getFromIndex($index) !== false) {
- return $index;
- }
- throw new \RuntimeException('No composer.json found either at the top level or within the topmost directory');
- }
- }
- <?php declare(strict_types=1);
- use Composer\Autoload\ClassLoader;
- function includeIfExists(string $file): ?ClassLoader
- {
- return file_exists($file) ? include $file : null;
- }
- if ((!$loader = includeIfExists(__DIR__.'/../vendor/autoload.php')) && (!$loader = includeIfExists(__DIR__.'/../../../autoload.php'))) {
- echo 'You must set up the project dependencies using `composer install`'.PHP_EOL.
- 'See https://getcomposer.org/download/ for instructions on installing Composer'.PHP_EOL;
- exit(1);
- }
- return $loader;
- <?php
- /*
- * This file is part of Composer.
- *
- * (c) Nils Adermann <naderman@naderman.de>
- * Jordi Boggiano <j.boggiano@seld.be>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
- namespace Composer\Autoload;
- /**
- * ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
- *
- * $loader = new \Composer\Autoload\ClassLoader();
- *
- * // register classes with namespaces
- * $loader->add('Symfony\Component', __DIR__.'/component');
- * $loader->add('Symfony', __DIR__.'/framework');
- *
- * // activate the autoloader
- * $loader->register();
- *
- * // to enable searching the include path (eg. for PEAR packages)
- * $loader->setUseIncludePath(true);
- *
- * In this example, if you try to use a class in the Symfony\Component
- * namespace or one of its children (Symfony\Component\Console for instance),
- * the autoloader will first look for the class under the component/
- * directory, and it will then fallback to the framework/ directory if not
- * found before giving up.
- *
- * This class is loosely based on the Symfony UniversalClassLoader.
- *
- * @author Fabien Potencier <fabien@symfony.com>
- * @author Jordi Boggiano <j.boggiano@seld.be>
- * @see https://www.php-fig.org/psr/psr-0/
- * @see https://www.php-fig.org/psr/psr-4/
- */
- class ClassLoader
- {
- /** @var ?string */
- private $vendorDir;
- // PSR-4
- /**
- * @var array[]
- * @psalm-var array<string, array<string, int>>
- */
- private $prefixLengthsPsr4 = array();
- /**
- * @var array[]
- * @psalm-var array<string, array<int, string>>
- */
- private $prefixDirsPsr4 = array();
- /**
- * @var array[]
- * @psalm-var array<string, string>
- */
- private $fallbackDirsPsr4 = array();
- // PSR-0
- /**
- * @var array[]
- * @psalm-var array<string, array<string, string[]>>
- */
- private $prefixesPsr0 = array();
- /**
- * @var array[]
- * @psalm-var array<string, string>
- */
- private $fallbackDirsPsr0 = array();
- /** @var bool */
- private $useIncludePath = false;
- /**
- * @var string[]
- * @psalm-var array<string, string>
- */
- private $classMap = array();
- /** @var bool */
- private $classMapAuthoritative = false;
- /**
- * @var bool[]
- * @psalm-var array<string, bool>
- */
- private $missingClasses = array();
- /** @var ?string */
- private $apcuPrefix;
- /**
- * @var self[]
- */
- private static $registeredLoaders = array();
- /**
- * @param ?string $vendorDir
- */
- public function __construct($vendorDir = null)
- {
- $this->vendorDir = $vendorDir;
- }
- /**
- * @return string[]
- */
- public function getPrefixes()
- {
- if (!empty($this->prefixesPsr0)) {
- return call_user_func_array('array_merge', array_values($this->prefixesPsr0));
- }
- return array();
- }
- /**
- * @return array[]
- * @psalm-return array<string, array<int, string>>
- */
- public function getPrefixesPsr4()
- {
- return $this->prefixDirsPsr4;
- }
- /**
- * @return array[]
- * @psalm-return array<string, string>
- */
- public function getFallbackDirs()
- {
- return $this->fallbackDirsPsr0;
- }
- /**
- * @return array[]
- * @psalm-return array<string, string>
- */
- public function getFallbackDirsPsr4()
- {
- return $this->fallbackDirsPsr4;
- }
- /**
- * @return string[] Array of classname => path
- * @psalm-return array<string, string>
- */
- public function getClassMap()
- {
- return $this->classMap;
- }
- /**
- * @param string[] $classMap Class to filename map
- * @psalm-param array<string, string> $classMap
- *
- * @return void
- */
- public function addClassMap(array $classMap)
- {
- if ($this->classMap) {
- $this->classMap = array_merge($this->classMap, $classMap);
- } else {
- $this->classMap = $classMap;
- }
- }
- /**
- * Registers a set of PSR-0 directories for a given prefix, either
- * appending or prepending to the ones previously set for this prefix.
- *
- * @param string $prefix The prefix
- * @param string[]|string $paths The PSR-0 root directories
- * @param bool $prepend Whether to prepend the directories
- *
- * @return void
- */
- public function add($prefix, $paths, $prepend = false)
- {
- if (!$prefix) {
- if ($prepend) {
- $this->fallbackDirsPsr0 = array_merge(
- (array) $paths,
- $this->fallbackDirsPsr0
- );
- } else {
- $this->fallbackDirsPsr0 = array_merge(
- $this->fallbackDirsPsr0,
- (array) $paths
- );
- }
- return;
- }
- $first = $prefix[0];
- if (!isset($this->prefixesPsr0[$first][$prefix])) {
- $this->prefixesPsr0[$first][$prefix] = (array) $paths;
- return;
- }
- if ($prepend) {
- $this->prefixesPsr0[$first][$prefix] = array_merge(
- (array) $paths,
- $this->prefixesPsr0[$first][$prefix]
- );
- } else {
- $this->prefixesPsr0[$first][$prefix] = array_merge(
- $this->prefixesPsr0[$first][$prefix],
- (array) $paths
- );
- }
- }
- /**
- * Registers a set of PSR-4 directories for a given namespace, either
- * appending or prepending to the ones previously set for this namespace.
- *
- * @param string $prefix The prefix/namespace, with trailing '\\'
- * @param string[]|string $paths The PSR-4 base directories
- * @param bool $prepend Whether to prepend the directories
- *
- * @throws \InvalidArgumentException
- *
- * @return void
- */
- public function addPsr4($prefix, $paths, $prepend = false)
- {
- if (!$prefix) {
- // Register directories for the root namespace.
- if ($prepend) {
- $this->fallbackDirsPsr4 = array_merge(
- (array) $paths,
- $this->fallbackDirsPsr4
- );
- } else {
- $this->fallbackDirsPsr4 = array_merge(
- $this->fallbackDirsPsr4,
- (array) $paths
- );
- }
- } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
- // Register directories for a new namespace.
- $length = strlen($prefix);
- if ('\\' !== $prefix[$length - 1]) {
- throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
- }
- $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
- $this->prefixDirsPsr4[$prefix] = (array) $paths;
- } elseif ($prepend) {
- // Prepend directories for an already registered namespace.
- $this->prefixDirsPsr4[$prefix] = array_merge(
- (array) $paths,
- $this->prefixDirsPsr4[$prefix]
- );
- } else {
- // Append directories for an already registered namespace.
- $this->prefixDirsPsr4[$prefix] = array_merge(
- $this->prefixDirsPsr4[$prefix],
- (array) $paths
- );
- }
- }
- /**
- * Registers a set of PSR-0 directories for a given prefix,
- * replacing any others previously set for this prefix.
- *
- * @param string $prefix The prefix
- * @param string[]|string $paths The PSR-0 base directories
- *
- * @return void
- */
- public function set($prefix, $paths)
- {
- if (!$prefix) {
- $this->fallbackDirsPsr0 = (array) $paths;
- } else {
- $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
- }
- }
- /**
- * Registers a set of PSR-4 directories for a given namespace,
- * replacing any others previously set for this namespace.
- *
- * @param string $prefix The prefix/namespace, with trailing '\\'
- * @param string[]|string $paths The PSR-4 base directories
- *
- * @throws \InvalidArgumentException
- *
- * @return void
- */
- public function setPsr4($prefix, $paths)
- {
- if (!$prefix) {
- $this->fallbackDirsPsr4 = (array) $paths;
- } else {
- $length = strlen($prefix);
- if ('\\' !== $prefix[$length - 1]) {
- throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
- }
- $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
- $this->prefixDirsPsr4[$prefix] = (array) $paths;
- }
- }
- /**
- * Turns on searching the include path for class files.
- *
- * @param bool $useIncludePath
- *
- * @return void
- */
- public function setUseIncludePath($useIncludePath)
- {
- $this->useIncludePath = $useIncludePath;
- }
- /**
- * Can be used to check if the autoloader uses the include path to check
- * for classes.
- *
- * @return bool
- */
- public function getUseIncludePath()
- {
- return $this->useIncludePath;
- }
- /**
- * Turns off searching the prefix and fallback directories for classes
- * that have not been registered with the class map.
- *
- * @param bool $classMapAuthoritative
- *
- * @return void
- */
- public function setClassMapAuthoritative($classMapAuthoritative)
- {
- $this->classMapAuthoritative = $classMapAuthoritative;
- }
- /**
- * Should class lookup fail if not found in the current class map?
- *
- * @return bool
- */
- public function isClassMapAuthoritative()
- {
- return $this->classMapAuthoritative;
- }
- /**
- * APCu prefix to use to cache found/not-found classes, if the extension is enabled.
- *
- * @param string|null $apcuPrefix
- *
- * @return void
- */
- public function setApcuPrefix($apcuPrefix)
- {
- $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
- }
- /**
- * The APCu prefix in use, or null if APCu caching is not enabled.
- *
- * @return string|null
- */
- public function getApcuPrefix()
- {
- return $this->apcuPrefix;
- }
- /**
- * Registers this instance as an autoloader.
- *
- * @param bool $prepend Whether to prepend the autoloader or not
- *
- * @return void
- */
- public function register($prepend = false)
- {
- spl_autoload_register(array($this, 'loadClass'), true, $prepend);
- if (null === $this->vendorDir) {
- return;
- }
- if ($prepend) {
- self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders;
- } else {
- unset(self::$registeredLoaders[$this->vendorDir]);
- self::$registeredLoaders[$this->vendorDir] = $this;
- }
- }
- /**
- * Unregisters this instance as an autoloader.
- *
- * @return void
- */
- public function unregister()
- {
- spl_autoload_unregister(array($this, 'loadClass'));
- if (null !== $this->vendorDir) {
- unset(self::$registeredLoaders[$this->vendorDir]);
- }
- }
- /**
- * Loads the given class or interface.
- *
- * @param string $class The name of the class
- * @return true|null True if loaded, null otherwise
- */
- public function loadClass($class)
- {
- if ($file = $this->findFile($class)) {
- includeFile($file);
- return true;
- }
- return null;
- }
- /**
- * Finds the path to the file where the class is defined.
- *
- * @param string $class The name of the class
- *
- * @return string|false The path if found, false otherwise
- */
- public function findFile($class)
- {
- // class map lookup
- if (isset($this->classMap[$class])) {
- return $this->classMap[$class];
- }
- if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
- return false;
- }
- if (null !== $this->apcuPrefix) {
- $file = apcu_fetch($this->apcuPrefix.$class, $hit);
- if ($hit) {
- return $file;
- }
- }
- $file = $this->findFileWithExtension($class, '.php');
- // Search for Hack files if we are running on HHVM
- if (false === $file && defined('HHVM_VERSION')) {
- $file = $this->findFileWithExtension($class, '.hh');
- }
- if (null !== $this->apcuPrefix) {
- apcu_add($this->apcuPrefix.$class, $file);
- }
- if (false === $file) {
- // Remember that this class does not exist.
- $this->missingClasses[$class] = true;
- }
- return $file;
- }
- /**
- * Returns the currently registered loaders indexed by their corresponding vendor directories.
- *
- * @return self[]
- */
- public static function getRegisteredLoaders()
- {
- return self::$registeredLoaders;
- }
- /**
- * @param string $class
- * @param string $ext
- * @return string|false
- */
- private function findFileWithExtension($class, $ext)
- {
- // PSR-4 lookup
- $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
- $first = $class[0];
- if (isset($this->prefixLengthsPsr4[$first])) {
- $subPath = $class;
- while (false !== $lastPos = strrpos($subPath, '\\')) {
- $subPath = substr($subPath, 0, $lastPos);
- $search = $subPath . '\\';
- if (isset($this->prefixDirsPsr4[$search])) {
- $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
- foreach ($this->prefixDirsPsr4[$search] as $dir) {
- if (file_exists($file = $dir . $pathEnd)) {
- return $file;
- }
- }
- }
- }
- }
- // PSR-4 fallback dirs
- foreach ($this->fallbackDirsPsr4 as $dir) {
- if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
- return $file;
- }
- }
- // PSR-0 lookup
- if (false !== $pos = strrpos($class, '\\')) {
- // namespaced class name
- $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
- . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
- } else {
- // PEAR-like class name
- $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
- }
- if (isset($this->prefixesPsr0[$first])) {
- foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
- if (0 === strpos($class, $prefix)) {
- foreach ($dirs as $dir) {
- if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
- return $file;
- }
- }
- }
- }
- }
- // PSR-0 fallback dirs
- foreach ($this->fallbackDirsPsr0 as $dir) {
- if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
- return $file;
- }
- }
- // PSR-0 include paths.
- if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
- return $file;
- }
- return false;
- }
- }
- /**
- * Scope isolated include.
- *
- * Prevents access to $this/self from included files.
- *
- * @param string $file
- * @return void
- * @private
- */
- function includeFile($file)
- {
- include $file;
- }
- <?php
- /*
- * This file is part of Composer.
- *
- * (c) Nils Adermann <naderman@naderman.de>
- * Jordi Boggiano <j.boggiano@seld.be>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
- namespace Composer;
- use Composer\Autoload\ClassLoader;
- use Composer\Semver\VersionParser;
- /**
- * This class is copied in every Composer installed project and available to all
- *
- * See also https://getcomposer.org/doc/07-runtime.md#installed-versions
- *
- * To require its presence, you can require `composer-runtime-api ^2.0`
- *
- * @final
- */
- class InstalledVersions
- {
- /**
- * @var mixed[]|null
- * @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
- */
- private static $installed;
- /**
- * @var bool|null
- */
- private static $canGetVendors;
- /**
- * @var array[]
- * @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[]}>}>
- */
- private static $installedByVendor = array();
- /**
- * Returns a list of all package names which are present, either by being installed, replaced or provided
- *
- * @return string[]
- * @psalm-return list<string>
- */
- public static function getInstalledPackages()
- {
- $packages = array();
- foreach (self::getInstalled() as $installed) {
- $packages[] = array_keys($installed['versions']);
- }
- if (1 === \count($packages)) {
- return $packages[0];
- }
- return array_keys(array_flip(\call_user_func_array('array_merge', $packages)));
- }
- /**
- * Returns a list of all package names with a specific type e.g. 'library'
- *
- * @param string $type
- * @return string[]
- * @psalm-return list<string>
- */
- public static function getInstalledPackagesByType($type)
- {
- $packagesByType = array();
- foreach (self::getInstalled() as $installed) {
- foreach ($installed['versions'] as $name => $package) {
- if (isset($package['type']) && $package['type'] === $type) {
- $packagesByType[] = $name;
- }
- }
- }
- return $packagesByType;
- }
- /**
- * Checks whether the given package is installed
- *
- * This also returns true if the package name is provided or replaced by another package
- *
- * @param string $packageName
- * @param bool $includeDevRequirements
- * @return bool
- */
- public static function isInstalled($packageName, $includeDevRequirements = true)
- {
- foreach (self::getInstalled() as $installed) {
- if (isset($installed['versions'][$packageName])) {
- return $includeDevRequirements || empty($installed['versions'][$packageName]['dev_requirement']);
- }
- }
- return false;
- }
- /**
- * Checks whether the given package satisfies a version constraint
- *
- * e.g. If you want to know whether version 2.3+ of package foo/bar is installed, you would call:
- *
- * Composer\InstalledVersions::satisfies(new VersionParser, 'foo/bar', '^2.3')
- *
- * @param VersionParser $parser Install composer/semver to have access to this class and functionality
- * @param string $packageName
- * @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
- * @return bool
- */
- public static function satisfies(VersionParser $parser, $packageName, $constraint)
- {
- $constraint = $parser->parseConstraints($constraint);
- $provided = $parser->parseConstraints(self::getVersionRanges($packageName));
- return $provided->matches($constraint);
- }
- /**
- * Returns a version constraint representing all the range(s) which are installed for a given package
- *
- * It is easier to use this via isInstalled() with the $constraint argument if you need to check
- * whether a given version of a package is installed, and not just whether it exists
- *
- * @param string $packageName
- * @return string Version constraint usable with composer/semver
- */
- public static function getVersionRanges($packageName)
- {
- foreach (self::getInstalled() as $installed) {
- if (!isset($installed['versions'][$packageName])) {
- continue;
- }
- $ranges = array();
- if (isset($installed['versions'][$packageName]['pretty_version'])) {
- $ranges[] = $installed['versions'][$packageName]['pretty_version'];
- }
- if (array_key_exists('aliases', $installed['versions'][$packageName])) {
- $ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']);
- }
- if (array_key_exists('replaced', $installed['versions'][$packageName])) {
- $ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']);
- }
- if (array_key_exists('provided', $installed['versions'][$packageName])) {
- $ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']);
- }
- return implode(' || ', $ranges);
- }
- throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
- }
- /**
- * @param string $packageName
- * @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
- */
- public static function getVersion($packageName)
- {
- foreach (self::getInstalled() as $installed) {
- if (!isset($installed['versions'][$packageName])) {
- continue;
- }
- if (!isset($installed['versions'][$packageName]['version'])) {
- return null;
- }
- return $installed['versions'][$packageName]['version'];
- }
- throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
- }
- /**
- * @param string $packageName
- * @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
- */
- public static function getPrettyVersion($packageName)
- {
- foreach (self::getInstalled() as $installed) {
- if (!isset($installed['versions'][$packageName])) {
- continue;
- }
- if (!isset($installed['versions'][$packageName]['pretty_version'])) {
- return null;
- }
- return $installed['versions'][$packageName]['pretty_version'];
- }
- throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
- }
- /**
- * @param string $packageName
- * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as reference
- */
- public static function getReference($packageName)
- {
- foreach (self::getInstalled() as $installed) {
- if (!isset($installed['versions'][$packageName])) {
- continue;
- }
- if (!isset($installed['versions'][$packageName]['reference'])) {
- return null;
- }
- return $installed['versions'][$packageName]['reference'];
- }
- throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
- }
- /**
- * @param string $packageName
- * @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.
- */
- public static function getInstallPath($packageName)
- {
- foreach (self::getInstalled() as $installed) {
- if (!isset($installed['versions'][$packageName])) {
- continue;
- }
- return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null;
- }
- throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
- }
- /**
- * @return array
- * @psalm-return array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}
- */
- public static function getRootPackage()
- {
- $installed = self::getInstalled();
- return $installed[0]['root'];
- }
- /**
- * Returns the raw installed.php data for custom implementations
- *
- * @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.
- * @return array[]
- * @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[]}>}
- */
- public static function getRawData()
- {
- @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);
- if (null === self::$installed) {
- // only require the installed.php file if this file is loaded from its dumped location,
- // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
- if (substr(__DIR__, -8, 1) !== 'C') {
- self::$installed = include __DIR__ . '/installed.php';
- } else {
- self::$installed = array();
- }
- }
- return self::$installed;
- }
- /**
- * Returns the raw data of all installed.php which are currently loaded for custom implementations
- *
- * @return array[]
- * @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[]}>}>
- */
- public static function getAllRawData()
- {
- return self::getInstalled();
- }
- /**
- * Lets you reload the static array from another file
- *
- * This is only useful for complex integrations in which a project needs to use
- * this class but then also needs to execute another project's autoloader in process,
- * and wants to ensure both projects have access to their version of installed.php.
- *
- * A typical case would be PHPUnit, where it would need to make sure it reads all
- * the data it needs from this class, then call reload() with
- * `require $CWD/vendor/composer/installed.php` (or similar) as input to make sure
- * the project in which it runs can then also use this class safely, without
- * interference between PHPUnit's dependencies and the project's dependencies.
- *
- * @param array[] $data A vendor/composer/installed.php data set
- * @return void
- *
- * @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
- */
- public static function reload($data)
- {
- self::$installed = $data;
- self::$installedByVendor = array();
- }
- /**
- * @return array[]
- * @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[]}>}>
- */
- private static function getInstalled()
- {
- if (null === self::$canGetVendors) {
- self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders');
- }
- $installed = array();
- if (self::$canGetVendors) {
- foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
- if (isset(self::$installedByVendor[$vendorDir])) {
- $installed[] = self::$installedByVendor[$vendorDir];
- } elseif (is_file($vendorDir.'/composer/installed.php')) {
- $installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php';
- if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
- self::$installed = $installed[count($installed) - 1];
- }
- }
- }
- }
- if (null === self::$installed) {
- // only require the installed.php file if this file is loaded from its dumped location,
- // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
- if (substr(__DIR__, -8, 1) !== 'C') {
- self::$installed = require __DIR__ . '/installed.php';
- } else {
- self::$installed = array();
- }
- }
- $installed[] = self::$installed;
- return $installed;
- }
- }
- {
- "$schema": "https://json-schema.org/draft-04/schema#",
- "description": "A representation of packages metadata.",
- "type": "object",
- "oneOf": [
- { "required": [ "packages" ] },
- { "required": [ "providers" ] },
- { "required": [ "provider-includes", "providers-url" ] }
- ],
- "properties": {
- "packages": {
- "type": ["object", "array"],
- "description": "A hashmap of package names in the form of <vendor>/<name>.",
- "additionalProperties": { "$ref": "#/definitions/versions" }
- },
- "providers-url": {
- "type": "string",
- "description": "Endpoint to retrieve provider data from, e.g. '/p/%package%$%hash%.json'."
- },
- "provider-includes": {
- "type": "object",
- "description": "A hashmap of provider listings.",
- "additionalProperties": { "$ref": "#/definitions/provider" }
- },
- "providers": {
- "type": "object",
- "description": "A hashmap of package names in the form of <vendor>/<name>.",
- "additionalProperties": { "$ref": "#/definitions/provider" }
- },
- "notify-batch": {
- "type": "string",
- "description": "Endpoint to call after multiple packages have been installed, e.g. '/downloads/'."
- },
- "search": {
- "type": "string",
- "description": "Endpoint that provides search capabilities, e.g. '/search.json?q=%query%&type=%type%'."
- },
- "warning": {
- "type": "string",
- "description": "A message that will be output by Composer as a warning when this source is consulted."
- }
- },
- "definitions": {
- "versions": {
- "type": "object",
- "description": "A hashmap of versions and their metadata.",
- "additionalProperties": { "$ref": "#/definitions/version" }
- },
- "version": {
- "type": "object",
- "oneOf": [
- { "$ref": "#/definitions/package" },
- { "$ref": "#/definitions/metapackage" }
- ]
- },
- "package-base": {
- "properties": {
- "name": { "type": "string" },
- "type": { "type": "string" },
- "version": { "type": "string" },
- "version_normalized": {
- "type": "string",
- "description": "Normalized version, optional but can save computational time on client side."
- },
- "autoload": { "type": "object" },
- "require": { "type": "object" },
- "replace": { "type": "object" },
- "conflict": { "type": "object" },
- "provide": { "type": "object" },
- "time": { "type": "string" }
- },
- "additionalProperties": true
- },
- "package": {
- "allOf": [
- { "$ref": "#/definitions/package-base" },
- {
- "properties": {
- "dist": { "type": "object" },
- "source": { "type": "object" }
- }
- },
- { "oneOf": [
- { "required": [ "name", "version", "source" ] },
- { "required": [ "name", "version", "dist" ] }
- ] }
- ]
- },
- "metapackage": {
- "allOf": [
- { "$ref": "#/definitions/package-base" },
- {
- "properties": {
- "type": { "type": "string", "enum": [ "metapackage" ] }
- },
- "required": [ "name", "version", "type" ]
- }
- ]
- },
- "provider": {
- "type": "object",
- "properties": {
- "sha256": {
- "type": "string",
- "description": "Hash value that can be used to validate the resource."
- }
- }
- }
- }
- }
- {
- "$schema": "https://json-schema.org/draft-04/schema#",
- "title": "Package",
- "type": "object",
- "properties": {
- "name": {
- "type": "string",
- "description": "Package name, including 'vendor-name/' prefix.",
- "pattern": "^[a-z0-9]([_.-]?[a-z0-9]+)*\/[a-z0-9](([_.]|-{1,2})?[a-z0-9]+)*$"
- },
- "description": {
- "type": "string",
- "description": "Short package description."
- },
- "license": {
- "type": ["string", "array"],
- "description": "License name. Or an array of license names."
- },
- "type": {
- "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.",
- "type": "string",
- "pattern": "^[a-z0-9-]+$"
- },
- "abandoned": {
- "type": ["boolean", "string"],
- "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."
- },
- "version": {
- "type": "string",
- "description": "Package version, see https://getcomposer.org/doc/04-schema.md#version for more info on valid schemes.",
- "pattern": "^v?\\d+(\\.\\d+){0,3}|^dev-"
- },
- "default-branch": {
- "type": ["boolean"],
- "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."
- },
- "non-feature-branches": {
- "type": ["array"],
- "description": "A set of string or regex patterns for non-numeric branch names that will not be handled as feature branches.",
- "items": {
- "type": "string"
- }
- },
- "keywords": {
- "type": "array",
- "items": {
- "type": "string",
- "description": "A tag/keyword that this package relates to."
- }
- },
- "readme": {
- "type": "string",
- "description": "Relative path to the readme document."
- },
- "time": {
- "type": "string",
- "description": "Package release date, in 'YYYY-MM-DD', 'YYYY-MM-DD HH:MM:SS' or 'YYYY-MM-DDTHH:MM:SSZ' format."
- },
- "authors": {
- "$ref": "#/definitions/authors"
- },
- "homepage": {
- "type": "string",
- "description": "Homepage URL for the project.",
- "format": "uri"
- },
- "support": {
- "type": "object",
- "properties": {
- "email": {
- "type": "string",
- "description": "Email address for support.",
- "format": "email"
- },
- "issues": {
- "type": "string",
- "description": "URL to the issue tracker.",
- "format": "uri"
- },
- "forum": {
- "type": "string",
- "description": "URL to the forum.",
- "format": "uri"
- },
- "wiki": {
- "type": "string",
- "description": "URL to the wiki.",
- "format": "uri"
- },
- "irc": {
- "type": "string",
- "description": "IRC channel for support, as irc://server/channel.",
- "format": "uri"
- },
- "chat": {
- "type": "string",
- "description": "URL to the support chat.",
- "format": "uri"
- },
- "source": {
- "type": "string",
- "description": "URL to browse or download the sources.",
- "format": "uri"
- },
- "docs": {
- "type": "string",
- "description": "URL to the documentation.",
- "format": "uri"
- },
- "rss": {
- "type": "string",
- "description": "URL to the RSS feed.",
- "format": "uri"
- }
- }
- },
- "funding": {
- "type": "array",
- "description": "A list of options to fund the development and maintenance of the package.",
- "items": {
- "type": "object",
- "properties": {
- "type": {
- "type": "string",
- "description": "Type of funding or platform through which funding is possible."
- },
- "url": {
- "type": "string",
- "description": "URL to a website with details on funding and a way to fund the package.",
- "format": "uri"
- }
- }
- }
- },
- "source": {
- "$ref": "#/definitions/source"
- },
- "dist": {
- "$ref": "#/definitions/dist"
- },
- "_comment": {
- "type": ["array", "string"],
- "description": "A key to store comments in"
- },
- "require": {
- "type": "object",
- "description": "This is an object of package name (keys) and version constraints (values) that are required to run this package.",
- "additionalProperties": {
- "type": "string"
- }
- },
- "require-dev": {
- "type": "object",
- "description": "This is an object of package name (keys) and version constraints (values) that this package requires for developing it (testing tools and such).",
- "additionalProperties": {
- "type": "string"
- }
- },
- "replace": {
- "type": "object",
- "description": "This is an object of package name (keys) and version constraints (values) that can be replaced by this package.",
- "additionalProperties": {
- "type": "string"
- }
- },
- "conflict": {
- "type": "object",
- "description": "This is an object of package name (keys) and version constraints (values) that conflict with this package.",
- "additionalProperties": {
- "type": "string"
- }
- },
- "provide": {
- "type": "object",
- "description": "This is an object of package name (keys) and version constraints (values) that this package provides in addition to this package's name.",
- "additionalProperties": {
- "type": "string"
- }
- },
- "suggest": {
- "type": "object",
- "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).",
- "additionalProperties": {
- "type": "string"
- }
- },
- "repositories": {
- "type": ["object", "array"],
- "description": "A set of additional repositories where packages can be found.",
- "additionalProperties": {
- "anyOf": [
- { "$ref": "#/definitions/repository" },
- { "type": "boolean", "enum": [false] }
- ]
- },
- "items": {
- "anyOf": [
- { "$ref": "#/definitions/repository" },
- {
- "type": "object",
- "additionalProperties": { "type": "boolean", "enum": [false] },
- "minProperties": 1,
- "maxProperties": 1
- }
- ]
- }
- },
- "minimum-stability": {
- "type": ["string"],
- "description": "The minimum stability the packages must have to be install-able. Possible values are: dev, alpha, beta, RC, stable.",
- "enum": ["dev", "alpha", "beta", "rc", "RC", "stable"]
- },
- "prefer-stable": {
- "type": ["boolean"],
- "description": "If set to true, stable packages will be preferred to dev packages when possible, even if the minimum-stability allows unstable packages."
- },
- "autoload": {
- "$ref": "#/definitions/autoload"
- },
- "autoload-dev": {
- "type": "object",
- "description": "Description of additional autoload rules for development purpose (eg. a test suite).",
- "properties": {
- "psr-0": {
- "type": "object",
- "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.",
- "additionalProperties": {
- "type": ["string", "array"],
- "items": {
- "type": "string"
- }
- }
- },
- "psr-4": {
- "type": "object",
- "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.",
- "additionalProperties": {
- "type": ["string", "array"],
- "items": {
- "type": "string"
- }
- }
- },
- "classmap": {
- "type": "array",
- "description": "This is an array of paths that contain classes to be included in the class-map generation process."
- },
- "files": {
- "type": "array",
- "description": "This is an array of files that are always required on every request."
- }
- }
- },
- "target-dir": {
- "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.",
- "type": "string"
- },
- "include-path": {
- "type": ["array"],
- "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.",
- "items": {
- "type": "string"
- }
- },
- "bin": {
- "type": ["string", "array"],
- "description": "A set of files, or a single file, that should be treated as binaries and symlinked into bin-dir (from config).",
- "items": {
- "type": "string"
- }
- },
- "archive": {
- "type": ["object"],
- "description": "Options for creating package archives for distribution.",
- "properties": {
- "name": {
- "type": "string",
- "description": "A base name for archive."
- },
- "exclude": {
- "type": "array",
- "description": "A list of patterns for paths to exclude or include if prefixed with an exclamation mark."
- }
- }
- },
- "config": {
- "type": "object",
- "description": "Composer options.",
- "properties": {
- "platform": {
- "type": "object",
- "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.",
- "additionalProperties": {
- "type": ["string", "boolean"]
- }
- },
- "allow-plugins": {
- "type": ["object", "boolean"],
- "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.",
- "additionalProperties": {
- "type": ["boolean"]
- }
- },
- "process-timeout": {
- "type": "integer",
- "description": "The timeout in seconds for process executions, defaults to 300 (5mins)."
- },
- "use-include-path": {
- "type": "boolean",
- "description": "If true, the Composer autoloader will also look for classes in the PHP include path."
- },
- "use-parent-dir": {
- "type": ["string", "boolean"],
- "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."
- },
- "preferred-install": {
- "type": ["string", "object"],
- "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\"}.",
- "additionalProperties": {
- "type": ["string"]
- }
- },
- "notify-on-install": {
- "type": "boolean",
- "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."
- },
- "github-protocols": {
- "type": "array",
- "description": "A list of protocols to use for github.com clones, in priority order, defaults to [\"https\", \"ssh\", \"git\"].",
- "items": {
- "type": "string"
- }
- },
- "github-oauth": {
- "type": "object",
- "description": "An object of domain name => github API oauth tokens, typically {\"github.com\":\"<token>\"}.",
- "additionalProperties": {
- "type": "string"
- }
- },
- "gitlab-oauth": {
- "type": "object",
- "description": "An object of domain name => gitlab API oauth tokens, typically {\"gitlab.com\":{\"expires-at\":\"<expiration date>\", \"refresh-token\":\"<refresh token>\", \"token\":\"<token>\"}}.",
- "additionalProperties": {
- "type": ["string", "object"],
- "required": [ "token"],
- "properties": {
- "expires-at": {
- "type": "integer",
- "description": "The expiration date for this GitLab token"
- },
- "refresh-token": {
- "type": "string",
- "description": "The refresh token used for GitLab authentication"
- },
- "token": {
- "type": "string",
- "description": "The token used for GitLab authentication"
- }
- }
- }
- },
- "gitlab-token": {
- "type": "object",
- "description": "An object of domain name => gitlab private tokens, typically {\"gitlab.com\":\"<token>\"}, or an object with username and token keys.",
- "additionalProperties": {
- "type": ["string", "object"],
- "required": ["username", "token"],
- "properties": {
- "username": {
- "type": "string",
- "description": "The username used for GitLab authentication"
- },
- "token": {
- "type": "string",
- "description": "The token used for GitLab authentication"
- }
- }
- }
- },
- "gitlab-protocol": {
- "enum": ["git", "http", "https"],
- "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."
- },
- "bearer": {
- "type": "object",
- "description": "An object of domain name => bearer authentication token, for example {\"example.com\":\"<token>\"}.",
- "additionalProperties": {
- "type": "string"
- }
- },
- "disable-tls": {
- "type": "boolean",
- "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."
- },
- "secure-http": {
- "type": "boolean",
- "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."
- },
- "secure-svn-domains": {
- "type": "array",
- "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.",
- "items": {
- "type": "string"
- }
- },
- "cafile": {
- "type": "string",
- "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."
- },
- "capath": {
- "type": "string",
- "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."
- },
- "http-basic": {
- "type": "object",
- "description": "An object of domain name => {\"username\": \"...\", \"password\": \"...\"}.",
- "additionalProperties": {
- "type": "object",
- "required": ["username", "password"],
- "properties": {
- "username": {
- "type": "string",
- "description": "The username used for HTTP Basic authentication"
- },
- "password": {
- "type": "string",
- "description": "The password used for HTTP Basic authentication"
- }
- }
- }
- },
- "store-auths": {
- "type": ["string", "boolean"],
- "description": "What to do after prompting for authentication, one of: true (store), false (do not store) or \"prompt\" (ask every time), defaults to prompt."
- },
- "vendor-dir": {
- "type": "string",
- "description": "The location where all packages are installed, defaults to \"vendor\"."
- },
- "bin-dir": {
- "type": "string",
- "description": "The location where all binaries are linked, defaults to \"vendor/bin\"."
- },
- "data-dir": {
- "type": "string",
- "description": "The location where old phar files are stored, defaults to \"$home\" except on XDG Base Directory compliant unixes."
- },
- "cache-dir": {
- "type": "string",
- "description": "The location where all caches are located, defaults to \"~/.composer/cache\" on *nix and \"%LOCALAPPDATA%\\Composer\" on windows."
- },
- "cache-files-dir": {
- "type": "string",
- "description": "The location where files (zip downloads) are cached, defaults to \"{$cache-dir}/files\"."
- },
- "cache-repo-dir": {
- "type": "string",
- "description": "The location where repo (git/hg repo clones) are cached, defaults to \"{$cache-dir}/repo\"."
- },
- "cache-vcs-dir": {
- "type": "string",
- "description": "The location where vcs infos (git clones, github api calls, etc. when reading vcs repos) are cached, defaults to \"{$cache-dir}/vcs\"."
- },
- "cache-ttl": {
- "type": "integer",
- "description": "The default cache time-to-live, defaults to 15552000 (6 months)."
- },
- "cache-files-ttl": {
- "type": "integer",
- "description": "The cache time-to-live for files, defaults to the value of cache-ttl."
- },
- "cache-files-maxsize": {
- "type": ["string", "integer"],
- "description": "The cache max size for the files cache, defaults to \"300MiB\"."
- },
- "cache-read-only": {
- "type": ["boolean"],
- "description": "Whether to use the Composer cache in read-only mode."
- },
- "bin-compat": {
- "enum": ["auto", "full", "proxy", "symlink"],
- "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)."
- },
- "discard-changes": {
- "type": ["string", "boolean"],
- "description": "The default style of handling dirty updates, defaults to false and can be any of true, false or \"stash\"."
- },
- "autoloader-suffix": {
- "type": "string",
- "description": "Optional string to be used as a suffix for the generated Composer autoloader. When null a random one will be generated."
- },
- "optimize-autoloader": {
- "type": "boolean",
- "description": "Always optimize when dumping the autoloader."
- },
- "prepend-autoloader": {
- "type": "boolean",
- "description": "If false, the composer autoloader will not be prepended to existing autoloaders, defaults to true."
- },
- "classmap-authoritative": {
- "type": "boolean",
- "description": "If true, the composer autoloader will not scan the filesystem for classes that are not found in the class map, defaults to false."
- },
- "apcu-autoloader": {
- "type": "boolean",
- "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."
- },
- "github-domains": {
- "type": "array",
- "description": "A list of domains to use in github mode. This is used for GitHub Enterprise setups, defaults to [\"github.com\"].",
- "items": {
- "type": "string"
- }
- },
- "github-expose-hostname": {
- "type": "boolean",
- "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."
- },
- "gitlab-domains": {
- "type": "array",
- "description": "A list of domains to use in gitlab mode. This is used for custom GitLab setups, defaults to [\"gitlab.com\"].",
- "items": {
- "type": "string"
- }
- },
- "bitbucket-oauth": {
- "type": "object",
- "description": "An object of domain name => {\"consumer-key\": \"...\", \"consumer-secret\": \"...\"}.",
- "additionalProperties": {
- "type": "object",
- "required": ["consumer-key", "consumer-secret"],
- "properties": {
- "consumer-key": {
- "type": "string",
- "description": "The consumer-key used for OAuth authentication"
- },
- "consumer-secret": {
- "type": "string",
- "description": "The consumer-secret used for OAuth authentication"
- },
- "access-token": {
- "type": "string",
- "description": "The OAuth token retrieved from Bitbucket's API, this is written by Composer and you should not set it nor modify it."
- },
- "access-token-expiration": {
- "type": "integer",
- "description": "The generated token's expiration timestamp, this is written by Composer and you should not set it nor modify it."
- }
- }
- }
- },
- "use-github-api": {
- "type": "boolean",
- "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."
- },
- "archive-format": {
- "type": "string",
- "description": "The default archiving format when not provided on cli, defaults to \"tar\"."
- },
- "archive-dir": {
- "type": "string",
- "description": "The default archive path when not provided on cli, defaults to \".\"."
- },
- "htaccess-protect": {
- "type": "boolean",
- "description": "Defaults to true. If set to false, Composer will not create .htaccess files in the composer home, cache, and data directories."
- },
- "sort-packages": {
- "type": "boolean",
- "description": "Defaults to false. If set to true, Composer will sort packages when adding/updating a new dependency."
- },
- "lock": {
- "type": "boolean",
- "description": "Defaults to true. If set to false, Composer will not create a composer.lock file."
- },
- "platform-check": {
- "type": ["boolean", "string"],
- "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."
- }
- }
- },
- "extra": {
- "type": ["object", "array"],
- "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.",
- "additionalProperties": true
- },
- "scripts": {
- "type": ["object"],
- "description": "Script listeners that will be executed before/after some events.",
- "properties": {
- "pre-install-cmd": {
- "type": ["array", "string"],
- "description": "Occurs before the install command is executed, contains one or more Class::method callables or shell commands."
- },
- "post-install-cmd": {
- "type": ["array", "string"],
- "description": "Occurs after the install command is executed, contains one or more Class::method callables or shell commands."
- },
- "pre-update-cmd": {
- "type": ["array", "string"],
- "description": "Occurs before the update command is executed, contains one or more Class::method callables or shell commands."
- },
- "post-update-cmd": {
- "type": ["array", "string"],
- "description": "Occurs after the update command is executed, contains one or more Class::method callables or shell commands."
- },
- "pre-status-cmd": {
- "type": ["array", "string"],
- "description": "Occurs before the status command is executed, contains one or more Class::method callables or shell commands."
- },
- "post-status-cmd": {
- "type": ["array", "string"],
- "description": "Occurs after the status command is executed, contains one or more Class::method callables or shell commands."
- },
- "pre-package-install": {
- "type": ["array", "string"],
- "description": "Occurs before a package is installed, contains one or more Class::method callables or shell commands."
- },
- "post-package-install": {
- "type": ["array", "string"],
- "description": "Occurs after a package is installed, contains one or more Class::method callables or shell commands."
- },
- "pre-package-update": {
- "type": ["array", "string"],
- "description": "Occurs before a package is updated, contains one or more Class::method callables or shell commands."
- },
- "post-package-update": {
- "type": ["array", "string"],
- "description": "Occurs after a package is updated, contains one or more Class::method callables or shell commands."
- },
- "pre-package-uninstall": {
- "type": ["array", "string"],
- "description": "Occurs before a package has been uninstalled, contains one or more Class::method callables or shell commands."
- },
- "post-package-uninstall": {
- "type": ["array", "string"],
- "description": "Occurs after a package has been uninstalled, contains one or more Class::method callables or shell commands."
- },
- "pre-autoload-dump": {
- "type": ["array", "string"],
- "description": "Occurs before the autoloader is dumped, contains one or more Class::method callables or shell commands."
- },
- "post-autoload-dump": {
- "type": ["array", "string"],
- "description": "Occurs after the autoloader is dumped, contains one or more Class::method callables or shell commands."
- },
- "post-root-package-install": {
- "type": ["array", "string"],
- "description": "Occurs after the root-package is installed, contains one or more Class::method callables or shell commands."
- },
- "post-create-project-cmd": {
- "type": ["array", "string"],
- "description": "Occurs after the create-project command is executed, contains one or more Class::method callables or shell commands."
- }
- }
- },
- "scripts-descriptions": {
- "type": ["object"],
- "description": "Descriptions for custom commands, shown in console help.",
- "additionalProperties": {
- "type": "string"
- }
- }
- },
- "definitions": {
- "authors": {
- "type": "array",
- "description": "List of authors that contributed to the package. This is typically the main maintainers, not the full list.",
- "items": {
- "type": "object",
- "additionalProperties": false,
- "required": [ "name"],
- "properties": {
- "name": {
- "type": "string",
- "description": "Full name of the author."
- },
- "email": {
- "type": "string",
- "description": "Email address of the author.",
- "format": "email"
- },
- "homepage": {
- "type": "string",
- "description": "Homepage URL for the author.",
- "format": "uri"
- },
- "role": {
- "type": "string",
- "description": "Author's role in the project."
- }
- }
- }
- },
- "autoload": {
- "type": "object",
- "description": "Description of how the package can be autoloaded.",
- "properties": {
- "psr-0": {
- "type": "object",
- "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.",
- "additionalProperties": {
- "type": ["string", "array"],
- "items": {
- "type": "string"
- }
- }
- },
- "psr-4": {
- "type": "object",
- "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.",
- "additionalProperties": {
- "type": ["string", "array"],
- "items": {
- "type": "string"
- }
- }
- },
- "classmap": {
- "type": "array",
- "description": "This is an array of paths that contain classes to be included in the class-map generation process."
- },
- "files": {
- "type": "array",
- "description": "This is an array of files that are always required on every request."
- },
- "exclude-from-classmap": {
- "type": "array",
- "description": "This is an array of patterns to exclude from autoload classmap generation. (e.g. \"exclude-from-classmap\": [\"/test/\", \"/tests/\", \"/Tests/\"]"
- }
- }
- },
- "repository": {
- "type": "object",
- "anyOf": [
- { "$ref": "#/definitions/composer-repository" },
- { "$ref": "#/definitions/vcs-repository" },
- { "$ref": "#/definitions/path-repository" },
- { "$ref": "#/definitions/artifact-repository" },
- { "$ref": "#/definitions/pear-repository" },
- { "$ref": "#/definitions/package-repository" }
- ]
- },
- "composer-repository": {
- "type": "object",
- "required": ["type", "url"],
- "properties": {
- "type": { "type": "string", "enum": ["composer"] },
- "url": { "type": "string" },
- "canonical": { "type": "boolean" },
- "only": {
- "type": "array",
- "items": {
- "type": "string"
- }
- },
- "exclude": {
- "type": "array",
- "items": {
- "type": "string"
- }
- },
- "options": {
- "type": "object",
- "additionalProperties": true
- },
- "allow_ssl_downgrade": { "type": "boolean" },
- "force-lazy-providers": { "type": "boolean" }
- }
- },
- "vcs-repository": {
- "type": "object",
- "required": ["type", "url"],
- "properties": {
- "type": { "type": "string", "enum": ["vcs", "github", "git", "gitlab", "bitbucket", "git-bitbucket", "hg", "fossil", "perforce", "svn"] },
- "url": { "type": "string" },
- "canonical": { "type": "boolean" },
- "only": {
- "type": "array",
- "items": {
- "type": "string"
- }
- },
- "exclude": {
- "type": "array",
- "items": {
- "type": "string"
- }
- },
- "no-api": { "type": "boolean" },
- "secure-http": { "type": "boolean" },
- "svn-cache-credentials": { "type": "boolean" },
- "trunk-path": { "type": ["string", "boolean"] },
- "branches-path": { "type": ["string", "boolean"] },
- "tags-path": { "type": ["string", "boolean"] },
- "package-path": { "type": "string" },
- "depot": { "type": "string" },
- "branch": { "type": "string" },
- "unique_perforce_client_name": { "type": "string" },
- "p4user": { "type": "string" },
- "p4password": { "type": "string" }
- }
- },
- "path-repository": {
- "type": "object",
- "required": ["type", "url"],
- "properties": {
- "type": { "type": "string", "enum": ["path"] },
- "url": { "type": "string" },
- "canonical": { "type": "boolean" },
- "only": {
- "type": "array",
- "items": {
- "type": "string"
- }
- },
- "exclude": {
- "type": "array",
- "items": {
- "type": "string"
- }
- },
- "options": {
- "type": "object",
- "properties": {
- "symlink": { "type": ["boolean", "null"] }
- },
- "additionalProperties": true
- }
- }
- },
- "artifact-repository": {
- "type": "object",
- "required": ["type", "url"],
- "properties": {
- "type": { "type": "string", "enum": ["artifact"] },
- "url": { "type": "string" },
- "canonical": { "type": "boolean" },
- "only": {
- "type": "array",
- "items": {
- "type": "string"
- }
- },
- "exclude": {
- "type": "array",
- "items": {
- "type": "string"
- }
- }
- }
- },
- "pear-repository": {
- "type": "object",
- "required": ["type", "url"],
- "properties": {
- "type": { "type": "string", "enum": ["pear"] },
- "url": { "type": "string" },
- "canonical": { "type": "boolean" },
- "only": {
- "type": "array",
- "items": {
- "type": "string"
- }
- },
- "exclude": {
- "type": "array",
- "items": {
- "type": "string"
- }
- },
- "vendor-alias": { "type": "string" }
- }
- },
- "package-repository": {
- "type": "object",
- "required": ["type", "package"],
- "properties": {
- "type": { "type": "string", "enum": ["package"] },
- "canonical": { "type": "boolean" },
- "only": {
- "type": "array",
- "items": {
- "type": "string"
- }
- },
- "exclude": {
- "type": "array",
- "items": {
- "type": "string"
- }
- },
- "package": {
- "oneOf": [
- { "$ref": "#/definitions/inline-package" },
- {
- "type": "array",
- "items": { "$ref": "#/definitions/inline-package" }
- }
- ]
- }
- }
- },
- "inline-package": {
- "type": "object",
- "required": ["name", "version"],
- "properties": {
- "name": {
- "type": "string",
- "description": "Package name, including 'vendor-name/' prefix."
- },
- "type": {
- "type": "string"
- },
- "target-dir": {
- "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.",
- "type": "string"
- },
- "description": {
- "type": "string"
- },
- "keywords": {
- "type": "array",
- "items": {
- "type": "string"
- }
- },
- "homepage": {
- "type": "string",
- "format": "uri"
- },
- "version": {
- "type": "string"
- },
- "time": {
- "type": "string"
- },
- "license": {
- "type": [
- "string",
- "array"
- ]
- },
- "authors": {
- "$ref": "#/definitions/authors"
- },
- "require": {
- "type": "object",
- "additionalProperties": {
- "type": "string"
- }
- },
- "replace": {
- "type": "object",
- "additionalProperties": {
- "type": "string"
- }
- },
- "conflict": {
- "type": "object",
- "additionalProperties": {
- "type": "string"
- }
- },
- "provide": {
- "type": "object",
- "additionalProperties": {
- "type": "string"
- }
- },
- "require-dev": {
- "type": "object",
- "additionalProperties": {
- "type": "string"
- }
- },
- "suggest": {
- "type": "object",
- "additionalProperties": {
- "type": "string"
- }
- },
- "extra": {
- "type": ["object", "array"],
- "additionalProperties": true
- },
- "autoload": {
- "$ref": "#/definitions/autoload"
- },
- "archive": {
- "type": ["object"],
- "properties": {
- "exclude": {
- "type": "array"
- }
- }
- },
- "bin": {
- "type": ["string", "array"],
- "description": "A set of files, or a single file, that should be treated as binaries and symlinked into bin-dir (from config).",
- "items": {
- "type": "string"
- }
- },
- "include-path": {
- "type": ["array"],
- "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.",
- "items": {
- "type": "string"
- }
- },
- "source": {
- "$ref": "#/definitions/source"
- },
- "dist": {
- "$ref": "#/definitions/dist"
- }
- },
- "additionalProperties": true
- },
- "source": {
- "type": "object",
- "required": ["type", "url", "reference"],
- "properties": {
- "type": {
- "type": "string"
- },
- "url": {
- "type": "string"
- },
- "reference": {
- "type": "string"
- },
- "mirrors": {
- "type": "array"
- }
- }
- },
- "dist": {
- "type": "object",
- "required": ["type", "url"],
- "properties": {
- "type": {
- "type": "string"
- },
- "url": {
- "type": "string"
- },
- "reference": {
- "type": "string"
- },
- "shasum": {
- "type": "string"
- },
- "mirrors": {
- "type": "array"
- }
- }
- }
- }
- }
- <?php
- if (PHP_VERSION_ID < 50600) {
- echo '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;
- exit(1);
- }
- require_once __DIR__ . '/composer/autoload_real.php';
- return ComposerAutoloaderInitComposerPhar1660988690::getLoader();
- <?php
- namespace Composer\Autoload;
- class ClassLoader
- {
- private $vendorDir;
- private $prefixLengthsPsr4 = array();
- private $prefixDirsPsr4 = array();
- private $fallbackDirsPsr4 = array();
- private $prefixesPsr0 = array();
- private $fallbackDirsPsr0 = array();
- private $useIncludePath = false;
- private $classMap = array();
- private $classMapAuthoritative = false;
- private $missingClasses = array();
- private $apcuPrefix;
- private static $registeredLoaders = array();
- public function __construct($vendorDir = null)
- {
- $this->vendorDir = $vendorDir;
- }
- public function getPrefixes()
- {
- if (!empty($this->prefixesPsr0)) {
- return call_user_func_array('array_merge', array_values($this->prefixesPsr0));
- }
- return array();
- }
- public function getPrefixesPsr4()
- {
- return $this->prefixDirsPsr4;
- }
- public function getFallbackDirs()
- {
- return $this->fallbackDirsPsr0;
- }
- public function getFallbackDirsPsr4()
- {
- return $this->fallbackDirsPsr4;
- }
- public function getClassMap()
- {
- return $this->classMap;
- }
- public function addClassMap(array $classMap)
- {
- if ($this->classMap) {
- $this->classMap = array_merge($this->classMap, $classMap);
- } else {
- $this->classMap = $classMap;
- }
- }
- public function add($prefix, $paths, $prepend = false)
- {
- if (!$prefix) {
- if ($prepend) {
- $this->fallbackDirsPsr0 = array_merge(
- (array) $paths,
- $this->fallbackDirsPsr0
- );
- } else {
- $this->fallbackDirsPsr0 = array_merge(
- $this->fallbackDirsPsr0,
- (array) $paths
- );
- }
- return;
- }
- $first = $prefix[0];
- if (!isset($this->prefixesPsr0[$first][$prefix])) {
- $this->prefixesPsr0[$first][$prefix] = (array) $paths;
- return;
- }
- if ($prepend) {
- $this->prefixesPsr0[$first][$prefix] = array_merge(
- (array) $paths,
- $this->prefixesPsr0[$first][$prefix]
- );
- } else {
- $this->prefixesPsr0[$first][$prefix] = array_merge(
- $this->prefixesPsr0[$first][$prefix],
- (array) $paths
- );
- }
- }
- public function addPsr4($prefix, $paths, $prepend = false)
- {
- if (!$prefix) {
- if ($prepend) {
- $this->fallbackDirsPsr4 = array_merge(
- (array) $paths,
- $this->fallbackDirsPsr4
- );
- } else {
- $this->fallbackDirsPsr4 = array_merge(
- $this->fallbackDirsPsr4,
- (array) $paths
- );
- }
- } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
- $length = strlen($prefix);
- if ('\\' !== $prefix[$length - 1]) {
- throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
- }
- $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
- $this->prefixDirsPsr4[$prefix] = (array) $paths;
- } elseif ($prepend) {
- $this->prefixDirsPsr4[$prefix] = array_merge(
- (array) $paths,
- $this->prefixDirsPsr4[$prefix]
- );
- } else {
- $this->prefixDirsPsr4[$prefix] = array_merge(
- $this->prefixDirsPsr4[$prefix],
- (array) $paths
- );
- }
- }
- public function set($prefix, $paths)
- {
- if (!$prefix) {
- $this->fallbackDirsPsr0 = (array) $paths;
- } else {
- $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
- }
- }
- public function setPsr4($prefix, $paths)
- {
- if (!$prefix) {
- $this->fallbackDirsPsr4 = (array) $paths;
- } else {
- $length = strlen($prefix);
- if ('\\' !== $prefix[$length - 1]) {
- throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
- }
- $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
- $this->prefixDirsPsr4[$prefix] = (array) $paths;
- }
- }
- public function setUseIncludePath($useIncludePath)
- {
- $this->useIncludePath = $useIncludePath;
- }
- public function getUseIncludePath()
- {
- return $this->useIncludePath;
- }
- public function setClassMapAuthoritative($classMapAuthoritative)
- {
- $this->classMapAuthoritative = $classMapAuthoritative;
- }
- public function isClassMapAuthoritative()
- {
- return $this->classMapAuthoritative;
- }
- public function setApcuPrefix($apcuPrefix)
- {
- $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
- }
- public function getApcuPrefix()
- {
- return $this->apcuPrefix;
- }
- public function register($prepend = false)
- {
- spl_autoload_register(array($this, 'loadClass'), true, $prepend);
- if (null === $this->vendorDir) {
- return;
- }
- if ($prepend) {
- self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders;
- } else {
- unset(self::$registeredLoaders[$this->vendorDir]);
- self::$registeredLoaders[$this->vendorDir] = $this;
- }
- }
- public function unregister()
- {
- spl_autoload_unregister(array($this, 'loadClass'));
- if (null !== $this->vendorDir) {
- unset(self::$registeredLoaders[$this->vendorDir]);
- }
- }
- public function loadClass($class)
- {
- if ($file = $this->findFile($class)) {
- includeFile($file);
- return true;
- }
- return null;
- }
- public function findFile($class)
- {
- if (isset($this->classMap[$class])) {
- return $this->classMap[$class];
- }
- if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
- return false;
- }
- if (null !== $this->apcuPrefix) {
- $file = apcu_fetch($this->apcuPrefix.$class, $hit);
- if ($hit) {
- return $file;
- }
- }
- $file = $this->findFileWithExtension($class, '.php');
- if (false === $file && defined('HHVM_VERSION')) {
- $file = $this->findFileWithExtension($class, '.hh');
- }
- if (null !== $this->apcuPrefix) {
- apcu_add($this->apcuPrefix.$class, $file);
- }
- if (false === $file) {
- $this->missingClasses[$class] = true;
- }
- return $file;
- }
- public static function getRegisteredLoaders()
- {
- return self::$registeredLoaders;
- }
- private function findFileWithExtension($class, $ext)
- {
- $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
- $first = $class[0];
- if (isset($this->prefixLengthsPsr4[$first])) {
- $subPath = $class;
- while (false !== $lastPos = strrpos($subPath, '\\')) {
- $subPath = substr($subPath, 0, $lastPos);
- $search = $subPath . '\\';
- if (isset($this->prefixDirsPsr4[$search])) {
- $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
- foreach ($this->prefixDirsPsr4[$search] as $dir) {
- if (file_exists($file = $dir . $pathEnd)) {
- return $file;
- }
- }
- }
- }
- }
- foreach ($this->fallbackDirsPsr4 as $dir) {
- if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
- return $file;
- }
- }
- if (false !== $pos = strrpos($class, '\\')) {
- $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
- . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
- } else {
- $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
- }
- if (isset($this->prefixesPsr0[$first])) {
- foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
- if (0 === strpos($class, $prefix)) {
- foreach ($dirs as $dir) {
- if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
- return $file;
- }
- }
- }
- }
- }
- foreach ($this->fallbackDirsPsr0 as $dir) {
- if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
- return $file;
- }
- }
- if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
- return $file;
- }
- return false;
- }
- }
- function includeFile($file)
- {
- include $file;
- }
- <?php
- namespace Composer;
- use Composer\Autoload\ClassLoader;
- use Composer\Semver\VersionParser;
- class InstalledVersions
- {
- private static $installed;
- private static $canGetVendors;
- private static $installedByVendor = array();
- public static function getInstalledPackages()
- {
- $packages = array();
- foreach (self::getInstalled() as $installed) {
- $packages[] = array_keys($installed['versions']);
- }
- if (1 === \count($packages)) {
- return $packages[0];
- }
- return array_keys(array_flip(\call_user_func_array('array_merge', $packages)));
- }
- public static function getInstalledPackagesByType($type)
- {
- $packagesByType = array();
- foreach (self::getInstalled() as $installed) {
- foreach ($installed['versions'] as $name => $package) {
- if (isset($package['type']) && $package['type'] === $type) {
- $packagesByType[] = $name;
- }
- }
- }
- return $packagesByType;
- }
- public static function isInstalled($packageName, $includeDevRequirements = true)
- {
- foreach (self::getInstalled() as $installed) {
- if (isset($installed['versions'][$packageName])) {
- return $includeDevRequirements || empty($installed['versions'][$packageName]['dev_requirement']);
- }
- }
- return false;
- }
- public static function satisfies(VersionParser $parser, $packageName, $constraint)
- {
- $constraint = $parser->parseConstraints($constraint);
- $provided = $parser->parseConstraints(self::getVersionRanges($packageName));
- return $provided->matches($constraint);
- }
- public static function getVersionRanges($packageName)
- {
- foreach (self::getInstalled() as $installed) {
- if (!isset($installed['versions'][$packageName])) {
- continue;
- }
- $ranges = array();
- if (isset($installed['versions'][$packageName]['pretty_version'])) {
- $ranges[] = $installed['versions'][$packageName]['pretty_version'];
- }
- if (array_key_exists('aliases', $installed['versions'][$packageName])) {
- $ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']);
- }
- if (array_key_exists('replaced', $installed['versions'][$packageName])) {
- $ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']);
- }
- if (array_key_exists('provided', $installed['versions'][$packageName])) {
- $ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']);
- }
- return implode(' || ', $ranges);
- }
- throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
- }
- public static function getVersion($packageName)
- {
- foreach (self::getInstalled() as $installed) {
- if (!isset($installed['versions'][$packageName])) {
- continue;
- }
- if (!isset($installed['versions'][$packageName]['version'])) {
- return null;
- }
- return $installed['versions'][$packageName]['version'];
- }
- throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
- }
- public static function getPrettyVersion($packageName)
- {
- foreach (self::getInstalled() as $installed) {
- if (!isset($installed['versions'][$packageName])) {
- continue;
- }
- if (!isset($installed['versions'][$packageName]['pretty_version'])) {
- return null;
- }
- return $installed['versions'][$packageName]['pretty_version'];
- }
- throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
- }
- public static function getReference($packageName)
- {
- foreach (self::getInstalled() as $installed) {
- if (!isset($installed['versions'][$packageName])) {
- continue;
- }
- if (!isset($installed['versions'][$packageName]['reference'])) {
- return null;
- }
- return $installed['versions'][$packageName]['reference'];
- }
- throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
- }
- public static function getInstallPath($packageName)
- {
- foreach (self::getInstalled() as $installed) {
- if (!isset($installed['versions'][$packageName])) {
- continue;
- }
- return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null;
- }
- throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
- }
- public static function getRootPackage()
- {
- $installed = self::getInstalled();
- return $installed[0]['root'];
- }
- public static function getRawData()
- {
- @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);
- if (null === self::$installed) {
- if (substr(__DIR__, -8, 1) !== 'C') {
- self::$installed = include __DIR__ . '/installed.php';
- } else {
- self::$installed = array();
- }
- }
- return self::$installed;
- }
- public static function getAllRawData()
- {
- return self::getInstalled();
- }
- public static function reload($data)
- {
- self::$installed = $data;
- self::$installedByVendor = array();
- }
- private static function getInstalled()
- {
- if (null === self::$canGetVendors) {
- self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders');
- }
- $installed = array();
- if (self::$canGetVendors) {
- foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
- if (isset(self::$installedByVendor[$vendorDir])) {
- $installed[] = self::$installedByVendor[$vendorDir];
- } elseif (is_file($vendorDir.'/composer/installed.php')) {
- $installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php';
- if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
- self::$installed = $installed[count($installed) - 1];
- }
- }
- }
- }
- if (null === self::$installed) {
- if (substr(__DIR__, -8, 1) !== 'C') {
- self::$installed = require __DIR__ . '/installed.php';
- } else {
- self::$installed = array();
- }
- }
- $installed[] = self::$installed;
- return $installed;
- }
- }
- <?php
- $vendorDir = dirname(__DIR__);
- $baseDir = dirname($vendorDir);
- return array(
- 'Attribute' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/Attribute.php',
- 'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
- 'JsonException' => $vendorDir . '/symfony/polyfill-php73/Resources/stubs/JsonException.php',
- 'Normalizer' => $vendorDir . '/symfony/polyfill-intl-normalizer/Resources/stubs/Normalizer.php',
- 'PhpToken' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/PhpToken.php',
- 'Stringable' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/Stringable.php',
- 'UnhandledMatchError' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/UnhandledMatchError.php',
- 'ValueError' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/ValueError.php',
- );
- <?php
- $vendorDir = dirname(__DIR__);
- $baseDir = dirname($vendorDir);
- return array(
- 'a4a119a56e50fbb293281d9a48007e0e' => $vendorDir . '/symfony/polyfill-php80/bootstrap.php',
- '6e3fae29631ef280660b3cdad06f25a8' => $vendorDir . '/symfony/deprecation-contracts/function.php',
- '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php',
- '320cde22f66dd4f5d3fd621d3e88b98f' => $vendorDir . '/symfony/polyfill-ctype/bootstrap.php',
- '8825ede83f2f289127722d4e842cf7e8' => $vendorDir . '/symfony/polyfill-intl-grapheme/bootstrap.php',
- 'e69f7f6ee287b969198c3c9d6777bd38' => $vendorDir . '/symfony/polyfill-intl-normalizer/bootstrap.php',
- '0d59ee240a4cd96ddbb4ff164fccea4d' => $vendorDir . '/symfony/polyfill-php73/bootstrap.php',
- 'b6b991a57620e2fb6b2f66f03fe9ddc2' => $vendorDir . '/symfony/string/Resources/functions.php',
- 'ad155f8f1cf0d418fe49e248db8c661b' => $vendorDir . '/react/promise/src/functions_include.php',
- );
- <?php
- $vendorDir = dirname(__DIR__);
- $baseDir = dirname($vendorDir);
- return array(
- );
- <?php
- $vendorDir = dirname(__DIR__);
- $baseDir = dirname($vendorDir);
- return array(
- 'Symfony\\Polyfill\\Php80\\' => array($vendorDir . '/symfony/polyfill-php80'),
- 'Symfony\\Polyfill\\Php73\\' => array($vendorDir . '/symfony/polyfill-php73'),
- 'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'),
- 'Symfony\\Polyfill\\Intl\\Normalizer\\' => array($vendorDir . '/symfony/polyfill-intl-normalizer'),
- 'Symfony\\Polyfill\\Intl\\Grapheme\\' => array($vendorDir . '/symfony/polyfill-intl-grapheme'),
- 'Symfony\\Polyfill\\Ctype\\' => array($vendorDir . '/symfony/polyfill-ctype'),
- 'Symfony\\Contracts\\Service\\' => array($vendorDir . '/symfony/service-contracts'),
- 'Symfony\\Component\\String\\' => array($vendorDir . '/symfony/string'),
- 'Symfony\\Component\\Process\\' => array($vendorDir . '/symfony/process'),
- 'Symfony\\Component\\Finder\\' => array($vendorDir . '/symfony/finder'),
- 'Symfony\\Component\\Filesystem\\' => array($vendorDir . '/symfony/filesystem'),
- 'Symfony\\Component\\Console\\' => array($vendorDir . '/symfony/console'),
- 'Seld\\Signal\\' => array($vendorDir . '/seld/signal-handler/src'),
- 'Seld\\PharUtils\\' => array($vendorDir . '/seld/phar-utils/src'),
- 'Seld\\JsonLint\\' => array($vendorDir . '/seld/jsonlint/src/Seld/JsonLint'),
- 'React\\Promise\\' => array($vendorDir . '/react/promise/src'),
- 'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'),
- 'Psr\\Container\\' => array($vendorDir . '/psr/container/src'),
- 'JsonSchema\\' => array($vendorDir . '/justinrainbow/json-schema/src/JsonSchema'),
- 'Composer\\XdebugHandler\\' => array($vendorDir . '/composer/xdebug-handler/src'),
- 'Composer\\Spdx\\' => array($vendorDir . '/composer/spdx-licenses/src'),
- 'Composer\\Semver\\' => array($vendorDir . '/composer/semver/src'),
- 'Composer\\Pcre\\' => array($vendorDir . '/composer/pcre/src'),
- 'Composer\\MetadataMinifier\\' => array($vendorDir . '/composer/metadata-minifier/src'),
- 'Composer\\ClassMapGenerator\\' => array($vendorDir . '/composer/class-map-generator/src'),
- 'Composer\\CaBundle\\' => array($vendorDir . '/composer/ca-bundle/src'),
- 'Composer\\' => array($baseDir . '/src/Composer'),
- );
- <?php
- class ComposerAutoloaderInitComposerPhar1660988690
- {
- private static $loader;
- public static function loadClassLoader($class)
- {
- if ('Composer\Autoload\ClassLoader' === $class) {
- require __DIR__ . '/ClassLoader.php';
- }
- }
- public static function getLoader()
- {
- if (null !== self::$loader) {
- return self::$loader;
- }
- spl_autoload_register(array('ComposerAutoloaderInitComposerPhar1660988690', 'loadClassLoader'), true, true);
- self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
- spl_autoload_unregister(array('ComposerAutoloaderInitComposerPhar1660988690', 'loadClassLoader'));
- require __DIR__ . '/autoload_static.php';
- call_user_func(\Composer\Autoload\ComposerStaticInitComposerPhar1660988690::getInitializer($loader));
- $loader->register(true);
- $includeFiles = \Composer\Autoload\ComposerStaticInitComposerPhar1660988690::$files;
- foreach ($includeFiles as $fileIdentifier => $file) {
- composerRequireComposerPhar1660988690($fileIdentifier, $file);
- }
- return $loader;
- }
- }
- function composerRequireComposerPhar1660988690($fileIdentifier, $file)
- {
- if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
- $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
- require $file;
- }
- }
- <?php
- namespace Composer\Autoload;
- class ComposerStaticInitComposerPhar1660988690
- {
- public static $files = array (
- 'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php',
- '6e3fae29631ef280660b3cdad06f25a8' => __DIR__ . '/..' . '/symfony/deprecation-contracts/function.php',
- '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
- '320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php',
- '8825ede83f2f289127722d4e842cf7e8' => __DIR__ . '/..' . '/symfony/polyfill-intl-grapheme/bootstrap.php',
- 'e69f7f6ee287b969198c3c9d6777bd38' => __DIR__ . '/..' . '/symfony/polyfill-intl-normalizer/bootstrap.php',
- '0d59ee240a4cd96ddbb4ff164fccea4d' => __DIR__ . '/..' . '/symfony/polyfill-php73/bootstrap.php',
- 'b6b991a57620e2fb6b2f66f03fe9ddc2' => __DIR__ . '/..' . '/symfony/string/Resources/functions.php',
- 'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
- );
- public static $prefixLengthsPsr4 = array (
- 'S' =>
- array (
- 'Symfony\\Polyfill\\Php80\\' => 23,
- 'Symfony\\Polyfill\\Php73\\' => 23,
- 'Symfony\\Polyfill\\Mbstring\\' => 26,
- 'Symfony\\Polyfill\\Intl\\Normalizer\\' => 33,
- 'Symfony\\Polyfill\\Intl\\Grapheme\\' => 31,
- 'Symfony\\Polyfill\\Ctype\\' => 23,
- 'Symfony\\Contracts\\Service\\' => 26,
- 'Symfony\\Component\\String\\' => 25,
- 'Symfony\\Component\\Process\\' => 26,
- 'Symfony\\Component\\Finder\\' => 25,
- 'Symfony\\Component\\Filesystem\\' => 29,
- 'Symfony\\Component\\Console\\' => 26,
- 'Seld\\Signal\\' => 12,
- 'Seld\\PharUtils\\' => 15,
- 'Seld\\JsonLint\\' => 14,
- ),
- 'R' =>
- array (
- 'React\\Promise\\' => 14,
- ),
- 'P' =>
- array (
- 'Psr\\Log\\' => 8,
- 'Psr\\Container\\' => 14,
- ),
- 'J' =>
- array (
- 'JsonSchema\\' => 11,
- ),
- 'C' =>
- array (
- 'Composer\\XdebugHandler\\' => 23,
- 'Composer\\Spdx\\' => 14,
- 'Composer\\Semver\\' => 16,
- 'Composer\\Pcre\\' => 14,
- 'Composer\\MetadataMinifier\\' => 26,
- 'Composer\\ClassMapGenerator\\' => 27,
- 'Composer\\CaBundle\\' => 18,
- 'Composer\\' => 9,
- ),
- );
- public static $prefixDirsPsr4 = array (
- 'Symfony\\Polyfill\\Php80\\' =>
- array (
- 0 => __DIR__ . '/..' . '/symfony/polyfill-php80',
- ),
- 'Symfony\\Polyfill\\Php73\\' =>
- array (
- 0 => __DIR__ . '/..' . '/symfony/polyfill-php73',
- ),
- 'Symfony\\Polyfill\\Mbstring\\' =>
- array (
- 0 => __DIR__ . '/..' . '/symfony/polyfill-mbstring',
- ),
- 'Symfony\\Polyfill\\Intl\\Normalizer\\' =>
- array (
- 0 => __DIR__ . '/..' . '/symfony/polyfill-intl-normalizer',
- ),
- 'Symfony\\Polyfill\\Intl\\Grapheme\\' =>
- array (
- 0 => __DIR__ . '/..' . '/symfony/polyfill-intl-grapheme',
- ),
- 'Symfony\\Polyfill\\Ctype\\' =>
- array (
- 0 => __DIR__ . '/..' . '/symfony/polyfill-ctype',
- ),
- 'Symfony\\Contracts\\Service\\' =>
- array (
- 0 => __DIR__ . '/..' . '/symfony/service-contracts',
- ),
- 'Symfony\\Component\\String\\' =>
- array (
- 0 => __DIR__ . '/..' . '/symfony/string',
- ),
- 'Symfony\\Component\\Process\\' =>
- array (
- 0 => __DIR__ . '/..' . '/symfony/process',
- ),
- 'Symfony\\Component\\Finder\\' =>
- array (
- 0 => __DIR__ . '/..' . '/symfony/finder',
- ),
- 'Symfony\\Component\\Filesystem\\' =>
- array (
- 0 => __DIR__ . '/..' . '/symfony/filesystem',
- ),
- 'Symfony\\Component\\Console\\' =>
- array (
- 0 => __DIR__ . '/..' . '/symfony/console',
- ),
- 'Seld\\Signal\\' =>
- array (
- 0 => __DIR__ . '/..' . '/seld/signal-handler/src',
- ),
- 'Seld\\PharUtils\\' =>
- array (
- 0 => __DIR__ . '/..' . '/seld/phar-utils/src',
- ),
- 'Seld\\JsonLint\\' =>
- array (
- 0 => __DIR__ . '/..' . '/seld/jsonlint/src/Seld/JsonLint',
- ),
- 'React\\Promise\\' =>
- array (
- 0 => __DIR__ . '/..' . '/react/promise/src',
- ),
- 'Psr\\Log\\' =>
- array (
- 0 => __DIR__ . '/..' . '/psr/log/Psr/Log',
- ),
- 'Psr\\Container\\' =>
- array (
- 0 => __DIR__ . '/..' . '/psr/container/src',
- ),
- 'JsonSchema\\' =>
- array (
- 0 => __DIR__ . '/..' . '/justinrainbow/json-schema/src/JsonSchema',
- ),
- 'Composer\\XdebugHandler\\' =>
- array (
- 0 => __DIR__ . '/..' . '/composer/xdebug-handler/src',
- ),
- 'Composer\\Spdx\\' =>
- array (
- 0 => __DIR__ . '/..' . '/composer/spdx-licenses/src',
- ),
- 'Composer\\Semver\\' =>
- array (
- 0 => __DIR__ . '/..' . '/composer/semver/src',
- ),
- 'Composer\\Pcre\\' =>
- array (
- 0 => __DIR__ . '/..' . '/composer/pcre/src',
- ),
- 'Composer\\MetadataMinifier\\' =>
- array (
- 0 => __DIR__ . '/..' . '/composer/metadata-minifier/src',
- ),
- 'Composer\\ClassMapGenerator\\' =>
- array (
- 0 => __DIR__ . '/..' . '/composer/class-map-generator/src',
- ),
- 'Composer\\CaBundle\\' =>
- array (
- 0 => __DIR__ . '/..' . '/composer/ca-bundle/src',
- ),
- 'Composer\\' =>
- array (
- 0 => __DIR__ . '/../..' . '/src/Composer',
- ),
- );
- public static $classMap = array (
- 'Attribute' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/Attribute.php',
- 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
- 'JsonException' => __DIR__ . '/..' . '/symfony/polyfill-php73/Resources/stubs/JsonException.php',
- 'Normalizer' => __DIR__ . '/..' . '/symfony/polyfill-intl-normalizer/Resources/stubs/Normalizer.php',
- 'PhpToken' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/PhpToken.php',
- 'Stringable' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/Stringable.php',
- 'UnhandledMatchError' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/UnhandledMatchError.php',
- 'ValueError' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/ValueError.php',
- );
- public static function getInitializer(ClassLoader $loader)
- {
- return \Closure::bind(function () use ($loader) {
- $loader->prefixLengthsPsr4 = ComposerStaticInitComposerPhar1660988690::$prefixLengthsPsr4;
- $loader->prefixDirsPsr4 = ComposerStaticInitComposerPhar1660988690::$prefixDirsPsr4;
- $loader->classMap = ComposerStaticInitComposerPhar1660988690::$classMap;
- }, null, ClassLoader::class);
- }
- }
- Copyright (C) 2016 Composer
- Permission is hereby granted, free of charge, to any person obtaining a copy of
- this software and associated documentation files (the "Software"), to deal in
- the Software without restriction, including without limitation the rights to
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
- of the Software, and to permit persons to whom the Software is furnished to do
- so, subject to the following conditions:
- The above copyright notice and this permission notice shall be included in all
- copies or substantial portions of the Software.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- SOFTWARE.
- ##
- ## Bundle of CA Root Certificates
- ##
- ## Certificate data from Mozilla as of: Tue Jul 19 03:12:06 2022 GMT
- ##
- ## This is a bundle of X.509 certificates of public Certificate Authorities
- ## (CA). These were automatically extracted from Mozilla's root certificates
- ## file (certdata.txt). This file can be found in the mozilla source tree:
- ## https://hg.mozilla.org/releases/mozilla-release/raw-file/default/security/nss/lib/ckfw/builtins/certdata.txt
- ##
- ## It contains the certificates in PEM format and therefore
- ## can be directly used with curl / libcurl / php_curl, or with
- ## an Apache+mod_ssl webserver for SSL client authentication.
- ## Just configure this file as the SSLCACertificateFile.
- ##
- ## Conversion done with mk-ca-bundle.pl version 1.29.
- ## SHA256: 9bf3799611fb58197f61d45e71ce3dc19f30e7dd73731915872ce5108a7bb066
- ##
- GlobalSign Root CA
- ==================
- -----BEGIN CERTIFICATE-----
- MIIDdTCCAl2gAwIBAgILBAAAAAABFUtaw5QwDQYJKoZIhvcNAQEFBQAwVzELMAkGA1UEBhMCQkUx
- GTAXBgNVBAoTEEdsb2JhbFNpZ24gbnYtc2ExEDAOBgNVBAsTB1Jvb3QgQ0ExGzAZBgNVBAMTEkds
- b2JhbFNpZ24gUm9vdCBDQTAeFw05ODA5MDExMjAwMDBaFw0yODAxMjgxMjAwMDBaMFcxCzAJBgNV
- BAYTAkJFMRkwFwYDVQQKExBHbG9iYWxTaWduIG52LXNhMRAwDgYDVQQLEwdSb290IENBMRswGQYD
- VQQDExJHbG9iYWxTaWduIFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDa
- DuaZjc6j40+Kfvvxi4Mla+pIH/EqsLmVEQS98GPR4mdmzxzdzxtIK+6NiY6arymAZavpxy0Sy6sc
- THAHoT0KMM0VjU/43dSMUBUc71DuxC73/OlS8pF94G3VNTCOXkNz8kHp1Wrjsok6Vjk4bwY8iGlb
- Kk3Fp1S4bInMm/k8yuX9ifUSPJJ4ltbcdG6TRGHRjcdGsnUOhugZitVtbNV4FpWi6cgKOOvyJBNP
- c1STE4U6G7weNLWLBYy5d4ux2x8gkasJU26Qzns3dLlwR5EiUWMWea6xrkEmCMgZK9FGqkjWZCrX
- gzT/LCrBbBlDSgeF59N89iFo7+ryUp9/k5DPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNV
- HRMBAf8EBTADAQH/MB0GA1UdDgQWBBRge2YaRQ2XyolQL30EzTSo//z9SzANBgkqhkiG9w0BAQUF
- AAOCAQEA1nPnfE920I2/7LqivjTFKDK1fPxsnCwrvQmeU79rXqoRSLblCKOzyj1hTdNGCbM+w6Dj
- Y1Ub8rrvrTnhQ7k4o+YviiY776BQVvnGCv04zcQLcFGUl5gE38NflNUVyRRBnMRddWQVDf9VMOyG
- j/8N7yy5Y0b2qvzfvGn9LhJIZJrglfCm7ymPAbEVtQwdpf5pLGkkeB6zpxxxYu7KyJesF12KwvhH
- hm4qxFYxldBniYUr+WymXUadDKqC5JlR3XC321Y9YeRq4VzW9v493kHMB65jUr9TU/Qr6cf9tveC
- X4XSQRjbgbMEHMUfpIBvFSDJ3gyICh3WZlXi/EjJKSZp4A==
- -----END CERTIFICATE-----
- Entrust.net Premium 2048 Secure Server CA
- =========================================
- -----BEGIN CERTIFICATE-----
- MIIEKjCCAxKgAwIBAgIEOGPe+DANBgkqhkiG9w0BAQUFADCBtDEUMBIGA1UEChMLRW50cnVzdC5u
- ZXQxQDA+BgNVBAsUN3d3dy5lbnRydXN0Lm5ldC9DUFNfMjA0OCBpbmNvcnAuIGJ5IHJlZi4gKGxp
- bWl0cyBsaWFiLikxJTAjBgNVBAsTHChjKSAxOTk5IEVudHJ1c3QubmV0IExpbWl0ZWQxMzAxBgNV
- BAMTKkVudHJ1c3QubmV0IENlcnRpZmljYXRpb24gQXV0aG9yaXR5ICgyMDQ4KTAeFw05OTEyMjQx
- NzUwNTFaFw0yOTA3MjQxNDE1MTJaMIG0MRQwEgYDVQQKEwtFbnRydXN0Lm5ldDFAMD4GA1UECxQ3
- d3d3LmVudHJ1c3QubmV0L0NQU18yMDQ4IGluY29ycC4gYnkgcmVmLiAobGltaXRzIGxpYWIuKTEl
- MCMGA1UECxMcKGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDEzMDEGA1UEAxMqRW50cnVzdC5u
- ZXQgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgKDIwNDgpMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
- MIIBCgKCAQEArU1LqRKGsuqjIAcVFmQqK0vRvwtKTY7tgHalZ7d4QMBzQshowNtTK91euHaYNZOL
- Gp18EzoOH1u3Hs/lJBQesYGpjX24zGtLA/ECDNyrpUAkAH90lKGdCCmziAv1h3edVc3kw37XamSr
- hRSGlVuXMlBvPci6Zgzj/L24ScF2iUkZ/cCovYmjZy/Gn7xxGWC4LeksyZB2ZnuU4q941mVTXTzW
- nLLPKQP5L6RQstRIzgUyVYr9smRMDuSYB3Xbf9+5CFVghTAp+XtIpGmG4zU/HoZdenoVve8AjhUi
- VBcAkCaTvA5JaJG/+EfTnZVCwQ5N328mz8MYIWJmQ3DW1cAH4QIDAQABo0IwQDAOBgNVHQ8BAf8E
- BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUVeSB0RGAvtiJuQijMfmhJAkWuXAwDQYJ
- KoZIhvcNAQEFBQADggEBADubj1abMOdTmXx6eadNl9cZlZD7Bh/KM3xGY4+WZiT6QBshJ8rmcnPy
- T/4xmf3IDExoU8aAghOY+rat2l098c5u9hURlIIM7j+VrxGrD9cv3h8Dj1csHsm7mhpElesYT6Yf
- zX1XEC+bBAlahLVu2B064dae0Wx5XnkcFMXj0EyTO2U87d89vqbllRrDtRnDvV5bu/8j72gZyxKT
- J1wDLW8w0B62GqzeWvfRqqgnpv55gcR5mTNXuhKwqeBCbJPKVt7+bYQLCIt+jerXmCHG8+c8eS9e
- nNFMFY3h7CI3zJpDC5fcgJCNs2ebb0gIFVbPv/ErfF6adulZkMV8gzURZVE=
- -----END CERTIFICATE-----
- Baltimore CyberTrust Root
- =========================
- -----BEGIN CERTIFICATE-----
- MIIDdzCCAl+gAwIBAgIEAgAAuTANBgkqhkiG9w0BAQUFADBaMQswCQYDVQQGEwJJRTESMBAGA1UE
- ChMJQmFsdGltb3JlMRMwEQYDVQQLEwpDeWJlclRydXN0MSIwIAYDVQQDExlCYWx0aW1vcmUgQ3li
- ZXJUcnVzdCBSb290MB4XDTAwMDUxMjE4NDYwMFoXDTI1MDUxMjIzNTkwMFowWjELMAkGA1UEBhMC
- SUUxEjAQBgNVBAoTCUJhbHRpbW9yZTETMBEGA1UECxMKQ3liZXJUcnVzdDEiMCAGA1UEAxMZQmFs
- dGltb3JlIEN5YmVyVHJ1c3QgUm9vdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKME
- uyKrmD1X6CZymrV51Cni4eiVgLGw41uOKymaZN+hXe2wCQVt2yguzmKiYv60iNoS6zjrIZ3AQSsB
- UnuId9Mcj8e6uYi1agnnc+gRQKfRzMpijS3ljwumUNKoUMMo6vWrJYeKmpYcqWe4PwzV9/lSEy/C
- G9VwcPCPwBLKBsua4dnKM3p31vjsufFoREJIE9LAwqSuXmD+tqYF/LTdB1kC1FkYmGP1pWPgkAx9
- XbIGevOF6uvUA65ehD5f/xXtabz5OTZydc93Uk3zyZAsuT3lySNTPx8kmCFcB5kpvcY67Oduhjpr
- l3RjM71oGDHweI12v/yejl0qhqdNkNwnGjkCAwEAAaNFMEMwHQYDVR0OBBYEFOWdWTCCR1jMrPoI
- VDaGezq1BE3wMBIGA1UdEwEB/wQIMAYBAf8CAQMwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEB
- BQUAA4IBAQCFDF2O5G9RaEIFoN27TyclhAO992T9Ldcw46QQF+vaKSm2eT929hkTI7gQCvlYpNRh
- cL0EYWoSihfVCr3FvDB81ukMJY2GQE/szKN+OMY3EU/t3WgxjkzSswF07r51XgdIGn9w/xZchMB5
- hbgF/X++ZRGjD8ACtPhSNzkE1akxehi/oCr0Epn3o0WC4zxe9Z2etciefC7IpJ5OCBRLbf1wbWsa
- Y71k5h+3zvDyny67G7fyUIhzksLi4xaNmjICq44Y3ekQEe5+NauQrz4wlHrQMz2nZQ/1/I6eYs9H
- RCwBXbsdtTLSR9I4LtD+gdwyah617jzV/OeBHRnDJELqYzmp
- -----END CERTIFICATE-----
- Entrust Root Certification Authority
- ====================================
- -----BEGIN CERTIFICATE-----
- MIIEkTCCA3mgAwIBAgIERWtQVDANBgkqhkiG9w0BAQUFADCBsDELMAkGA1UEBhMCVVMxFjAUBgNV
- BAoTDUVudHJ1c3QsIEluYy4xOTA3BgNVBAsTMHd3dy5lbnRydXN0Lm5ldC9DUFMgaXMgaW5jb3Jw
- b3JhdGVkIGJ5IHJlZmVyZW5jZTEfMB0GA1UECxMWKGMpIDIwMDYgRW50cnVzdCwgSW5jLjEtMCsG
- A1UEAxMkRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTA2MTEyNzIwMjM0
- MloXDTI2MTEyNzIwNTM0MlowgbAxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1FbnRydXN0LCBJbmMu
- MTkwNwYDVQQLEzB3d3cuZW50cnVzdC5uZXQvQ1BTIGlzIGluY29ycG9yYXRlZCBieSByZWZlcmVu
- Y2UxHzAdBgNVBAsTFihjKSAyMDA2IEVudHJ1c3QsIEluYy4xLTArBgNVBAMTJEVudHJ1c3QgUm9v
- dCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
- ALaVtkNC+sZtKm9I35RMOVcF7sN5EUFoNu3s/poBj6E4KPz3EEZmLk0eGrEaTsbRwJWIsMn/MYsz
- A9u3g3s+IIRe7bJWKKf44LlAcTfFy0cOlypowCKVYhXbR9n10Cv/gkvJrT7eTNuQgFA/CYqEAOww
- Cj0Yzfv9KlmaI5UXLEWeH25DeW0MXJj+SKfFI0dcXv1u5x609mhF0YaDW6KKjbHjKYD+JXGIrb68
- j6xSlkuqUY3kEzEZ6E5Nn9uss2rVvDlUccp6en+Q3X0dgNmBu1kmwhH+5pPi94DkZfs0Nw4pgHBN
- rziGLp5/V6+eF67rHMsoIV+2HNjnogQi+dPa2MsCAwEAAaOBsDCBrTAOBgNVHQ8BAf8EBAMCAQYw
- DwYDVR0TAQH/BAUwAwEB/zArBgNVHRAEJDAigA8yMDA2MTEyNzIwMjM0MlqBDzIwMjYxMTI3MjA1
- MzQyWjAfBgNVHSMEGDAWgBRokORnpKZTgMeGZqTx90tD+4S9bTAdBgNVHQ4EFgQUaJDkZ6SmU4DH
- hmak8fdLQ/uEvW0wHQYJKoZIhvZ9B0EABBAwDhsIVjcuMTo0LjADAgSQMA0GCSqGSIb3DQEBBQUA
- A4IBAQCT1DCw1wMgKtD5Y+iRDAUgqV8ZyntyTtSx29CW+1RaGSwMCPeyvIWonX9tO1KzKtvn1ISM
- Y/YPyyYBkVBs9F8U4pN0wBOeMDpQ47RgxRzwIkSNcUesyBrJ6ZuaAGAT/3B+XxFNSRuzFVJ7yVTa
- v52Vr2ua2J7p8eRDjeIRRDq/r72DQnNSi6q7pynP9WQcCk3RvKqsnyrQ/39/2n3qse0wJcGE2jTS
- W3iDVuycNsMm4hH2Z0kdkquM++v/eu6FSqdQgPCnXEqULl8FmTxSQeDNtGPPAUO6nIPcj2A781q0
- tHuu2guQOHXvgR1m0vdXcDazv/wor3ElhVsT/h5/WrQ8
- -----END CERTIFICATE-----
- Comodo AAA Services root
- ========================
- -----BEGIN CERTIFICATE-----
- MIIEMjCCAxqgAwIBAgIBATANBgkqhkiG9w0BAQUFADB7MQswCQYDVQQGEwJHQjEbMBkGA1UECAwS
- R3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHDAdTYWxmb3JkMRowGAYDVQQKDBFDb21vZG8gQ0Eg
- TGltaXRlZDEhMB8GA1UEAwwYQUFBIENlcnRpZmljYXRlIFNlcnZpY2VzMB4XDTA0MDEwMTAwMDAw
- MFoXDTI4MTIzMTIzNTk1OVowezELMAkGA1UEBhMCR0IxGzAZBgNVBAgMEkdyZWF0ZXIgTWFuY2hl
- c3RlcjEQMA4GA1UEBwwHU2FsZm9yZDEaMBgGA1UECgwRQ29tb2RvIENBIExpbWl0ZWQxITAfBgNV
- BAMMGEFBQSBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
- ggEBAL5AnfRu4ep2hxxNRUSOvkbIgwadwSr+GB+O5AL686tdUIoWMQuaBtDFcCLNSS1UY8y2bmhG
- C1Pqy0wkwLxyTurxFa70VJoSCsN6sjNg4tqJVfMiWPPe3M/vg4aijJRPn2jymJBGhCfHdr/jzDUs
- i14HZGWCwEiwqJH5YZ92IFCokcdmtet4YgNW8IoaE+oxox6gmf049vYnMlhvB/VruPsUK6+3qszW
- Y19zjNoFmag4qMsXeDZRrOme9Hg6jc8P2ULimAyrL58OAd7vn5lJ8S3frHRNG5i1R8XlKdH5kBjH
- Ypy+g8cmez6KJcfA3Z3mNWgQIJ2P2N7Sw4ScDV7oL8kCAwEAAaOBwDCBvTAdBgNVHQ4EFgQUoBEK
- Iz6W8Qfs4q8p74Klf9AwpLQwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wewYDVR0f
- BHQwcjA4oDagNIYyaHR0cDovL2NybC5jb21vZG9jYS5jb20vQUFBQ2VydGlmaWNhdGVTZXJ2aWNl
- cy5jcmwwNqA0oDKGMGh0dHA6Ly9jcmwuY29tb2RvLm5ldC9BQUFDZXJ0aWZpY2F0ZVNlcnZpY2Vz
- LmNybDANBgkqhkiG9w0BAQUFAAOCAQEACFb8AvCb6P+k+tZ7xkSAzk/ExfYAWMymtrwUSWgEdujm
- 7l3sAg9g1o1QGE8mTgHj5rCl7r+8dFRBv/38ErjHT1r0iWAFf2C3BUrz9vHCv8S5dIa2LX1rzNLz
- Rt0vxuBqw8M0Ayx9lt1awg6nCpnBBYurDC/zXDrPbDdVCYfeU0BsWO/8tqtlbgT2G9w84FoVxp7Z
- 8VlIMCFlA2zs6SFz7JsDoeA3raAVGI/6ugLOpyypEBMs1OUIJqsil2D4kF501KKaU73yqWjgom7C
- 12yxow+ev+to51byrvLjKzg6CYG1a4XXvi3tPxq3smPi9WIsgtRqAEFQ8TmDn5XpNpaYbg==
- -----END CERTIFICATE-----
- QuoVadis Root CA 2
- ==================
- -----BEGIN CERTIFICATE-----
- MIIFtzCCA5+gAwIBAgICBQkwDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCQk0xGTAXBgNVBAoT
- EFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMTElF1b1ZhZGlzIFJvb3QgQ0EgMjAeFw0wNjExMjQx
- ODI3MDBaFw0zMTExMjQxODIzMzNaMEUxCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBM
- aW1pdGVkMRswGQYDVQQDExJRdW9WYWRpcyBSb290IENBIDIwggIiMA0GCSqGSIb3DQEBAQUAA4IC
- DwAwggIKAoICAQCaGMpLlA0ALa8DKYrwD4HIrkwZhR0In6spRIXzL4GtMh6QRr+jhiYaHv5+HBg6
- XJxgFyo6dIMzMH1hVBHL7avg5tKifvVrbxi3Cgst/ek+7wrGsxDp3MJGF/hd/aTa/55JWpzmM+Yk
- lvc/ulsrHHo1wtZn/qtmUIttKGAr79dgw8eTvI02kfN/+NsRE8Scd3bBrrcCaoF6qUWD4gXmuVbB
- lDePSHFjIuwXZQeVikvfj8ZaCuWw419eaxGrDPmF60Tp+ARz8un+XJiM9XOva7R+zdRcAitMOeGy
- lZUtQofX1bOQQ7dsE/He3fbE+Ik/0XX1ksOR1YqI0JDs3G3eicJlcZaLDQP9nL9bFqyS2+r+eXyt
- 66/3FsvbzSUr5R/7mp/iUcw6UwxI5g69ybR2BlLmEROFcmMDBOAENisgGQLodKcftslWZvB1Jdxn
- wQ5hYIizPtGo/KPaHbDRsSNU30R2be1B2MGyIrZTHN81Hdyhdyox5C315eXbyOD/5YDXC2Og/zOh
- D7osFRXql7PSorW+8oyWHhqPHWykYTe5hnMz15eWniN9gqRMgeKh0bpnX5UHoycR7hYQe7xFSkyy
- BNKr79X9DFHOUGoIMfmR2gyPZFwDwzqLID9ujWc9Otb+fVuIyV77zGHcizN300QyNQliBJIWENie
- J0f7OyHj+OsdWwIDAQABo4GwMIGtMA8GA1UdEwEB/wQFMAMBAf8wCwYDVR0PBAQDAgEGMB0GA1Ud
- DgQWBBQahGK8SEwzJQTU7tD2A8QZRtGUazBuBgNVHSMEZzBlgBQahGK8SEwzJQTU7tD2A8QZRtGU
- a6FJpEcwRTELMAkGA1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMT
- ElF1b1ZhZGlzIFJvb3QgQ0EgMoICBQkwDQYJKoZIhvcNAQEFBQADggIBAD4KFk2fBluornFdLwUv
- Z+YTRYPENvbzwCYMDbVHZF34tHLJRqUDGCdViXh9duqWNIAXINzng/iN/Ae42l9NLmeyhP3ZRPx3
- UIHmfLTJDQtyU/h2BwdBR5YM++CCJpNVjP4iH2BlfF/nJrP3MpCYUNQ3cVX2kiF495V5+vgtJodm
- VjB3pjd4M1IQWK4/YY7yarHvGH5KWWPKjaJW1acvvFYfzznB4vsKqBUsfU16Y8Zsl0Q80m/DShcK
- +JDSV6IZUaUtl0HaB0+pUNqQjZRG4T7wlP0QADj1O+hA4bRuVhogzG9Yje0uRY/W6ZM/57Es3zrW
- IozchLsib9D45MY56QSIPMO661V6bYCZJPVsAfv4l7CUW+v90m/xd2gNNWQjrLhVoQPRTUIZ3Ph1
- WVaj+ahJefivDrkRoHy3au000LYmYjgahwz46P0u05B/B5EqHdZ+XIWDmbA4CD/pXvk1B+TJYm5X
- f6dQlfe6yJvmjqIBxdZmv3lh8zwc4bmCXF2gw+nYSL0ZohEUGW6yhhtoPkg3Goi3XZZenMfvJ2II
- 4pEZXNLxId26F0KCl3GBUzGpn/Z9Yr9y4aOTHcyKJloJONDO1w2AFrR4pTqHTI2KpdVGl/IsELm8
- VCLAAVBpQ570su9t+Oza8eOx79+Rj1QqCyXBJhnEUhAFZdWCEOrCMc0u
- -----END CERTIFICATE-----
- QuoVadis Root CA 3
- ==================
- -----BEGIN CERTIFICATE-----
- MIIGnTCCBIWgAwIBAgICBcYwDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCQk0xGTAXBgNVBAoT
- EFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMTElF1b1ZhZGlzIFJvb3QgQ0EgMzAeFw0wNjExMjQx
- OTExMjNaFw0zMTExMjQxOTA2NDRaMEUxCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBM
- aW1pdGVkMRswGQYDVQQDExJRdW9WYWRpcyBSb290IENBIDMwggIiMA0GCSqGSIb3DQEBAQUAA4IC
- DwAwggIKAoICAQDMV0IWVJzmmNPTTe7+7cefQzlKZbPoFog02w1ZkXTPkrgEQK0CSzGrvI2RaNgg
- DhoB4hp7Thdd4oq3P5kazethq8Jlph+3t723j/z9cI8LoGe+AaJZz3HmDyl2/7FWeUUrH556VOij
- KTVopAFPD6QuN+8bv+OPEKhyq1hX51SGyMnzW9os2l2ObjyjPtr7guXd8lyyBTNvijbO0BNO/79K
- DDRMpsMhvVAEVeuxu537RR5kFd5VAYwCdrXLoT9CabwvvWhDFlaJKjdhkf2mrk7AyxRllDdLkgbv
- BNDInIjbC3uBr7E9KsRlOni27tyAsdLTmZw67mtaa7ONt9XOnMK+pUsvFrGeaDsGb659n/je7Mwp
- p5ijJUMv7/FfJuGITfhebtfZFG4ZM2mnO4SJk8RTVROhUXhA+LjJou57ulJCg54U7QVSWllWp5f8
- nT8KKdjcT5EOE7zelaTfi5m+rJsziO+1ga8bxiJTyPbH7pcUsMV8eFLI8M5ud2CEpukqdiDtWAEX
- MJPpGovgc2PZapKUSU60rUqFxKMiMPwJ7Wgic6aIDFUhWMXhOp8q3crhkODZc6tsgLjoC2SToJyM
- Gf+z0gzskSaHirOi4XCPLArlzW1oUevaPwV/izLmE1xr/l9A4iLItLRkT9a6fUg+qGkM17uGcclz
- uD87nSVL2v9A6wIDAQABo4IBlTCCAZEwDwYDVR0TAQH/BAUwAwEB/zCB4QYDVR0gBIHZMIHWMIHT
- BgkrBgEEAb5YAAMwgcUwgZMGCCsGAQUFBwICMIGGGoGDQW55IHVzZSBvZiB0aGlzIENlcnRpZmlj
- YXRlIGNvbnN0aXR1dGVzIGFjY2VwdGFuY2Ugb2YgdGhlIFF1b1ZhZGlzIFJvb3QgQ0EgMyBDZXJ0
- aWZpY2F0ZSBQb2xpY3kgLyBDZXJ0aWZpY2F0aW9uIFByYWN0aWNlIFN0YXRlbWVudC4wLQYIKwYB
- BQUHAgEWIWh0dHA6Ly93d3cucXVvdmFkaXNnbG9iYWwuY29tL2NwczALBgNVHQ8EBAMCAQYwHQYD
- VR0OBBYEFPLAE+CCQz777i9nMpY1XNu4ywLQMG4GA1UdIwRnMGWAFPLAE+CCQz777i9nMpY1XNu4
- ywLQoUmkRzBFMQswCQYDVQQGEwJCTTEZMBcGA1UEChMQUXVvVmFkaXMgTGltaXRlZDEbMBkGA1UE
- AxMSUXVvVmFkaXMgUm9vdCBDQSAzggIFxjANBgkqhkiG9w0BAQUFAAOCAgEAT62gLEz6wPJv92ZV
- qyM07ucp2sNbtrCD2dDQ4iH782CnO11gUyeim/YIIirnv6By5ZwkajGxkHon24QRiSemd1o417+s
- hvzuXYO8BsbRd2sPbSQvS3pspweWyuOEn62Iix2rFo1bZhfZFvSLgNLd+LJ2w/w4E6oM3kJpK27z
- POuAJ9v1pkQNn1pVWQvVDVJIxa6f8i+AxeoyUDUSly7B4f/xI4hROJ/yZlZ25w9Rl6VSDE1JUZU2
- Pb+iSwwQHYaZTKrzchGT5Or2m9qoXadNt54CrnMAyNojA+j56hl0YgCUyyIgvpSnWbWCar6ZeXqp
- 8kokUvd0/bpO5qgdAm6xDYBEwa7TIzdfu4V8K5Iu6H6li92Z4b8nby1dqnuH/grdS/yO9SbkbnBC
- bjPsMZ57k8HkyWkaPcBrTiJt7qtYTcbQQcEr6k8Sh17rRdhs9ZgC06DYVYoGmRmioHfRMJ6szHXu
- g/WwYjnPbFfiTNKRCw51KBuav/0aQ/HKd/s7j2G4aSgWQgRecCocIdiP4b0jWy10QJLZYxkNc91p
- vGJHvOB0K7Lrfb5BG7XARsWhIstfTsEokt4YutUqKLsRixeTmJlglFwjz1onl14LBQaTNx47aTbr
- qZ5hHY8y2o4M1nQ+ewkk2gF3R8Q7zTSMmfXK4SVhM7JZG+Ju1zdXtg2pEto=
- -----END CERTIFICATE-----
- Security Communication Root CA
- ==============================
- -----BEGIN CERTIFICATE-----
- MIIDWjCCAkKgAwIBAgIBADANBgkqhkiG9w0BAQUFADBQMQswCQYDVQQGEwJKUDEYMBYGA1UEChMP
- U0VDT00gVHJ1c3QubmV0MScwJQYDVQQLEx5TZWN1cml0eSBDb21tdW5pY2F0aW9uIFJvb3RDQTEw
- HhcNMDMwOTMwMDQyMDQ5WhcNMjMwOTMwMDQyMDQ5WjBQMQswCQYDVQQGEwJKUDEYMBYGA1UEChMP
- U0VDT00gVHJ1c3QubmV0MScwJQYDVQQLEx5TZWN1cml0eSBDb21tdW5pY2F0aW9uIFJvb3RDQTEw
- ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCzs/5/022x7xZ8V6UMbXaKL0u/ZPtM7orw
- 8yl89f/uKuDp6bpbZCKamm8sOiZpUQWZJtzVHGpxxpp9Hp3dfGzGjGdnSj74cbAZJ6kJDKaVv0uM
- DPpVmDvY6CKhS3E4eayXkmmziX7qIWgGmBSWh9JhNrxtJ1aeV+7AwFb9Ms+k2Y7CI9eNqPPYJayX
- 5HA49LY6tJ07lyZDo6G8SVlyTCMwhwFY9k6+HGhWZq/NQV3Is00qVUarH9oe4kA92819uZKAnDfd
- DJZkndwi92SL32HeFZRSFaB9UslLqCHJxrHty8OVYNEP8Ktw+N/LTX7s1vqr2b1/VPKl6Xn62dZ2
- JChzAgMBAAGjPzA9MB0GA1UdDgQWBBSgc0mZaNyFW2XjmygvV5+9M7wHSDALBgNVHQ8EBAMCAQYw
- DwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQUFAAOCAQEAaECpqLvkT115swW1F7NgE+vGkl3g
- 0dNq/vu+m22/xwVtWSDEHPC32oRYAmP6SBbvT6UL90qY8j+eG61Ha2POCEfrUj94nK9NrvjVT8+a
- mCoQQTlSxN3Zmw7vkwGusi7KaEIkQmywszo+zenaSMQVy+n5Bw+SUEmK3TGXX8npN6o7WWWXlDLJ
- s58+OmJYxUmtYg5xpTKqL8aJdkNAExNnPaJUJRDL8Try2frbSVa7pv6nQTXD4IhhyYjH3zYQIphZ
- 6rBK+1YWc26sTfcioU+tHXotRSflMMFe8toTyyVCUZVHA4xsIcx0Qu1T/zOLjw9XARYvz6buyXAi
- FL39vmwLAw==
- -----END CERTIFICATE-----
- XRamp Global CA Root
- ====================
- -----BEGIN CERTIFICATE-----
- MIIEMDCCAxigAwIBAgIQUJRs7Bjq1ZxN1ZfvdY+grTANBgkqhkiG9w0BAQUFADCBgjELMAkGA1UE
- BhMCVVMxHjAcBgNVBAsTFXd3dy54cmFtcHNlY3VyaXR5LmNvbTEkMCIGA1UEChMbWFJhbXAgU2Vj
- dXJpdHkgU2VydmljZXMgSW5jMS0wKwYDVQQDEyRYUmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBB
- dXRob3JpdHkwHhcNMDQxMTAxMTcxNDA0WhcNMzUwMTAxMDUzNzE5WjCBgjELMAkGA1UEBhMCVVMx
- HjAcBgNVBAsTFXd3dy54cmFtcHNlY3VyaXR5LmNvbTEkMCIGA1UEChMbWFJhbXAgU2VjdXJpdHkg
- U2VydmljZXMgSW5jMS0wKwYDVQQDEyRYUmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBBdXRob3Jp
- dHkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCYJB69FbS638eMpSe2OAtp87ZOqCwu
- IR1cRN8hXX4jdP5efrRKt6atH67gBhbim1vZZ3RrXYCPKZ2GG9mcDZhtdhAoWORlsH9KmHmf4MMx
- foArtYzAQDsRhtDLooY2YKTVMIJt2W7QDxIEM5dfT2Fa8OT5kavnHTu86M/0ay00fOJIYRyO82FE
- zG+gSqmUsE3a56k0enI4qEHMPJQRfevIpoy3hsvKMzvZPTeL+3o+hiznc9cKV6xkmxnr9A8ECIqs
- AxcZZPRaJSKNNCyy9mgdEm3Tih4U2sSPpuIjhdV6Db1q4Ons7Be7QhtnqiXtRYMh/MHJfNViPvry
- xS3T/dRlAgMBAAGjgZ8wgZwwEwYJKwYBBAGCNxQCBAYeBABDAEEwCwYDVR0PBAQDAgGGMA8GA1Ud
- EwEB/wQFMAMBAf8wHQYDVR0OBBYEFMZPoj0GY4QJnM5i5ASsjVy16bYbMDYGA1UdHwQvMC0wK6Ap
- oCeGJWh0dHA6Ly9jcmwueHJhbXBzZWN1cml0eS5jb20vWEdDQS5jcmwwEAYJKwYBBAGCNxUBBAMC
- AQEwDQYJKoZIhvcNAQEFBQADggEBAJEVOQMBG2f7Shz5CmBbodpNl2L5JFMn14JkTpAuw0kbK5rc
- /Kh4ZzXxHfARvbdI4xD2Dd8/0sm2qlWkSLoC295ZLhVbO50WfUfXN+pfTXYSNrsf16GBBEYgoyxt
- qZ4Bfj8pzgCT3/3JknOJiWSe5yvkHJEs0rnOfc5vMZnT5r7SHpDwCRR5XCOrTdLaIR9NmXmd4c8n
- nxCbHIgNsIpkQTG4DmyQJKSbXHGPurt+HBvbaoAPIbzp26a3QPSyi6mx5O+aGtA9aZnuqCij4Tyz
- 8LIRnM98QObd50N9otg6tamN8jSZxNQQ4Qb9CYQQO+7ETPTsJ3xCwnR8gooJybQDJbw=
- -----END CERTIFICATE-----
- Go Daddy Class 2 CA
- ===================
- -----BEGIN CERTIFICATE-----
- MIIEADCCAuigAwIBAgIBADANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJVUzEhMB8GA1UEChMY
- VGhlIEdvIERhZGR5IEdyb3VwLCBJbmMuMTEwLwYDVQQLEyhHbyBEYWRkeSBDbGFzcyAyIENlcnRp
- ZmljYXRpb24gQXV0aG9yaXR5MB4XDTA0MDYyOTE3MDYyMFoXDTM0MDYyOTE3MDYyMFowYzELMAkG
- A1UEBhMCVVMxITAfBgNVBAoTGFRoZSBHbyBEYWRkeSBHcm91cCwgSW5jLjExMC8GA1UECxMoR28g
- RGFkZHkgQ2xhc3MgMiBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASAwDQYJKoZIhvcNAQEBBQAD
- ggENADCCAQgCggEBAN6d1+pXGEmhW+vXX0iG6r7d/+TvZxz0ZWizV3GgXne77ZtJ6XCAPVYYYwhv
- 2vLM0D9/AlQiVBDYsoHUwHU9S3/Hd8M+eKsaA7Ugay9qK7HFiH7Eux6wwdhFJ2+qN1j3hybX2C32
- qRe3H3I2TqYXP2WYktsqbl2i/ojgC95/5Y0V4evLOtXiEqITLdiOr18SPaAIBQi2XKVlOARFmR6j
- YGB0xUGlcmIbYsUfb18aQr4CUWWoriMYavx4A6lNf4DD+qta/KFApMoZFv6yyO9ecw3ud72a9nmY
- vLEHZ6IVDd2gWMZEewo+YihfukEHU1jPEX44dMX4/7VpkI+EdOqXG68CAQOjgcAwgb0wHQYDVR0O
- BBYEFNLEsNKR1EwRcbNhyz2h/t2oatTjMIGNBgNVHSMEgYUwgYKAFNLEsNKR1EwRcbNhyz2h/t2o
- atTjoWekZTBjMQswCQYDVQQGEwJVUzEhMB8GA1UEChMYVGhlIEdvIERhZGR5IEdyb3VwLCBJbmMu
- MTEwLwYDVQQLEyhHbyBEYWRkeSBDbGFzcyAyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5ggEAMAwG
- A1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBADJL87LKPpH8EsahB4yOd6AzBhRckB4Y9wim
- PQoZ+YeAEW5p5JYXMP80kWNyOO7MHAGjHZQopDH2esRU1/blMVgDoszOYtuURXO1v0XJJLXVggKt
- I3lpjbi2Tc7PTMozI+gciKqdi0FuFskg5YmezTvacPd+mSYgFFQlq25zheabIZ0KbIIOqPjCDPoQ
- HmyW74cNxA9hi63ugyuV+I6ShHI56yDqg+2DzZduCLzrTia2cyvk0/ZM/iZx4mERdEr/VxqHD3VI
- Ls9RaRegAhJhldXRQLIQTO7ErBBDpqWeCtWVYpoNz4iCxTIM5CufReYNnyicsbkqWletNw+vHX/b
- vZ8=
- -----END CERTIFICATE-----
- Starfield Class 2 CA
- ====================
- -----BEGIN CERTIFICATE-----
- MIIEDzCCAvegAwIBAgIBADANBgkqhkiG9w0BAQUFADBoMQswCQYDVQQGEwJVUzElMCMGA1UEChMc
- U3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAGA1UECxMpU3RhcmZpZWxkIENsYXNzIDIg
- Q2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDQwNjI5MTczOTE2WhcNMzQwNjI5MTczOTE2WjBo
- MQswCQYDVQQGEwJVUzElMCMGA1UEChMcU3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAG
- A1UECxMpU3RhcmZpZWxkIENsYXNzIDIgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggEgMA0GCSqG
- SIb3DQEBAQUAA4IBDQAwggEIAoIBAQC3Msj+6XGmBIWtDBFk385N78gDGIc/oav7PKaf8MOh2tTY
- bitTkPskpD6E8J7oX+zlJ0T1KKY/e97gKvDIr1MvnsoFAZMej2YcOadN+lq2cwQlZut3f+dZxkqZ
- JRRU6ybH838Z1TBwj6+wRir/resp7defqgSHo9T5iaU0X9tDkYI22WY8sbi5gv2cOj4QyDvvBmVm
- epsZGD3/cVE8MC5fvj13c7JdBmzDI1aaK4UmkhynArPkPw2vCHmCuDY96pzTNbO8acr1zJ3o/WSN
- F4Azbl5KXZnJHoe0nRrA1W4TNSNe35tfPe/W93bC6j67eA0cQmdrBNj41tpvi/JEoAGrAgEDo4HF
- MIHCMB0GA1UdDgQWBBS/X7fRzt0fhvRbVazc1xDCDqmI5zCBkgYDVR0jBIGKMIGHgBS/X7fRzt0f
- hvRbVazc1xDCDqmI56FspGowaDELMAkGA1UEBhMCVVMxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNo
- bm9sb2dpZXMsIEluYy4xMjAwBgNVBAsTKVN0YXJmaWVsZCBDbGFzcyAyIENlcnRpZmljYXRpb24g
- QXV0aG9yaXR5ggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAAWdP4id0ckaVaGs
- afPzWdqbAYcaT1epoXkJKtv3L7IezMdeatiDh6GX70k1PncGQVhiv45YuApnP+yz3SFmH8lU+nLM
- PUxA2IGvd56Deruix/U0F47ZEUD0/CwqTRV/p2JdLiXTAAsgGh1o+Re49L2L7ShZ3U0WixeDyLJl
- xy16paq8U4Zt3VekyvggQQto8PT7dL5WXXp59fkdheMtlb71cZBDzI0fmgAKhynpVSJYACPq4xJD
- KVtHCN2MQWplBqjlIapBtJUhlbl90TSrE9atvNziPTnNvT51cKEYWQPJIrSPnNVeKtelttQKbfi3
- QBFGmh95DmK/D5fs4C8fF5Q=
- -----END CERTIFICATE-----
- DigiCert Assured ID Root CA
- ===========================
- -----BEGIN CERTIFICATE-----
- MIIDtzCCAp+gAwIBAgIQDOfg5RfYRv6P5WD8G/AwOTANBgkqhkiG9w0BAQUFADBlMQswCQYDVQQG
- EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSQw
- IgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgQ0EwHhcNMDYxMTEwMDAwMDAwWhcNMzEx
- MTEwMDAwMDAwWjBlMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQL
- ExB3d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgQ0Ew
- ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCtDhXO5EOAXLGH87dg+XESpa7cJpSIqvTO
- 9SA5KFhgDPiA2qkVlTJhPLWxKISKityfCgyDF3qPkKyK53lTXDGEKvYPmDI2dsze3Tyoou9q+yHy
- UmHfnyDXH+Kx2f4YZNISW1/5WBg1vEfNoTb5a3/UsDg+wRvDjDPZ2C8Y/igPs6eD1sNuRMBhNZYW
- /lmci3Zt1/GiSw0r/wty2p5g0I6QNcZ4VYcgoc/lbQrISXwxmDNsIumH0DJaoroTghHtORedmTpy
- oeb6pNnVFzF1roV9Iq4/AUaG9ih5yLHa5FcXxH4cDrC0kqZWs72yl+2qp/C3xag/lRbQ/6GW6whf
- GHdPAgMBAAGjYzBhMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRF
- 66Kv9JLLgjEtUYunpyGd823IDzAfBgNVHSMEGDAWgBRF66Kv9JLLgjEtUYunpyGd823IDzANBgkq
- hkiG9w0BAQUFAAOCAQEAog683+Lt8ONyc3pklL/3cmbYMuRCdWKuh+vy1dneVrOfzM4UKLkNl2Bc
- EkxY5NM9g0lFWJc1aRqoR+pWxnmrEthngYTffwk8lOa4JiwgvT2zKIn3X/8i4peEH+ll74fg38Fn
- SbNd67IJKusm7Xi+fT8r87cmNW1fiQG2SVufAQWbqz0lwcy2f8Lxb4bG+mRo64EtlOtCt/qMHt1i
- 8b5QZ7dsvfPxH2sMNgcWfzd8qVttevESRmCD1ycEvkvOl77DZypoEd+A5wwzZr8TDRRu838fYxAe
- +o0bJW1sj6W3YQGx0qMmoRBxna3iw/nDmVG3KwcIzi7mULKn+gpFL6Lw8g==
- -----END CERTIFICATE-----
- DigiCert Global Root CA
- =======================
- -----BEGIN CERTIFICATE-----
- MIIDrzCCApegAwIBAgIQCDvgVpBCRrGhdWrJWZHHSjANBgkqhkiG9w0BAQUFADBhMQswCQYDVQQG
- EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSAw
- HgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBDQTAeFw0wNjExMTAwMDAwMDBaFw0zMTExMTAw
- MDAwMDBaMGExCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3
- dy5kaWdpY2VydC5jb20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IENBMIIBIjANBgkq
- hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4jvhEXLeqKTTo1eqUKKPC3eQyaKl7hLOllsBCSDMAZOn
- TjC3U/dDxGkAV53ijSLdhwZAAIEJzs4bg7/fzTtxRuLWZscFs3YnFo97nh6Vfe63SKMI2tavegw5
- BmV/Sl0fvBf4q77uKNd0f3p4mVmFaG5cIzJLv07A6Fpt43C/dxC//AH2hdmoRBBYMql1GNXRor5H
- 4idq9Joz+EkIYIvUX7Q6hL+hqkpMfT7PT19sdl6gSzeRntwi5m3OFBqOasv+zbMUZBfHWymeMr/y
- 7vrTC0LUq7dBMtoM1O/4gdW7jVg/tRvoSSiicNoxBN33shbyTApOB6jtSj1etX+jkMOvJwIDAQAB
- o2MwYTAOBgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUA95QNVbRTLtm
- 8KPiGxvDl7I90VUwHwYDVR0jBBgwFoAUA95QNVbRTLtm8KPiGxvDl7I90VUwDQYJKoZIhvcNAQEF
- BQADggEBAMucN6pIExIK+t1EnE9SsPTfrgT1eXkIoyQY/EsrhMAtudXH/vTBH1jLuG2cenTnmCmr
- EbXjcKChzUyImZOMkXDiqw8cvpOp/2PV5Adg06O/nVsJ8dWO41P0jmP6P6fbtGbfYmbW0W5BjfIt
- tep3Sp+dWOIrWcBAI+0tKIJFPnlUkiaY4IBIqDfv8NZ5YBberOgOzW6sRBc4L0na4UU+Krk2U886
- UAb3LujEV0lsYSEY1QSteDwsOoBrp+uvFRTp2InBuThs4pFsiv9kuXclVzDAGySj4dzp30d8tbQk
- CAUw7C29C79Fv1C5qfPrmAESrciIxpg0X40KPMbp1ZWVbd4=
- -----END CERTIFICATE-----
- DigiCert High Assurance EV Root CA
- ==================================
- -----BEGIN CERTIFICATE-----
- MIIDxTCCAq2gAwIBAgIQAqxcJmoLQJuPC3nyrkYldzANBgkqhkiG9w0BAQUFADBsMQswCQYDVQQG
- EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSsw
- KQYDVQQDEyJEaWdpQ2VydCBIaWdoIEFzc3VyYW5jZSBFViBSb290IENBMB4XDTA2MTExMDAwMDAw
- MFoXDTMxMTExMDAwMDAwMFowbDELMAkGA1UEBhMCVVMxFTATBgNVBAoTDERpZ2lDZXJ0IEluYzEZ
- MBcGA1UECxMQd3d3LmRpZ2ljZXJ0LmNvbTErMCkGA1UEAxMiRGlnaUNlcnQgSGlnaCBBc3N1cmFu
- Y2UgRVYgUm9vdCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMbM5XPm+9S75S0t
- Mqbf5YE/yc0lSbZxKsPVlDRnogocsF9ppkCxxLeyj9CYpKlBWTrT3JTWPNt0OKRKzE0lgvdKpVMS
- OO7zSW1xkX5jtqumX8OkhPhPYlG++MXs2ziS4wblCJEMxChBVfvLWokVfnHoNb9Ncgk9vjo4UFt3
- MRuNs8ckRZqnrG0AFFoEt7oT61EKmEFBIk5lYYeBQVCmeVyJ3hlKV9Uu5l0cUyx+mM0aBhakaHPQ
- NAQTXKFx01p8VdteZOE3hzBWBOURtCmAEvF5OYiiAhF8J2a3iLd48soKqDirCmTCv2ZdlYTBoSUe
- h10aUAsgEsxBu24LUTi4S8sCAwEAAaNjMGEwDgYDVR0PAQH/BAQDAgGGMA8GA1UdEwEB/wQFMAMB
- Af8wHQYDVR0OBBYEFLE+w2kD+L9HAdSYJhoIAu9jZCvDMB8GA1UdIwQYMBaAFLE+w2kD+L9HAdSY
- JhoIAu9jZCvDMA0GCSqGSIb3DQEBBQUAA4IBAQAcGgaX3NecnzyIZgYIVyHbIUf4KmeqvxgydkAQ
- V8GK83rZEWWONfqe/EW1ntlMMUu4kehDLI6zeM7b41N5cdblIZQB2lWHmiRk9opmzN6cN82oNLFp
- myPInngiK3BD41VHMWEZ71jFhS9OMPagMRYjyOfiZRYzy78aG6A9+MpeizGLYAiJLQwGXFK3xPkK
- mNEVX58Svnw2Yzi9RKR/5CYrCsSXaQ3pjOLAEFe4yHYSkVXySGnYvCoCWw9E1CAx2/S6cCZdkGCe
- vEsXCS+0yx5DaMkHJ8HSXPfqIbloEpw8nL+e/IBcm2PN7EeqJSdnoDfzAIJ9VNep+OkuE6N36B9K
- -----END CERTIFICATE-----
- SwissSign Gold CA - G2
- ======================
- -----BEGIN CERTIFICATE-----
- MIIFujCCA6KgAwIBAgIJALtAHEP1Xk+wMA0GCSqGSIb3DQEBBQUAMEUxCzAJBgNVBAYTAkNIMRUw
- EwYDVQQKEwxTd2lzc1NpZ24gQUcxHzAdBgNVBAMTFlN3aXNzU2lnbiBHb2xkIENBIC0gRzIwHhcN
- MDYxMDI1MDgzMDM1WhcNMzYxMDI1MDgzMDM1WjBFMQswCQYDVQQGEwJDSDEVMBMGA1UEChMMU3dp
- c3NTaWduIEFHMR8wHQYDVQQDExZTd2lzc1NpZ24gR29sZCBDQSAtIEcyMIICIjANBgkqhkiG9w0B
- AQEFAAOCAg8AMIICCgKCAgEAr+TufoskDhJuqVAtFkQ7kpJcyrhdhJJCEyq8ZVeCQD5XJM1QiyUq
- t2/876LQwB8CJEoTlo8jE+YoWACjR8cGp4QjK7u9lit/VcyLwVcfDmJlD909Vopz2q5+bbqBHH5C
- jCA12UNNhPqE21Is8w4ndwtrvxEvcnifLtg+5hg3Wipy+dpikJKVyh+c6bM8K8vzARO/Ws/BtQpg
- vd21mWRTuKCWs2/iJneRjOBiEAKfNA+k1ZIzUd6+jbqEemA8atufK+ze3gE/bk3lUIbLtK/tREDF
- ylqM2tIrfKjuvqblCqoOpd8FUrdVxyJdMmqXl2MT28nbeTZ7hTpKxVKJ+STnnXepgv9VHKVxaSvR
- AiTysybUa9oEVeXBCsdtMDeQKuSeFDNeFhdVxVu1yzSJkvGdJo+hB9TGsnhQ2wwMC3wLjEHXuend
- jIj3o02yMszYF9rNt85mndT9Xv+9lz4pded+p2JYryU0pUHHPbwNUMoDAw8IWh+Vc3hiv69yFGkO
- peUDDniOJihC8AcLYiAQZzlG+qkDzAQ4embvIIO1jEpWjpEA/I5cgt6IoMPiaG59je883WX0XaxR
- 7ySArqpWl2/5rX3aYT+YdzylkbYcjCbaZaIJbcHiVOO5ykxMgI93e2CaHt+28kgeDrpOVG2Y4OGi
- GqJ3UM/EY5LsRxmd6+ZrzsECAwEAAaOBrDCBqTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUw
- AwEB/zAdBgNVHQ4EFgQUWyV7lqRlUX64OfPAeGZe6Drn8O4wHwYDVR0jBBgwFoAUWyV7lqRlUX64
- OfPAeGZe6Drn8O4wRgYDVR0gBD8wPTA7BglghXQBWQECAQEwLjAsBggrBgEFBQcCARYgaHR0cDov
- L3JlcG9zaXRvcnkuc3dpc3NzaWduLmNvbS8wDQYJKoZIhvcNAQEFBQADggIBACe645R88a7A3hfm
- 5djV9VSwg/S7zV4Fe0+fdWavPOhWfvxyeDgD2StiGwC5+OlgzczOUYrHUDFu4Up+GC9pWbY9ZIEr
- 44OE5iKHjn3g7gKZYbge9LgriBIWhMIxkziWMaa5O1M/wySTVltpkuzFwbs4AOPsF6m43Md8AYOf
- Mke6UiI0HTJ6CVanfCU2qT1L2sCCbwq7EsiHSycR+R4tx5M/nttfJmtS2S6K8RTGRI0Vqbe/vd6m
- Gu6uLftIdxf+u+yvGPUqUfA5hJeVbG4bwyvEdGB5JbAKJ9/fXtI5z0V9QkvfsywexcZdylU6oJxp
- mo/a77KwPJ+HbBIrZXAVUjEaJM9vMSNQH4xPjyPDdEFjHFWoFN0+4FFQz/EbMFYOkrCChdiDyyJk
- vC24JdVUorgG6q2SpCSgwYa1ShNqR88uC1aVVMvOmttqtKay20EIhid392qgQmwLOM7XdVAyksLf
- KzAiSNDVQTglXaTpXZ/GlHXQRf0wl0OPkKsKx4ZzYEppLd6leNcG2mqeSz53OiATIgHQv2ieY2Br
- NU0LbbqhPcCT4H8js1WtciVORvnSFu+wZMEBnunKoGqYDs/YYPIvSbjkQuE4NRb0yG5P94FW6Lqj
- viOvrv1vA+ACOzB2+httQc8Bsem4yWb02ybzOqR08kkkW8mw0FfB+j564ZfJ
- -----END CERTIFICATE-----
- SwissSign Silver CA - G2
- ========================
- -----BEGIN CERTIFICATE-----
- MIIFvTCCA6WgAwIBAgIITxvUL1S7L0swDQYJKoZIhvcNAQEFBQAwRzELMAkGA1UEBhMCQ0gxFTAT
- BgNVBAoTDFN3aXNzU2lnbiBBRzEhMB8GA1UEAxMYU3dpc3NTaWduIFNpbHZlciBDQSAtIEcyMB4X
- DTA2MTAyNTA4MzI0NloXDTM2MTAyNTA4MzI0NlowRzELMAkGA1UEBhMCQ0gxFTATBgNVBAoTDFN3
- aXNzU2lnbiBBRzEhMB8GA1UEAxMYU3dpc3NTaWduIFNpbHZlciBDQSAtIEcyMIICIjANBgkqhkiG
- 9w0BAQEFAAOCAg8AMIICCgKCAgEAxPGHf9N4Mfc4yfjDmUO8x/e8N+dOcbpLj6VzHVxumK4DV644
- N0MvFz0fyM5oEMF4rhkDKxD6LHmD9ui5aLlV8gREpzn5/ASLHvGiTSf5YXu6t+WiE7brYT7QbNHm
- +/pe7R20nqA1W6GSy/BJkv6FCgU+5tkL4k+73JU3/JHpMjUi0R86TieFnbAVlDLaYQ1HTWBCrpJH
- 6INaUFjpiou5XaHc3ZlKHzZnu0jkg7Y360g6rw9njxcH6ATK72oxh9TAtvmUcXtnZLi2kUpCe2Uu
- MGoM9ZDulebyzYLs2aFK7PayS+VFheZteJMELpyCbTapxDFkH4aDCyr0NQp4yVXPQbBH6TCfmb5h
- qAaEuSh6XzjZG6k4sIN/c8HDO0gqgg8hm7jMqDXDhBuDsz6+pJVpATqJAHgE2cn0mRmrVn5bi4Y5
- FZGkECwJMoBgs5PAKrYYC51+jUnyEEp/+dVGLxmSo5mnJqy7jDzmDrxHB9xzUfFwZC8I+bRHHTBs
- ROopN4WSaGa8gzj+ezku01DwH/teYLappvonQfGbGHLy9YR0SslnxFSuSGTfjNFusB3hB48IHpmc
- celM2KX3RxIfdNFRnobzwqIjQAtz20um53MGjMGg6cFZrEb65i/4z3GcRm25xBWNOHkDRUjvxF3X
- CO6HOSKGsg0PWEP3calILv3q1h8CAwEAAaOBrDCBqTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/
- BAUwAwEB/zAdBgNVHQ4EFgQUF6DNweRBtjpbO8tFnb0cwpj6hlgwHwYDVR0jBBgwFoAUF6DNweRB
- tjpbO8tFnb0cwpj6hlgwRgYDVR0gBD8wPTA7BglghXQBWQEDAQEwLjAsBggrBgEFBQcCARYgaHR0
- cDovL3JlcG9zaXRvcnkuc3dpc3NzaWduLmNvbS8wDQYJKoZIhvcNAQEFBQADggIBAHPGgeAn0i0P
- 4JUw4ppBf1AsX19iYamGamkYDHRJ1l2E6kFSGG9YrVBWIGrGvShpWJHckRE1qTodvBqlYJ7YH39F
- kWnZfrt4csEGDyrOj4VwYaygzQu4OSlWhDJOhrs9xCrZ1x9y7v5RoSJBsXECYxqCsGKrXlcSH9/L
- 3XWgwF15kIwb4FDm3jH+mHtwX6WQ2K34ArZv02DdQEsixT2tOnqfGhpHkXkzuoLcMmkDlm4fS/Bx
- /uNncqCxv1yL5PqZIseEuRuNI5c/7SXgz2W79WEE790eslpBIlqhn10s6FvJbakMDHiqYMZWjwFa
- DGi8aRl5xB9+lwW/xekkUV7U1UtT7dkjWjYDZaPBA61BMPNGG4WQr2W11bHkFlt4dR2Xem1ZqSqP
- e97Dh4kQmUlzeMg9vVE1dCrV8X5pGyq7O70luJpaPXJhkGaH7gzWTdQRdAtq/gsD/KNVV4n+Ssuu
- WxcFyPKNIzFTONItaj+CuY0IavdeQXRuwxF+B6wpYJE/OMpXEA29MC/HpeZBoNquBYeaoKRlbEwJ
- DIm6uNO5wJOKMPqN5ZprFQFOZ6raYlY+hAhm0sQ2fac+EPyI4NSA5QC9qvNOBqN6avlicuMJT+ub
- DgEj8Z+7fNzcbBGXJbLytGMU0gYqZ4yD9c7qB9iaah7s5Aq7KkzrCWA5zspi2C5u
- -----END CERTIFICATE-----
- SecureTrust CA
- ==============
- -----BEGIN CERTIFICATE-----
- MIIDuDCCAqCgAwIBAgIQDPCOXAgWpa1Cf/DrJxhZ0DANBgkqhkiG9w0BAQUFADBIMQswCQYDVQQG
- EwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xFzAVBgNVBAMTDlNlY3VyZVRy
- dXN0IENBMB4XDTA2MTEwNzE5MzExOFoXDTI5MTIzMTE5NDA1NVowSDELMAkGA1UEBhMCVVMxIDAe
- BgNVBAoTF1NlY3VyZVRydXN0IENvcnBvcmF0aW9uMRcwFQYDVQQDEw5TZWN1cmVUcnVzdCBDQTCC
- ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKukgeWVzfX2FI7CT8rU4niVWJxB4Q2ZQCQX
- OZEzZum+4YOvYlyJ0fwkW2Gz4BERQRwdbvC4u/jep4G6pkjGnx29vo6pQT64lO0pGtSO0gMdA+9t
- DWccV9cGrcrI9f4Or2YlSASWC12juhbDCE/RRvgUXPLIXgGZbf2IzIaowW8xQmxSPmjL8xk037uH
- GFaAJsTQ3MBv396gwpEWoGQRS0S8Hvbn+mPeZqx2pHGj7DaUaHp3pLHnDi+BeuK1cobvomuL8A/b
- 01k/unK8RCSc43Oz969XL0Imnal0ugBS8kvNU3xHCzaFDmapCJcWNFfBZveA4+1wVMeT4C4oFVmH
- ursCAwEAAaOBnTCBmjATBgkrBgEEAYI3FAIEBh4EAEMAQTALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/
- BAUwAwEB/zAdBgNVHQ4EFgQUQjK2FvoE/f5dS3rD/fdMQB1aQ68wNAYDVR0fBC0wKzApoCegJYYj
- aHR0cDovL2NybC5zZWN1cmV0cnVzdC5jb20vU1RDQS5jcmwwEAYJKwYBBAGCNxUBBAMCAQAwDQYJ
- KoZIhvcNAQEFBQADggEBADDtT0rhWDpSclu1pqNlGKa7UTt36Z3q059c4EVlew3KW+JwULKUBRSu
- SceNQQcSc5R+DCMh/bwQf2AQWnL1mA6s7Ll/3XpvXdMc9P+IBWlCqQVxyLesJugutIxq/3HcuLHf
- mbx8IVQr5Fiiu1cprp6poxkmD5kuCLDv/WnPmRoJjeOnnyvJNjR7JLN4TJUXpAYmHrZkUjZfYGfZ
- nMUFdAvnZyPSCPyI6a6Lf+Ew9Dd+/cYy2i2eRDAwbO4H3tI0/NL/QPZL9GZGBlSm8jIKYyYwa5vR
- 3ItHuuG51WLQoqD0ZwV4KWMabwTW+MZMo5qxN7SN5ShLHZ4swrhovO0C7jE=
- -----END CERTIFICATE-----
- Secure Global CA
- ================
- -----BEGIN CERTIFICATE-----
- MIIDvDCCAqSgAwIBAgIQB1YipOjUiolN9BPI8PjqpTANBgkqhkiG9w0BAQUFADBKMQswCQYDVQQG
- EwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xGTAXBgNVBAMTEFNlY3VyZSBH
- bG9iYWwgQ0EwHhcNMDYxMTA3MTk0MjI4WhcNMjkxMjMxMTk1MjA2WjBKMQswCQYDVQQGEwJVUzEg
- MB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xGTAXBgNVBAMTEFNlY3VyZSBHbG9iYWwg
- Q0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCvNS7YrGxVaQZx5RNoJLNP2MwhR/jx
- YDiJiQPpvepeRlMJ3Fz1Wuj3RSoC6zFh1ykzTM7HfAo3fg+6MpjhHZevj8fcyTiW89sa/FHtaMbQ
- bqR8JNGuQsiWUGMu4P51/pinX0kuleM5M2SOHqRfkNJnPLLZ/kG5VacJjnIFHovdRIWCQtBJwB1g
- 8NEXLJXr9qXBkqPFwqcIYA1gBBCWeZ4WNOaptvolRTnIHmX5k/Wq8VLcmZg9pYYaDDUz+kulBAYV
- HDGA76oYa8J719rO+TMg1fW9ajMtgQT7sFzUnKPiXB3jqUJ1XnvUd+85VLrJChgbEplJL4hL/VBi
- 0XPnj3pDAgMBAAGjgZ0wgZowEwYJKwYBBAGCNxQCBAYeBABDAEEwCwYDVR0PBAQDAgGGMA8GA1Ud
- EwEB/wQFMAMBAf8wHQYDVR0OBBYEFK9EBMJBfkiD2045AuzshHrmzsmkMDQGA1UdHwQtMCswKaAn
- oCWGI2h0dHA6Ly9jcmwuc2VjdXJldHJ1c3QuY29tL1NHQ0EuY3JsMBAGCSsGAQQBgjcVAQQDAgEA
- MA0GCSqGSIb3DQEBBQUAA4IBAQBjGghAfaReUw132HquHw0LURYD7xh8yOOvaliTFGCRsoTciE6+
- OYo68+aCiV0BN7OrJKQVDpI1WkpEXk5X+nXOH0jOZvQ8QCaSmGwb7iRGDBezUqXbpZGRzzfTb+cn
- CDpOGR86p1hcF895P4vkp9MmI50mD1hp/Ed+stCNi5O/KU9DaXR2Z0vPB4zmAve14bRDtUstFJ/5
- 3CYNv6ZHdAbYiNE6KTCEztI5gGIbqMdXSbxqVVFnFUq+NQfk1XWYN3kwFNspnWzFacxHVaIw98xc
- f8LDmBxrThaA63p4ZUWiABqvDA1VZDRIuJK58bRQKfJPIx/abKwfROHdI3hRW8cW
- -----END CERTIFICATE-----
- COMODO Certification Authority
- ==============================
- -----BEGIN CERTIFICATE-----
- MIIEHTCCAwWgAwIBAgIQToEtioJl4AsC7j41AkblPTANBgkqhkiG9w0BAQUFADCBgTELMAkGA1UE
- BhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgG
- A1UEChMRQ09NT0RPIENBIExpbWl0ZWQxJzAlBgNVBAMTHkNPTU9ETyBDZXJ0aWZpY2F0aW9uIEF1
- dGhvcml0eTAeFw0wNjEyMDEwMDAwMDBaFw0yOTEyMzEyMzU5NTlaMIGBMQswCQYDVQQGEwJHQjEb
- MBkGA1UECBMSR3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHEwdTYWxmb3JkMRowGAYDVQQKExFD
- T01PRE8gQ0EgTGltaXRlZDEnMCUGA1UEAxMeQ09NT0RPIENlcnRpZmljYXRpb24gQXV0aG9yaXR5
- MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0ECLi3LjkRv3UcEbVASY06m/weaKXTuH
- +7uIzg3jLz8GlvCiKVCZrts7oVewdFFxze1CkU1B/qnI2GqGd0S7WWaXUF601CxwRM/aN5VCaTww
- xHGzUvAhTaHYujl8HJ6jJJ3ygxaYqhZ8Q5sVW7euNJH+1GImGEaaP+vB+fGQV+useg2L23IwambV
- 4EajcNxo2f8ESIl33rXp+2dtQem8Ob0y2WIC8bGoPW43nOIv4tOiJovGuFVDiOEjPqXSJDlqR6sA
- 1KGzqSX+DT+nHbrTUcELpNqsOO9VUCQFZUaTNE8tja3G1CEZ0o7KBWFxB3NH5YoZEr0ETc5OnKVI
- rLsm9wIDAQABo4GOMIGLMB0GA1UdDgQWBBQLWOWLxkwVN6RAqTCpIb5HNlpW/zAOBgNVHQ8BAf8E
- BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zBJBgNVHR8EQjBAMD6gPKA6hjhodHRwOi8vY3JsLmNvbW9k
- b2NhLmNvbS9DT01PRE9DZXJ0aWZpY2F0aW9uQXV0aG9yaXR5LmNybDANBgkqhkiG9w0BAQUFAAOC
- AQEAPpiem/Yb6dc5t3iuHXIYSdOH5EOC6z/JqvWote9VfCFSZfnVDeFs9D6Mk3ORLgLETgdxb8CP
- OGEIqB6BCsAvIC9Bi5HcSEW88cbeunZrM8gALTFGTO3nnc+IlP8zwFboJIYmuNg4ON8qa90SzMc/
- RxdMosIGlgnW2/4/PEZB31jiVg88O8EckzXZOFKs7sjsLjBOlDW0JB9LeGna8gI4zJVSk/BwJVmc
- IGfE7vmLV2H0knZ9P4SNVbfo5azV8fUZVqZa+5Acr5Pr5RzUZ5ddBA6+C4OmF4O5MBKgxTMVBbkN
- +8cFduPYSo38NBejxiEovjBFMR7HeL5YYTisO+IBZQ==
- -----END CERTIFICATE-----
- Network Solutions Certificate Authority
- =======================================
- -----BEGIN CERTIFICATE-----
- MIID5jCCAs6gAwIBAgIQV8szb8JcFuZHFhfjkDFo4DANBgkqhkiG9w0BAQUFADBiMQswCQYDVQQG
- EwJVUzEhMB8GA1UEChMYTmV0d29yayBTb2x1dGlvbnMgTC5MLkMuMTAwLgYDVQQDEydOZXR3b3Jr
- IFNvbHV0aW9ucyBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcNMDYxMjAxMDAwMDAwWhcNMjkxMjMx
- MjM1OTU5WjBiMQswCQYDVQQGEwJVUzEhMB8GA1UEChMYTmV0d29yayBTb2x1dGlvbnMgTC5MLkMu
- MTAwLgYDVQQDEydOZXR3b3JrIFNvbHV0aW9ucyBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwggEiMA0G
- CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDkvH6SMG3G2I4rC7xGzuAnlt7e+foS0zwzc7MEL7xx
- jOWftiJgPl9dzgn/ggwbmlFQGiaJ3dVhXRncEg8tCqJDXRfQNJIg6nPPOCwGJgl6cvf6UDL4wpPT
- aaIjzkGxzOTVHzbRijr4jGPiFFlp7Q3Tf2vouAPlT2rlmGNpSAW+Lv8ztumXWWn4Zxmuk2GWRBXT
- crA/vGp97Eh/jcOrqnErU2lBUzS1sLnFBgrEsEX1QV1uiUV7PTsmjHTC5dLRfbIR1PtYMiKagMnc
- /Qzpf14Dl847ABSHJ3A4qY5usyd2mFHgBeMhqxrVhSI8KbWaFsWAqPS7azCPL0YCorEMIuDTAgMB
- AAGjgZcwgZQwHQYDVR0OBBYEFCEwyfsA106Y2oeqKtCnLrFAMadMMA4GA1UdDwEB/wQEAwIBBjAP
- BgNVHRMBAf8EBTADAQH/MFIGA1UdHwRLMEkwR6BFoEOGQWh0dHA6Ly9jcmwubmV0c29sc3NsLmNv
- bS9OZXR3b3JrU29sdXRpb25zQ2VydGlmaWNhdGVBdXRob3JpdHkuY3JsMA0GCSqGSIb3DQEBBQUA
- A4IBAQC7rkvnt1frf6ott3NHhWrB5KUd5Oc86fRZZXe1eltajSU24HqXLjjAV2CDmAaDn7l2em5Q
- 4LqILPxFzBiwmZVRDuwduIj/h1AcgsLj4DKAv6ALR8jDMe+ZZzKATxcheQxpXN5eNK4CtSbqUN9/
- GGUsyfJj4akH/nxxH2szJGoeBfcFaMBqEssuXmHLrijTfsK0ZpEmXzwuJF/LWA/rKOyvEZbz3Htv
- wKeI8lN3s2Berq4o2jUsbzRF0ybh3uxbTydrFny9RAQYgrOJeRcQcT16ohZO9QHNpGxlaKFJdlxD
- ydi8NmdspZS11My5vWo1ViHe2MPr+8ukYEywVaCge1ey
- -----END CERTIFICATE-----
- COMODO ECC Certification Authority
- ==================================
- -----BEGIN CERTIFICATE-----
- MIICiTCCAg+gAwIBAgIQH0evqmIAcFBUTAGem2OZKjAKBggqhkjOPQQDAzCBhTELMAkGA1UEBhMC
- R0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UE
- ChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBFQ0MgQ2VydGlmaWNhdGlvbiBB
- dXRob3JpdHkwHhcNMDgwMzA2MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBhTELMAkGA1UEBhMCR0Ix
- GzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UEChMR
- Q09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBFQ0MgQ2VydGlmaWNhdGlvbiBBdXRo
- b3JpdHkwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQDR3svdcmCFYX7deSRFtSrYpn1PlILBs5BAH+X
- 4QokPB0BBO490o0JlwzgdeT6+3eKKvUDYEs2ixYjFq0JcfRK9ChQtP6IHG4/bC8vCVlbpVsLM5ni
- wz2J+Wos77LTBumjQjBAMB0GA1UdDgQWBBR1cacZSBm8nZ3qQUfflMRId5nTeTAOBgNVHQ8BAf8E
- BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNoADBlAjEA7wNbeqy3eApyt4jf/7VG
- FAkK+qDmfQjGGoe9GKhzvSbKYAydzpmfz1wPMOG+FDHqAjAU9JM8SaczepBGR7NjfRObTrdvGDeA
- U/7dIOA1mjbRxwG55tzd8/8dLDoWV9mSOdY=
- -----END CERTIFICATE-----
- Certigna
- ========
- -----BEGIN CERTIFICATE-----
- MIIDqDCCApCgAwIBAgIJAP7c4wEPyUj/MA0GCSqGSIb3DQEBBQUAMDQxCzAJBgNVBAYTAkZSMRIw
- EAYDVQQKDAlEaGlteW90aXMxETAPBgNVBAMMCENlcnRpZ25hMB4XDTA3MDYyOTE1MTMwNVoXDTI3
- MDYyOTE1MTMwNVowNDELMAkGA1UEBhMCRlIxEjAQBgNVBAoMCURoaW15b3RpczERMA8GA1UEAwwI
- Q2VydGlnbmEwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDIaPHJ1tazNHUmgh7stL7q
- XOEm7RFHYeGifBZ4QCHkYJ5ayGPhxLGWkv8YbWkj4Sti993iNi+RB7lIzw7sebYs5zRLcAglozyH
- GxnygQcPOJAZ0xH+hrTy0V4eHpbNgGzOOzGTtvKg0KmVEn2lmsxryIRWijOp5yIVUxbwzBfsV1/p
- ogqYCd7jX5xv3EjjhQsVWqa6n6xI4wmy9/Qy3l40vhx4XUJbzg4ij02Q130yGLMLLGq/jj8UEYkg
- DncUtT2UCIf3JR7VsmAA7G8qKCVuKj4YYxclPz5EIBb2JsglrgVKtOdjLPOMFlN+XPsRGgjBRmKf
- Irjxwo1p3Po6WAbfAgMBAAGjgbwwgbkwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUGu3+QTmQ
- tCRZvgHyUtVF9lo53BEwZAYDVR0jBF0wW4AUGu3+QTmQtCRZvgHyUtVF9lo53BGhOKQ2MDQxCzAJ
- BgNVBAYTAkZSMRIwEAYDVQQKDAlEaGlteW90aXMxETAPBgNVBAMMCENlcnRpZ25hggkA/tzjAQ/J
- SP8wDgYDVR0PAQH/BAQDAgEGMBEGCWCGSAGG+EIBAQQEAwIABzANBgkqhkiG9w0BAQUFAAOCAQEA
- hQMeknH2Qq/ho2Ge6/PAD/Kl1NqV5ta+aDY9fm4fTIrv0Q8hbV6lUmPOEvjvKtpv6zf+EwLHyzs+
- ImvaYS5/1HI93TDhHkxAGYwP15zRgzB7mFncfca5DClMoTOi62c6ZYTTluLtdkVwj7Ur3vkj1klu
- PBS1xp81HlDQwY9qcEQCYsuuHWhBp6pX6FOqB9IG9tUUBguRA3UsbHK1YZWaDYu5Def131TN3ubY
- 1gkIl2PlwS6wt0QmwCbAr1UwnjvVNioZBPRcHv/PLLf/0P2HQBHVESO7SMAhqaQoLf0V+LBOK/Qw
- WyH8EZE0vkHve52Xdf+XlcCWWC/qu0bXu+TZLg==
- -----END CERTIFICATE-----
- ePKI Root Certification Authority
- =================================
- -----BEGIN CERTIFICATE-----
- MIIFsDCCA5igAwIBAgIQFci9ZUdcr7iXAF7kBtK8nTANBgkqhkiG9w0BAQUFADBeMQswCQYDVQQG
- EwJUVzEjMCEGA1UECgwaQ2h1bmdod2EgVGVsZWNvbSBDby4sIEx0ZC4xKjAoBgNVBAsMIWVQS0kg
- Um9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNDEyMjAwMjMxMjdaFw0zNDEyMjAwMjMx
- MjdaMF4xCzAJBgNVBAYTAlRXMSMwIQYDVQQKDBpDaHVuZ2h3YSBUZWxlY29tIENvLiwgTHRkLjEq
- MCgGA1UECwwhZVBLSSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIICIjANBgkqhkiG9w0B
- AQEFAAOCAg8AMIICCgKCAgEA4SUP7o3biDN1Z82tH306Tm2d0y8U82N0ywEhajfqhFAHSyZbCUNs
- IZ5qyNUD9WBpj8zwIuQf5/dqIjG3LBXy4P4AakP/h2XGtRrBp0xtInAhijHyl3SJCRImHJ7K2RKi
- lTza6We/CKBk49ZCt0Xvl/T29de1ShUCWH2YWEtgvM3XDZoTM1PRYfl61dd4s5oz9wCGzh1NlDiv
- qOx4UXCKXBCDUSH3ET00hl7lSM2XgYI1TBnsZfZrxQWh7kcT1rMhJ5QQCtkkO7q+RBNGMD+XPNjX
- 12ruOzjjK9SXDrkb5wdJfzcq+Xd4z1TtW0ado4AOkUPB1ltfFLqfpo0kR0BZv3I4sjZsN/+Z0V0O
- WQqraffAsgRFelQArr5T9rXn4fg8ozHSqf4hUmTFpmfwdQcGlBSBVcYn5AGPF8Fqcde+S/uUWH1+
- ETOxQvdibBjWzwloPn9s9h6PYq2lY9sJpx8iQkEeb5mKPtf5P0B6ebClAZLSnT0IFaUQAS2zMnao
- lQ2zepr7BxB4EW/hj8e6DyUadCrlHJhBmd8hh+iVBmoKs2pHdmX2Os+PYhcZewoozRrSgx4hxyy/
- vv9haLdnG7t4TY3OZ+XkwY63I2binZB1NJipNiuKmpS5nezMirH4JYlcWrYvjB9teSSnUmjDhDXi
- Zo1jDiVN1Rmy5nk3pyKdVDECAwEAAaNqMGgwHQYDVR0OBBYEFB4M97Zn8uGSJglFwFU5Lnc/Qkqi
- MAwGA1UdEwQFMAMBAf8wOQYEZyoHAAQxMC8wLQIBADAJBgUrDgMCGgUAMAcGBWcqAwAABBRFsMLH
- ClZ87lt4DJX5GFPBphzYEDANBgkqhkiG9w0BAQUFAAOCAgEACbODU1kBPpVJufGBuvl2ICO1J2B0
- 1GqZNF5sAFPZn/KmsSQHRGoqxqWOeBLoR9lYGxMqXnmbnwoqZ6YlPwZpVnPDimZI+ymBV3QGypzq
- KOg4ZyYr8dW1P2WT+DZdjo2NQCCHGervJ8A9tDkPJXtoUHRVnAxZfVo9QZQlUgjgRywVMRnVvwdV
- xrsStZf0X4OFunHB2WyBEXYKCrC/gpf36j36+uwtqSiUO1bd0lEursC9CBWMd1I0ltabrNMdjmEP
- NXubrjlpC2JgQCA2j6/7Nu4tCEoduL+bXPjqpRugc6bY+G7gMwRfaKonh+3ZwZCc7b3jajWvY9+r
- GNm65ulK6lCKD2GTHuItGeIwlDWSXQ62B68ZgI9HkFFLLk3dheLSClIKF5r8GrBQAuUBo2M3IUxE
- xJtRmREOc5wGj1QupyheRDmHVi03vYVElOEMSyycw5KFNGHLD7ibSkNS/jQ6fbjpKdx2qcgw+BRx
- gMYeNkh0IkFch4LoGHGLQYlE535YW6i4jRPpp2zDR+2zGp1iro2C6pSe3VkQw63d4k3jMdXH7Ojy
- sP6SHhYKGvzZ8/gntsm+HbRsZJB/9OTEW9c3rkIO3aQab3yIVMUWbuF6aC74Or8NpDyJO3inTmOD
- BCEIZ43ygknQW/2xzQ+DhNQ+IIX3Sj0rnP0qCglN6oH4EZw=
- -----END CERTIFICATE-----
- certSIGN ROOT CA
- ================
- -----BEGIN CERTIFICATE-----
- MIIDODCCAiCgAwIBAgIGIAYFFnACMA0GCSqGSIb3DQEBBQUAMDsxCzAJBgNVBAYTAlJPMREwDwYD
- VQQKEwhjZXJ0U0lHTjEZMBcGA1UECxMQY2VydFNJR04gUk9PVCBDQTAeFw0wNjA3MDQxNzIwMDRa
- Fw0zMTA3MDQxNzIwMDRaMDsxCzAJBgNVBAYTAlJPMREwDwYDVQQKEwhjZXJ0U0lHTjEZMBcGA1UE
- CxMQY2VydFNJR04gUk9PVCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALczuX7I
- JUqOtdu0KBuqV5Do0SLTZLrTk+jUrIZhQGpgV2hUhE28alQCBf/fm5oqrl0Hj0rDKH/v+yv6efHH
- rfAQUySQi2bJqIirr1qjAOm+ukbuW3N7LBeCgV5iLKECZbO9xSsAfsT8AzNXDe3i+s5dRdY4zTW2
- ssHQnIFKquSyAVwdj1+ZxLGt24gh65AIgoDzMKND5pCCrlUoSe1b16kQOA7+j0xbm0bqQfWwCHTD
- 0IgztnzXdN/chNFDDnU5oSVAKOp4yw4sLjmdjItuFhwvJoIQ4uNllAoEwF73XVv4EOLQunpL+943
- AAAaWyjj0pxzPjKHmKHJUS/X3qwzs08CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8B
- Af8EBAMCAcYwHQYDVR0OBBYEFOCMm9slSbPxfIbWskKHC9BroNnkMA0GCSqGSIb3DQEBBQUAA4IB
- AQA+0hyJLjX8+HXd5n9liPRyTMks1zJO890ZeUe9jjtbkw9QSSQTaxQGcu8J06Gh40CEyecYMnQ8
- SG4Pn0vU9x7Tk4ZkVJdjclDVVc/6IJMCopvDI5NOFlV2oHB5bc0hH88vLbwZ44gx+FkagQnIl6Z0
- x2DEW8xXjrJ1/RsCCdtZb3KTafcxQdaIOL+Hsr0Wefmq5L6IJd1hJyMctTEHBDa0GpC9oHRxUIlt
- vBTjD4au8as+x6AJzKNI0eDbZOeStc+vckNwi/nDhDwTqn6Sm1dTk/pwwpEOMfmbZ13pljheX7Nz
- TogVZ96edhBiIL5VaZVDADlN9u6wWk5JRFRYX0KD
- -----END CERTIFICATE-----
- NetLock Arany (Class Gold) FÅ‘tanúsÃtvány
- ========================================
- -----BEGIN CERTIFICATE-----
- MIIEFTCCAv2gAwIBAgIGSUEs5AAQMA0GCSqGSIb3DQEBCwUAMIGnMQswCQYDVQQGEwJIVTERMA8G
- A1UEBwwIQnVkYXBlc3QxFTATBgNVBAoMDE5ldExvY2sgS2Z0LjE3MDUGA1UECwwuVGFuw7pzw610
- dsOhbnlraWFkw7NrIChDZXJ0aWZpY2F0aW9uIFNlcnZpY2VzKTE1MDMGA1UEAwwsTmV0TG9jayBB
- cmFueSAoQ2xhc3MgR29sZCkgRsWRdGFuw7pzw610dsOhbnkwHhcNMDgxMjExMTUwODIxWhcNMjgx
- MjA2MTUwODIxWjCBpzELMAkGA1UEBhMCSFUxETAPBgNVBAcMCEJ1ZGFwZXN0MRUwEwYDVQQKDAxO
- ZXRMb2NrIEtmdC4xNzA1BgNVBAsMLlRhbsO6c8OtdHbDoW55a2lhZMOzayAoQ2VydGlmaWNhdGlv
- biBTZXJ2aWNlcykxNTAzBgNVBAMMLE5ldExvY2sgQXJhbnkgKENsYXNzIEdvbGQpIEbFkXRhbsO6
- c8OtdHbDoW55MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxCRec75LbRTDofTjl5Bu
- 0jBFHjzuZ9lk4BqKf8owyoPjIMHj9DrTlF8afFttvzBPhCf2nx9JvMaZCpDyD/V/Q4Q3Y1GLeqVw
- /HpYzY6b7cNGbIRwXdrzAZAj/E4wqX7hJ2Pn7WQ8oLjJM2P+FpD/sLj916jAwJRDC7bVWaaeVtAk
- H3B5r9s5VA1lddkVQZQBr17s9o3x/61k/iCa11zr/qYfCGSji3ZVrR47KGAuhyXoqq8fxmRGILdw
- fzzeSNuWU7c5d+Qa4scWhHaXWy+7GRWF+GmF9ZmnqfI0p6m2pgP8b4Y9VHx2BJtr+UBdADTHLpl1
- neWIA6pN+APSQnbAGwIDAKiLo0UwQzASBgNVHRMBAf8ECDAGAQH/AgEEMA4GA1UdDwEB/wQEAwIB
- BjAdBgNVHQ4EFgQUzPpnk/C2uNClwB7zU/2MU9+D15YwDQYJKoZIhvcNAQELBQADggEBAKt/7hwW
- qZw8UQCgwBEIBaeZ5m8BiFRhbvG5GK1Krf6BQCOUL/t1fC8oS2IkgYIL9WHxHG64YTjrgfpioTta
- YtOUZcTh5m2C+C8lcLIhJsFyUR+MLMOEkMNaj7rP9KdlpeuY0fsFskZ1FSNqb4VjMIDw1Z4fKRzC
- bLBQWV2QWzuoDTDPv31/zvGdg73JRm4gpvlhUbohL3u+pRVjodSVh/GeufOJ8z2FuLjbvrW5Kfna
- NwUASZQDhETnv0Mxz3WLJdH0pmT1kvarBes96aULNmLazAZfNou2XjG4Kvte9nHfRCaexOYNkbQu
- dZWAUWpLMKawYqGT8ZvYzsRjdT9ZR7E=
- -----END CERTIFICATE-----
- Hongkong Post Root CA 1
- =======================
- -----BEGIN CERTIFICATE-----
- MIIDMDCCAhigAwIBAgICA+gwDQYJKoZIhvcNAQEFBQAwRzELMAkGA1UEBhMCSEsxFjAUBgNVBAoT
- DUhvbmdrb25nIFBvc3QxIDAeBgNVBAMTF0hvbmdrb25nIFBvc3QgUm9vdCBDQSAxMB4XDTAzMDUx
- NTA1MTMxNFoXDTIzMDUxNTA0NTIyOVowRzELMAkGA1UEBhMCSEsxFjAUBgNVBAoTDUhvbmdrb25n
- IFBvc3QxIDAeBgNVBAMTF0hvbmdrb25nIFBvc3QgUm9vdCBDQSAxMIIBIjANBgkqhkiG9w0BAQEF
- AAOCAQ8AMIIBCgKCAQEArP84tulmAknjorThkPlAj3n54r15/gK97iSSHSL22oVyaf7XPwnU3ZG1
- ApzQjVrhVcNQhrkpJsLj2aDxaQMoIIBFIi1WpztUlVYiWR8o3x8gPW2iNr4joLFutbEnPzlTCeqr
- auh0ssJlXI6/fMN4hM2eFvz1Lk8gKgifd/PFHsSaUmYeSF7jEAaPIpjhZY4bXSNmO7ilMlHIhqqh
- qZ5/dpTCpmy3QfDVyAY45tQM4vM7TG1QjMSDJ8EThFk9nnV0ttgCXjqQesBCNnLsak3c78QA3xMY
- V18meMjWCnl3v/evt3a5pQuEF10Q6m/hq5URX208o1xNg1vysxmKgIsLhwIDAQABoyYwJDASBgNV
- HRMBAf8ECDAGAQH/AgEDMA4GA1UdDwEB/wQEAwIBxjANBgkqhkiG9w0BAQUFAAOCAQEADkbVPK7i
- h9legYsCmEEIjEy82tvuJxuC52pF7BaLT4Wg87JwvVqWuspube5Gi27nKi6Wsxkz67SfqLI37pio
- l7Yutmcn1KZJ/RyTZXaeQi/cImyaT/JaFTmxcdcrUehtHJjA2Sr0oYJ71clBoiMBdDhViw+5Lmei
- IAQ32pwL0xch4I+XeTRvhEgCIDMb5jREn5Fw9IBehEPCKdJsEhTkYY2sEJCehFC78JZvRZ+K88ps
- T/oROhUVRsPNH4NbLUES7VBnQRM9IauUiqpOfMGx+6fWtScvl6tu4B3i0RwsH0Ti/L6RoZz71ilT
- c4afU9hDDl3WY4JxHYB0yvbiAmvZWg==
- -----END CERTIFICATE-----
- SecureSign RootCA11
- ===================
- -----BEGIN CERTIFICATE-----
- MIIDbTCCAlWgAwIBAgIBATANBgkqhkiG9w0BAQUFADBYMQswCQYDVQQGEwJKUDErMCkGA1UEChMi
- SmFwYW4gQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcywgSW5jLjEcMBoGA1UEAxMTU2VjdXJlU2lnbiBS
- b290Q0ExMTAeFw0wOTA0MDgwNDU2NDdaFw0yOTA0MDgwNDU2NDdaMFgxCzAJBgNVBAYTAkpQMSsw
- KQYDVQQKEyJKYXBhbiBDZXJ0aWZpY2F0aW9uIFNlcnZpY2VzLCBJbmMuMRwwGgYDVQQDExNTZWN1
- cmVTaWduIFJvb3RDQTExMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA/XeqpRyQBTvL
- TJszi1oURaTnkBbR31fSIRCkF/3frNYfp+TbfPfs37gD2pRY/V1yfIw/XwFndBWW4wI8h9uuywGO
- wvNmxoVF9ALGOrVisq/6nL+k5tSAMJjzDbaTj6nU2DbysPyKyiyhFTOVMdrAG/LuYpmGYz+/3ZMq
- g6h2uRMft85OQoWPIucuGvKVCbIFtUROd6EgvanyTgp9UK31BQ1FT0Zx/Sg+U/sE2C3XZR1KG/rP
- O7AxmjVuyIsG0wCR8pQIZUyxNAYAeoni8McDWc/V1uinMrPmmECGxc0nEovMe863ETxiYAcjPitA
- bpSACW22s293bzUIUPsCh8U+iQIDAQABo0IwQDAdBgNVHQ4EFgQUW/hNT7KlhtQ60vFjmqC+CfZX
- t94wDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAKCh
- OBZmLqdWHyGcBvod7bkixTgm2E5P7KN/ed5GIaGHd48HCJqypMWvDzKYC3xmKbabfSVSSUOrTC4r
- bnpwrxYO4wJs+0LmGJ1F2FXI6Dvd5+H0LgscNFxsWEr7jIhQX5Ucv+2rIrVls4W6ng+4reV6G4pQ
- Oh29Dbx7VFALuUKvVaAYga1lme++5Jy/xIWrQbJUb9wlze144o4MjQlJ3WN7WmmWAiGovVJZ6X01
- y8hSyn+B/tlr0/cR7SXf+Of5pPpyl4RTDaXQMhhRdlkUbA/r7F+AjHVDg8OFmP9Mni0N5HeDk061
- lgeLKBObjBmNQSdJQO7e5iNEOdyhIta6A/I=
- -----END CERTIFICATE-----
- Microsec e-Szigno Root CA 2009
- ==============================
- -----BEGIN CERTIFICATE-----
- MIIECjCCAvKgAwIBAgIJAMJ+QwRORz8ZMA0GCSqGSIb3DQEBCwUAMIGCMQswCQYDVQQGEwJIVTER
- MA8GA1UEBwwIQnVkYXBlc3QxFjAUBgNVBAoMDU1pY3Jvc2VjIEx0ZC4xJzAlBgNVBAMMHk1pY3Jv
- c2VjIGUtU3ppZ25vIFJvb3QgQ0EgMjAwOTEfMB0GCSqGSIb3DQEJARYQaW5mb0BlLXN6aWduby5o
- dTAeFw0wOTA2MTYxMTMwMThaFw0yOTEyMzAxMTMwMThaMIGCMQswCQYDVQQGEwJIVTERMA8GA1UE
- BwwIQnVkYXBlc3QxFjAUBgNVBAoMDU1pY3Jvc2VjIEx0ZC4xJzAlBgNVBAMMHk1pY3Jvc2VjIGUt
- U3ppZ25vIFJvb3QgQ0EgMjAwOTEfMB0GCSqGSIb3DQEJARYQaW5mb0BlLXN6aWduby5odTCCASIw
- DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOn4j/NjrdqG2KfgQvvPkd6mJviZpWNwrZuuyjNA
- fW2WbqEORO7hE52UQlKavXWFdCyoDh2Tthi3jCyoz/tccbna7P7ofo/kLx2yqHWH2Leh5TvPmUpG
- 0IMZfcChEhyVbUr02MelTTMuhTlAdX4UfIASmFDHQWe4oIBhVKZsTh/gnQ4H6cm6M+f+wFUoLAKA
- pxn1ntxVUwOXewdI/5n7N4okxFnMUBBjjqqpGrCEGob5X7uxUG6k0QrM1XF+H6cbfPVTbiJfyyvm
- 1HxdrtbCxkzlBQHZ7Vf8wSN5/PrIJIOV87VqUQHQd9bpEqH5GoP7ghu5sJf0dgYzQ0mg/wu1+rUC
- AwEAAaOBgDB+MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBTLD8bf
- QkPMPcu1SCOhGnqmKrs0aDAfBgNVHSMEGDAWgBTLD8bfQkPMPcu1SCOhGnqmKrs0aDAbBgNVHREE
- FDASgRBpbmZvQGUtc3ppZ25vLmh1MA0GCSqGSIb3DQEBCwUAA4IBAQDJ0Q5eLtXMs3w+y/w9/w0o
- lZMEyL/azXm4Q5DwpL7v8u8hmLzU1F0G9u5C7DBsoKqpyvGvivo/C3NqPuouQH4frlRheesuCDfX
- I/OMn74dseGkddug4lQUsbocKaQY9hK6ohQU4zE1yED/t+AFdlfBHFny+L/k7SViXITwfn4fs775
- tyERzAMBVnCnEJIeGzSBHq2cGsMEPO0CYdYeBvNfOofyK/FFh+U9rNHHV4S9a67c2Pm2G2JwCz02
- yULyMtd6YebS2z3PyKnJm9zbWETXbzivf3jTo60adbocwTZ8jx5tHMN1Rq41Bab2XD0h7lbwyYIi
- LXpUq3DDfSJlgnCW
- -----END CERTIFICATE-----
- GlobalSign Root CA - R3
- =======================
- -----BEGIN CERTIFICATE-----
- MIIDXzCCAkegAwIBAgILBAAAAAABIVhTCKIwDQYJKoZIhvcNAQELBQAwTDEgMB4GA1UECxMXR2xv
- YmFsU2lnbiBSb290IENBIC0gUjMxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkdsb2Jh
- bFNpZ24wHhcNMDkwMzE4MTAwMDAwWhcNMjkwMzE4MTAwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxT
- aWduIFJvb3QgQ0EgLSBSMzETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2ln
- bjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMwldpB5BngiFvXAg7aEyiie/QV2EcWt
- iHL8RgJDx7KKnQRfJMsuS+FggkbhUqsMgUdwbN1k0ev1LKMPgj0MK66X17YUhhB5uzsTgHeMCOFJ
- 0mpiLx9e+pZo34knlTifBtc+ycsmWQ1z3rDI6SYOgxXG71uL0gRgykmmKPZpO/bLyCiR5Z2KYVc3
- rHQU3HTgOu5yLy6c+9C7v/U9AOEGM+iCK65TpjoWc4zdQQ4gOsC0p6Hpsk+QLjJg6VfLuQSSaGjl
- OCZgdbKfd/+RFO+uIEn8rUAVSNECMWEZXriX7613t2Saer9fwRPvm2L7DWzgVGkWqQPabumDk3F2
- xmmFghcCAwEAAaNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYE
- FI/wS3+oLkUkrk1Q+mOai97i3Ru8MA0GCSqGSIb3DQEBCwUAA4IBAQBLQNvAUKr+yAzv95ZURUm7
- lgAJQayzE4aGKAczymvmdLm6AC2upArT9fHxD4q/c2dKg8dEe3jgr25sbwMpjjM5RcOO5LlXbKr8
- EpbsU8Yt5CRsuZRj+9xTaGdWPoO4zzUhw8lo/s7awlOqzJCK6fBdRoyV3XpYKBovHd7NADdBj+1E
- bddTKJd+82cEHhXXipa0095MJ6RMG3NzdvQXmcIfeg7jLQitChws/zyrVQ4PkX4268NXSb7hLi18
- YIvDQVETI53O9zJrlAGomecsMx86OyXShkDOOyyGeMlhLxS67ttVb9+E7gUJTb0o2HLO02JQZR7r
- kpeDMdmztcpHWD9f
- -----END CERTIFICATE-----
- Autoridad de Certificacion Firmaprofesional CIF A62634068
- =========================================================
- -----BEGIN CERTIFICATE-----
- MIIGFDCCA/ygAwIBAgIIU+w77vuySF8wDQYJKoZIhvcNAQEFBQAwUTELMAkGA1UEBhMCRVMxQjBA
- BgNVBAMMOUF1dG9yaWRhZCBkZSBDZXJ0aWZpY2FjaW9uIEZpcm1hcHJvZmVzaW9uYWwgQ0lGIEE2
- MjYzNDA2ODAeFw0wOTA1MjAwODM4MTVaFw0zMDEyMzEwODM4MTVaMFExCzAJBgNVBAYTAkVTMUIw
- QAYDVQQDDDlBdXRvcmlkYWQgZGUgQ2VydGlmaWNhY2lvbiBGaXJtYXByb2Zlc2lvbmFsIENJRiBB
- NjI2MzQwNjgwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDKlmuO6vj78aI14H9M2uDD
- Utd9thDIAl6zQyrET2qyyhxdKJp4ERppWVevtSBC5IsP5t9bpgOSL/UR5GLXMnE42QQMcas9UX4P
- B99jBVzpv5RvwSmCwLTaUbDBPLutN0pcyvFLNg4kq7/DhHf9qFD0sefGL9ItWY16Ck6WaVICqjaY
- 7Pz6FIMMNx/Jkjd/14Et5cS54D40/mf0PmbR0/RAz15iNA9wBj4gGFrO93IbJWyTdBSTo3OxDqqH
- ECNZXyAFGUftaI6SEspd/NYrspI8IM/hX68gvqB2f3bl7BqGYTM+53u0P6APjqK5am+5hyZvQWyI
- plD9amML9ZMWGxmPsu2bm8mQ9QEM3xk9Dz44I8kvjwzRAv4bVdZO0I08r0+k8/6vKtMFnXkIoctX
- MbScyJCyZ/QYFpM6/EfY0XiWMR+6KwxfXZmtY4laJCB22N/9q06mIqqdXuYnin1oKaPnirjaEbsX
- LZmdEyRG98Xi2J+Of8ePdG1asuhy9azuJBCtLxTa/y2aRnFHvkLfuwHb9H/TKI8xWVvTyQKmtFLK
- bpf7Q8UIJm+K9Lv9nyiqDdVF8xM6HdjAeI9BZzwelGSuewvF6NkBiDkal4ZkQdU7hwxu+g/GvUgU
- vzlN1J5Bto+WHWOWk9mVBngxaJ43BjuAiUVhOSPHG0SjFeUc+JIwuwIDAQABo4HvMIHsMBIGA1Ud
- EwEB/wQIMAYBAf8CAQEwDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBRlzeurNR4APn7VdMActHNH
- DhpkLzCBpgYDVR0gBIGeMIGbMIGYBgRVHSAAMIGPMC8GCCsGAQUFBwIBFiNodHRwOi8vd3d3LmZp
- cm1hcHJvZmVzaW9uYWwuY29tL2NwczBcBggrBgEFBQcCAjBQHk4AUABhAHMAZQBvACAAZABlACAA
- bABhACAAQgBvAG4AYQBuAG8AdgBhACAANAA3ACAAQgBhAHIAYwBlAGwAbwBuAGEAIAAwADgAMAAx
- ADcwDQYJKoZIhvcNAQEFBQADggIBABd9oPm03cXF661LJLWhAqvdpYhKsg9VSytXjDvlMd3+xDLx
- 51tkljYyGOylMnfX40S2wBEqgLk9am58m9Ot/MPWo+ZkKXzR4Tgegiv/J2Wv+xYVxC5xhOW1//qk
- R71kMrv2JYSiJ0L1ILDCExARzRAVukKQKtJE4ZYm6zFIEv0q2skGz3QeqUvVhyj5eTSSPi5E6PaP
- T481PyWzOdxjKpBrIF/EUhJOlywqrJ2X3kjyo2bbwtKDlaZmp54lD+kLM5FlClrD2VQS3a/DTg4f
- Jl4N3LON7NWBcN7STyQF82xO9UxJZo3R/9ILJUFI/lGExkKvgATP0H5kSeTy36LssUzAKh3ntLFl
- osS88Zj0qnAHY7S42jtM+kAiMFsRpvAFDsYCA0irhpuF3dvd6qJ2gHN99ZwExEWN57kci57q13XR
- crHedUTnQn3iV2t93Jm8PYMo6oCTjcVMZcFwgbg4/EMxsvYDNEeyrPsiBsse3RdHHF9mudMaotoR
- saS8I8nkvof/uZS2+F0gStRf571oe2XyFR7SOqkt6dhrJKyXWERHrVkY8SFlcN7ONGCoQPHzPKTD
- KCOM/iczQ0CgFzzr6juwcqajuUpLXhZI9LK8yIySxZ2frHI2vDSANGupi5LAuBft7HZT9SQBjLMi
- 6Et8Vcad+qMUu2WFbm5PEn4KPJ2V
- -----END CERTIFICATE-----
- Izenpe.com
- ==========
- -----BEGIN CERTIFICATE-----
- MIIF8TCCA9mgAwIBAgIQALC3WhZIX7/hy/WL1xnmfTANBgkqhkiG9w0BAQsFADA4MQswCQYDVQQG
- EwJFUzEUMBIGA1UECgwLSVpFTlBFIFMuQS4xEzARBgNVBAMMCkl6ZW5wZS5jb20wHhcNMDcxMjEz
- MTMwODI4WhcNMzcxMjEzMDgyNzI1WjA4MQswCQYDVQQGEwJFUzEUMBIGA1UECgwLSVpFTlBFIFMu
- QS4xEzARBgNVBAMMCkl6ZW5wZS5jb20wggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDJ
- 03rKDx6sp4boFmVqscIbRTJxldn+EFvMr+eleQGPicPK8lVx93e+d5TzcqQsRNiekpsUOqHnJJAK
- ClaOxdgmlOHZSOEtPtoKct2jmRXagaKH9HtuJneJWK3W6wyyQXpzbm3benhB6QiIEn6HLmYRY2xU
- +zydcsC8Lv/Ct90NduM61/e0aL6i9eOBbsFGb12N4E3GVFWJGjMxCrFXuaOKmMPsOzTFlUFpfnXC
- PCDFYbpRR6AgkJOhkEvzTnyFRVSa0QUmQbC1TR0zvsQDyCV8wXDbO/QJLVQnSKwv4cSsPsjLkkxT
- OTcj7NMB+eAJRE1NZMDhDVqHIrytG6P+JrUV86f8hBnp7KGItERphIPzidF0BqnMC9bC3ieFUCbK
- F7jJeodWLBoBHmy+E60QrLUk9TiRodZL2vG70t5HtfG8gfZZa88ZU+mNFctKy6lvROUbQc/hhqfK
- 0GqfvEyNBjNaooXlkDWgYlwWTvDjovoDGrQscbNYLN57C9saD+veIR8GdwYDsMnvmfzAuU8Lhij+
- 0rnq49qlw0dpEuDb8PYZi+17cNcC1u2HGCgsBCRMd+RIihrGO5rUD8r6ddIBQFqNeb+Lz0vPqhbB
- leStTIo+F5HUsWLlguWABKQDfo2/2n+iD5dPDNMN+9fR5XJ+HMh3/1uaD7euBUbl8agW7EekFwID
- AQABo4H2MIHzMIGwBgNVHREEgagwgaWBD2luZm9AaXplbnBlLmNvbaSBkTCBjjFHMEUGA1UECgw+
- SVpFTlBFIFMuQS4gLSBDSUYgQTAxMzM3MjYwLVJNZXJjLlZpdG9yaWEtR2FzdGVpeiBUMTA1NSBG
- NjIgUzgxQzBBBgNVBAkMOkF2ZGEgZGVsIE1lZGl0ZXJyYW5lbyBFdG9yYmlkZWEgMTQgLSAwMTAx
- MCBWaXRvcmlhLUdhc3RlaXowDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0O
- BBYEFB0cZQ6o8iV7tJHP5LGx5r1VdGwFMA0GCSqGSIb3DQEBCwUAA4ICAQB4pgwWSp9MiDrAyw6l
- Fn2fuUhfGI8NYjb2zRlrrKvV9pF9rnHzP7MOeIWblaQnIUdCSnxIOvVFfLMMjlF4rJUT3sb9fbga
- kEyrkgPH7UIBzg/YsfqikuFgba56awmqxinuaElnMIAkejEWOVt+8Rwu3WwJrfIxwYJOubv5vr8q
- hT/AQKM6WfxZSzwoJNu0FXWuDYi6LnPAvViH5ULy617uHjAimcs30cQhbIHsvm0m5hzkQiCeR7Cs
- g1lwLDXWrzY0tM07+DKo7+N4ifuNRSzanLh+QBxh5z6ikixL8s36mLYp//Pye6kfLqCTVyvehQP5
- aTfLnnhqBbTFMXiJ7HqnheG5ezzevh55hM6fcA5ZwjUukCox2eRFekGkLhObNA5me0mrZJfQRsN5
- nXJQY6aYWwa9SG3YOYNw6DXwBdGqvOPbyALqfP2C2sJbUjWumDqtujWTI6cfSN01RpiyEGjkpTHC
- ClguGYEQyVB1/OpaFs4R1+7vUIgtYf8/QnMFlEPVjjxOAToZpR9GTnfQXeWBIiGH/pR9hNiTrdZo
- Q0iy2+tzJOeRf1SktoA+naM8THLCV8Sg1Mw4J87VBp6iSNnpn86CcDaTmjvfliHjWbcM2pE38P1Z
- WrOZyGlsQyYBNWNgVYkDOnXYukrZVP/u3oDYLdE41V4tC5h9Pmzb/CaIxw==
- -----END CERTIFICATE-----
- Go Daddy Root Certificate Authority - G2
- ========================================
- -----BEGIN CERTIFICATE-----
- MIIDxTCCAq2gAwIBAgIBADANBgkqhkiG9w0BAQsFADCBgzELMAkGA1UEBhMCVVMxEDAOBgNVBAgT
- B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxGjAYBgNVBAoTEUdvRGFkZHkuY29tLCBJbmMu
- MTEwLwYDVQQDEyhHbyBEYWRkeSBSb290IENlcnRpZmljYXRlIEF1dGhvcml0eSAtIEcyMB4XDTA5
- MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgYMxCzAJBgNVBAYTAlVTMRAwDgYDVQQIEwdBcml6
- b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMRowGAYDVQQKExFHb0RhZGR5LmNvbSwgSW5jLjExMC8G
- A1UEAxMoR28gRGFkZHkgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjCCASIwDQYJKoZI
- hvcNAQEBBQADggEPADCCAQoCggEBAL9xYgjx+lk09xvJGKP3gElY6SKDE6bFIEMBO4Tx5oVJnyfq
- 9oQbTqC023CYxzIBsQU+B07u9PpPL1kwIuerGVZr4oAH/PMWdYA5UXvl+TW2dE6pjYIT5LY/qQOD
- +qK+ihVqf94Lw7YZFAXK6sOoBJQ7RnwyDfMAZiLIjWltNowRGLfTshxgtDj6AozO091GB94KPutd
- fMh8+7ArU6SSYmlRJQVhGkSBjCypQ5Yj36w6gZoOKcUcqeldHraenjAKOc7xiID7S13MMuyFYkMl
- NAJWJwGRtDtwKj9useiciAF9n9T521NtYJ2/LOdYq7hfRvzOxBsDPAnrSTFcaUaz4EcCAwEAAaNC
- MEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFDqahQcQZyi27/a9
- BUFuIMGU2g/eMA0GCSqGSIb3DQEBCwUAA4IBAQCZ21151fmXWWcDYfF+OwYxdS2hII5PZYe096ac
- vNjpL9DbWu7PdIxztDhC2gV7+AJ1uP2lsdeu9tfeE8tTEH6KRtGX+rcuKxGrkLAngPnon1rpN5+r
- 5N9ss4UXnT3ZJE95kTXWXwTrgIOrmgIttRD02JDHBHNA7XIloKmf7J6raBKZV8aPEjoJpL1E/QYV
- N8Gb5DKj7Tjo2GTzLH4U/ALqn83/B2gX2yKQOC16jdFU8WnjXzPKej17CuPKf1855eJ1usV2GDPO
- LPAvTK33sefOT6jEm0pUBsV/fdUID+Ic/n4XuKxe9tQWskMJDE32p2u0mYRlynqI4uJEvlz36hz1
- -----END CERTIFICATE-----
- Starfield Root Certificate Authority - G2
- =========================================
- -----BEGIN CERTIFICATE-----
- MIID3TCCAsWgAwIBAgIBADANBgkqhkiG9w0BAQsFADCBjzELMAkGA1UEBhMCVVMxEDAOBgNVBAgT
- B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNobm9s
- b2dpZXMsIEluYy4xMjAwBgNVBAMTKVN0YXJmaWVsZCBSb290IENlcnRpZmljYXRlIEF1dGhvcml0
- eSAtIEcyMB4XDTA5MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgY8xCzAJBgNVBAYTAlVTMRAw
- DgYDVQQIEwdBcml6b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMSUwIwYDVQQKExxTdGFyZmllbGQg
- VGVjaG5vbG9naWVzLCBJbmMuMTIwMAYDVQQDEylTdGFyZmllbGQgUm9vdCBDZXJ0aWZpY2F0ZSBB
- dXRob3JpdHkgLSBHMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAL3twQP89o/8ArFv
- W59I2Z154qK3A2FWGMNHttfKPTUuiUP3oWmb3ooa/RMgnLRJdzIpVv257IzdIvpy3Cdhl+72WoTs
- bhm5iSzchFvVdPtrX8WJpRBSiUZV9Lh1HOZ/5FSuS/hVclcCGfgXcVnrHigHdMWdSL5stPSksPNk
- N3mSwOxGXn/hbVNMYq/NHwtjuzqd+/x5AJhhdM8mgkBj87JyahkNmcrUDnXMN/uLicFZ8WJ/X7Nf
- ZTD4p7dNdloedl40wOiWVpmKs/B/pM293DIxfJHP4F8R+GuqSVzRmZTRouNjWwl2tVZi4Ut0HZbU
- JtQIBFnQmA4O5t78w+wfkPECAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
- AQYwHQYDVR0OBBYEFHwMMh+n2TB/xH1oo2Kooc6rB1snMA0GCSqGSIb3DQEBCwUAA4IBAQARWfol
- TwNvlJk7mh+ChTnUdgWUXuEok21iXQnCoKjUsHU48TRqneSfioYmUeYs0cYtbpUgSpIB7LiKZ3sx
- 4mcujJUDJi5DnUox9g61DLu34jd/IroAow57UvtruzvE03lRTs2Q9GcHGcg8RnoNAX3FWOdt5oUw
- F5okxBDgBPfg8n/Uqgr/Qh037ZTlZFkSIHc40zI+OIF1lnP6aI+xy84fxez6nH7PfrHxBy22/L/K
- pL/QlwVKvOoYKAKQvVR4CSFx09F9HdkWsKlhPdAKACL8x3vLCWRFCztAgfd9fDL1mMpYjn0q7pBZ
- c2T5NnReJaH1ZgUufzkVqSr7UIuOhWn0
- -----END CERTIFICATE-----
- Starfield Services Root Certificate Authority - G2
- ==================================================
- -----BEGIN CERTIFICATE-----
- MIID7zCCAtegAwIBAgIBADANBgkqhkiG9w0BAQsFADCBmDELMAkGA1UEBhMCVVMxEDAOBgNVBAgT
- B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNobm9s
- b2dpZXMsIEluYy4xOzA5BgNVBAMTMlN0YXJmaWVsZCBTZXJ2aWNlcyBSb290IENlcnRpZmljYXRl
- IEF1dGhvcml0eSAtIEcyMB4XDTA5MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgZgxCzAJBgNV
- BAYTAlVTMRAwDgYDVQQIEwdBcml6b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMSUwIwYDVQQKExxT
- dGFyZmllbGQgVGVjaG5vbG9naWVzLCBJbmMuMTswOQYDVQQDEzJTdGFyZmllbGQgU2VydmljZXMg
- Um9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
- AQoCggEBANUMOsQq+U7i9b4Zl1+OiFOxHz/Lz58gE20pOsgPfTz3a3Y4Y9k2YKibXlwAgLIvWX/2
- h/klQ4bnaRtSmpDhcePYLQ1Ob/bISdm28xpWriu2dBTrz/sm4xq6HZYuajtYlIlHVv8loJNwU4Pa
- hHQUw2eeBGg6345AWh1KTs9DkTvnVtYAcMtS7nt9rjrnvDH5RfbCYM8TWQIrgMw0R9+53pBlbQLP
- LJGmpufehRhJfGZOozptqbXuNC66DQO4M99H67FrjSXZm86B0UVGMpZwh94CDklDhbZsc7tk6mFB
- rMnUVN+HL8cisibMn1lUaJ/8viovxFUcdUBgF4UCVTmLfwUCAwEAAaNCMEAwDwYDVR0TAQH/BAUw
- AwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFJxfAN+qAdcwKziIorhtSpzyEZGDMA0GCSqG
- SIb3DQEBCwUAA4IBAQBLNqaEd2ndOxmfZyMIbw5hyf2E3F/YNoHN2BtBLZ9g3ccaaNnRbobhiCPP
- E95Dz+I0swSdHynVv/heyNXBve6SbzJ08pGCL72CQnqtKrcgfU28elUSwhXqvfdqlS5sdJ/PHLTy
- xQGjhdByPq1zqwubdQxtRbeOlKyWN7Wg0I8VRw7j6IPdj/3vQQF3zCepYoUz8jcI73HPdwbeyBkd
- iEDPfUYd/x7H4c7/I9vG+o1VTqkC50cRRj70/b17KSa7qWFiNyi2LSr2EIZkyXCn0q23KXB56jza
- YyWf/Wi3MOxw+3WKt21gZ7IeyLnp2KhvAotnDU0mV3HaIPzBSlCNsSi6
- -----END CERTIFICATE-----
- AffirmTrust Commercial
- ======================
- -----BEGIN CERTIFICATE-----
- MIIDTDCCAjSgAwIBAgIId3cGJyapsXwwDQYJKoZIhvcNAQELBQAwRDELMAkGA1UEBhMCVVMxFDAS
- BgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBDb21tZXJjaWFsMB4XDTEw
- MDEyOTE0MDYwNloXDTMwMTIzMTE0MDYwNlowRDELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmly
- bVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBDb21tZXJjaWFsMIIBIjANBgkqhkiG9w0BAQEF
- AAOCAQ8AMIIBCgKCAQEA9htPZwcroRX1BiLLHwGy43NFBkRJLLtJJRTWzsO3qyxPxkEylFf6Eqdb
- DuKPHx6GGaeqtS25Xw2Kwq+FNXkyLbscYjfysVtKPcrNcV/pQr6U6Mje+SJIZMblq8Yrba0F8PrV
- C8+a5fBQpIs7R6UjW3p6+DM/uO+Zl+MgwdYoic+U+7lF7eNAFxHUdPALMeIrJmqbTFeurCA+ukV6
- BfO9m2kVrn1OIGPENXY6BwLJN/3HR+7o8XYdcxXyl6S1yHp52UKqK39c/s4mT6NmgTWvRLpUHhww
- MmWd5jyTXlBOeuM61G7MGvv50jeuJCqrVwMiKA1JdX+3KNp1v47j3A55MQIDAQABo0IwQDAdBgNV
- HQ4EFgQUnZPGU4teyq8/nx4P5ZmVvCT2lI8wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
- AQYwDQYJKoZIhvcNAQELBQADggEBAFis9AQOzcAN/wr91LoWXym9e2iZWEnStB03TX8nfUYGXUPG
- hi4+c7ImfU+TqbbEKpqrIZcUsd6M06uJFdhrJNTxFq7YpFzUf1GO7RgBsZNjvbz4YYCanrHOQnDi
- qX0GJX0nof5v7LMeJNrjS1UaADs1tDvZ110w/YETifLCBivtZ8SOyUOyXGsViQK8YvxO8rUzqrJv
- 0wqiUOP2O+guRMLbZjipM1ZI8W0bM40NjD9gN53Tym1+NH4Nn3J2ixufcv1SNUFFApYvHLKac0kh
- sUlHRUe072o0EclNmsxZt9YCnlpOZbWUrhvfKbAW8b8Angc6F2S1BLUjIZkKlTuXfO8=
- -----END CERTIFICATE-----
- AffirmTrust Networking
- ======================
- -----BEGIN CERTIFICATE-----
- MIIDTDCCAjSgAwIBAgIIfE8EORzUmS0wDQYJKoZIhvcNAQEFBQAwRDELMAkGA1UEBhMCVVMxFDAS
- BgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBOZXR3b3JraW5nMB4XDTEw
- MDEyOTE0MDgyNFoXDTMwMTIzMTE0MDgyNFowRDELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmly
- bVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBOZXR3b3JraW5nMIIBIjANBgkqhkiG9w0BAQEF
- AAOCAQ8AMIIBCgKCAQEAtITMMxcua5Rsa2FSoOujz3mUTOWUgJnLVWREZY9nZOIG41w3SfYvm4SE
- Hi3yYJ0wTsyEheIszx6e/jarM3c1RNg1lho9Nuh6DtjVR6FqaYvZ/Ls6rnla1fTWcbuakCNrmreI
- dIcMHl+5ni36q1Mr3Lt2PpNMCAiMHqIjHNRqrSK6mQEubWXLviRmVSRLQESxG9fhwoXA3hA/Pe24
- /PHxI1Pcv2WXb9n5QHGNfb2V1M6+oF4nI979ptAmDgAp6zxG8D1gvz9Q0twmQVGeFDdCBKNwV6gb
- h+0t+nvujArjqWaJGctB+d1ENmHP4ndGyH329JKBNv3bNPFyfvMMFr20FQIDAQABo0IwQDAdBgNV
- HQ4EFgQUBx/S55zawm6iQLSwelAQUHTEyL0wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
- AQYwDQYJKoZIhvcNAQEFBQADggEBAIlXshZ6qML91tmbmzTCnLQyFE2npN/svqe++EPbkTfOtDIu
- UFUaNU52Q3Eg75N3ThVwLofDwR1t3Mu1J9QsVtFSUzpE0nPIxBsFZVpikpzuQY0x2+c06lkh1QF6
- 12S4ZDnNye2v7UsDSKegmQGA3GWjNq5lWUhPgkvIZfFXHeVZLgo/bNjR9eUJtGxUAArgFU2HdW23
- WJZa3W3SAKD0m0i+wzekujbgfIeFlxoVot4uolu9rxj5kFDNcFn4J2dHy8egBzp90SxdbBk6ZrV9
- /ZFvgrG+CJPbFEfxojfHRZ48x3evZKiT3/Zpg4Jg8klCNO1aAFSFHBY2kgxc+qatv9s=
- -----END CERTIFICATE-----
- AffirmTrust Premium
- ===================
- -----BEGIN CERTIFICATE-----
- MIIFRjCCAy6gAwIBAgIIbYwURrGmCu4wDQYJKoZIhvcNAQEMBQAwQTELMAkGA1UEBhMCVVMxFDAS
- BgNVBAoMC0FmZmlybVRydXN0MRwwGgYDVQQDDBNBZmZpcm1UcnVzdCBQcmVtaXVtMB4XDTEwMDEy
- OTE0MTAzNloXDTQwMTIzMTE0MTAzNlowQTELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmlybVRy
- dXN0MRwwGgYDVQQDDBNBZmZpcm1UcnVzdCBQcmVtaXVtMIICIjANBgkqhkiG9w0BAQEFAAOCAg8A
- MIICCgKCAgEAxBLfqV/+Qd3d9Z+K4/as4Tx4mrzY8H96oDMq3I0gW64tb+eT2TZwamjPjlGjhVtn
- BKAQJG9dKILBl1fYSCkTtuG+kU3fhQxTGJoeJKJPj/CihQvL9Cl/0qRY7iZNyaqoe5rZ+jjeRFcV
- 5fiMyNlI4g0WJx0eyIOFJbe6qlVBzAMiSy2RjYvmia9mx+n/K+k8rNrSs8PhaJyJ+HoAVt70VZVs
- +7pk3WKL3wt3MutizCaam7uqYoNMtAZ6MMgpv+0GTZe5HMQxK9VfvFMSF5yZVylmd2EhMQcuJUmd
- GPLu8ytxjLW6OQdJd/zvLpKQBY0tL3d770O/Nbua2Plzpyzy0FfuKE4mX4+QaAkvuPjcBukumj5R
- p9EixAqnOEhss/n/fauGV+O61oV4d7pD6kh/9ti+I20ev9E2bFhc8e6kGVQa9QPSdubhjL08s9NI
- S+LI+H+SqHZGnEJlPqQewQcDWkYtuJfzt9WyVSHvutxMAJf7FJUnM7/oQ0dG0giZFmA7mn7S5u04
- 6uwBHjxIVkkJx0w3AJ6IDsBz4W9m6XJHMD4Q5QsDyZpCAGzFlH5hxIrff4IaC1nEWTJ3s7xgaVY5
- /bQGeyzWZDbZvUjthB9+pSKPKrhC9IK31FOQeE4tGv2Bb0TXOwF0lkLgAOIua+rF7nKsu7/+6qqo
- +Nz2snmKtmcCAwEAAaNCMEAwHQYDVR0OBBYEFJ3AZ6YMItkm9UWrpmVSESfYRaxjMA8GA1UdEwEB
- /wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEBDAUAA4ICAQCzV00QYk465KzquByv
- MiPIs0laUZx2KI15qldGF9X1Uva3ROgIRL8YhNILgM3FEv0AVQVhh0HctSSePMTYyPtwni94loMg
- Nt58D2kTiKV1NpgIpsbfrM7jWNa3Pt668+s0QNiigfV4Py/VpfzZotReBA4Xrf5B8OWycvpEgjNC
- 6C1Y91aMYj+6QrCcDFx+LmUmXFNPALJ4fqENmS2NuB2OosSw/WDQMKSOyARiqcTtNd56l+0OOF6S
- L5Nwpamcb6d9Ex1+xghIsV5n61EIJenmJWtSKZGc0jlzCFfemQa0W50QBuHCAKi4HEoCChTQwUHK
- +4w1IX2COPKpVJEZNZOUbWo6xbLQu4mGk+ibyQ86p3q4ofB4Rvr8Ny/lioTz3/4E2aFooC8k4gmV
- BtWVyuEklut89pMFu+1z6S3RdTnX5yTb2E5fQ4+e0BQ5v1VwSJlXMbSc7kqYA5YwH2AG7hsj/oFg
- IxpHYoWlzBk0gG+zrBrjn/B7SK3VAdlntqlyk+otZrWyuOQ9PLLvTIzq6we/qzWaVYa8GKa1qF60
- g2xraUDTn9zxw2lrueFtCfTxqlB2Cnp9ehehVZZCmTEJ3WARjQUwfuaORtGdFNrHF+QFlozEJLUb
- zxQHskD4o55BhrwE0GuWyCqANP2/7waj3VjFhT0+j/6eKeC2uAloGRwYQw==
- -----END CERTIFICATE-----
- AffirmTrust Premium ECC
- =======================
- -----BEGIN CERTIFICATE-----
- MIIB/jCCAYWgAwIBAgIIdJclisc/elQwCgYIKoZIzj0EAwMwRTELMAkGA1UEBhMCVVMxFDASBgNV
- BAoMC0FmZmlybVRydXN0MSAwHgYDVQQDDBdBZmZpcm1UcnVzdCBQcmVtaXVtIEVDQzAeFw0xMDAx
- MjkxNDIwMjRaFw00MDEyMzExNDIwMjRaMEUxCzAJBgNVBAYTAlVTMRQwEgYDVQQKDAtBZmZpcm1U
- cnVzdDEgMB4GA1UEAwwXQWZmaXJtVHJ1c3QgUHJlbWl1bSBFQ0MwdjAQBgcqhkjOPQIBBgUrgQQA
- IgNiAAQNMF4bFZ0D0KF5Nbc6PJJ6yhUczWLznCZcBz3lVPqj1swS6vQUX+iOGasvLkjmrBhDeKzQ
- N8O9ss0s5kfiGuZjuD0uL3jET9v0D6RoTFVya5UdThhClXjMNzyR4ptlKymjQjBAMB0GA1UdDgQW
- BBSaryl6wBE1NSZRMADDav5A1a7WPDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAK
- BggqhkjOPQQDAwNnADBkAjAXCfOHiFBar8jAQr9HX/VsaobgxCd05DhT1wV/GzTjxi+zygk8N53X
- 57hG8f2h4nECMEJZh0PUUd+60wkyWs6Iflc9nF9Ca/UHLbXwgpP5WW+uZPpY5Yse42O+tYHNbwKM
- eQ==
- -----END CERTIFICATE-----
- Certum Trusted Network CA
- =========================
- -----BEGIN CERTIFICATE-----
- MIIDuzCCAqOgAwIBAgIDBETAMA0GCSqGSIb3DQEBBQUAMH4xCzAJBgNVBAYTAlBMMSIwIAYDVQQK
- ExlVbml6ZXRvIFRlY2hub2xvZ2llcyBTLkEuMScwJQYDVQQLEx5DZXJ0dW0gQ2VydGlmaWNhdGlv
- biBBdXRob3JpdHkxIjAgBgNVBAMTGUNlcnR1bSBUcnVzdGVkIE5ldHdvcmsgQ0EwHhcNMDgxMDIy
- MTIwNzM3WhcNMjkxMjMxMTIwNzM3WjB+MQswCQYDVQQGEwJQTDEiMCAGA1UEChMZVW5pemV0byBU
- ZWNobm9sb2dpZXMgUy5BLjEnMCUGA1UECxMeQ2VydHVtIENlcnRpZmljYXRpb24gQXV0aG9yaXR5
- MSIwIAYDVQQDExlDZXJ0dW0gVHJ1c3RlZCBOZXR3b3JrIENBMIIBIjANBgkqhkiG9w0BAQEFAAOC
- AQ8AMIIBCgKCAQEA4/t9o3K6wvDJFIf1awFO4W5AB7ptJ11/91sts1rHUV+rpDKmYYe2bg+G0jAC
- l/jXaVehGDldamR5xgFZrDwxSjh80gTSSyjoIF87B6LMTXPb865Px1bVWqeWifrzq2jUI4ZZJ88J
- J7ysbnKDHDBy3+Ci6dLhdHUZvSqeexVUBBvXQzmtVSjF4hq79MDkrjhJM8x2hZ85RdKknvISjFH4
- fOQtf/WsX+sWn7Et0brMkUJ3TCXJkDhv2/DM+44el1k+1WBO5gUo7Ul5E0u6SNsv+XLTOcr+H9g0
- cvW0QM8xAcPs3hEtF10fuFDRXhmnad4HMyjKUJX5p1TLVIZQRan5SQIDAQABo0IwQDAPBgNVHRMB
- Af8EBTADAQH/MB0GA1UdDgQWBBQIds3LB/8k9sXN7buQvOKEN0Z19zAOBgNVHQ8BAf8EBAMCAQYw
- DQYJKoZIhvcNAQEFBQADggEBAKaorSLOAT2mo/9i0Eidi15ysHhE49wcrwn9I0j6vSrEuVUEtRCj
- jSfeC4Jj0O7eDDd5QVsisrCaQVymcODU0HfLI9MA4GxWL+FpDQ3Zqr8hgVDZBqWo/5U30Kr+4rP1
- mS1FhIrlQgnXdAIv94nYmem8J9RHjboNRhx3zxSkHLmkMcScKHQDNP8zGSal6Q10tz6XxnboJ5aj
- Zt3hrvJBW8qYVoNzcOSGGtIxQbovvi0TWnZvTuhOgQ4/WwMioBK+ZlgRSssDxLQqKi2WF+A5VLxI
- 03YnnZotBqbJ7DnSq9ufmgsnAjUpsUCV5/nonFWIGUbWtzT1fs45mtk48VH3Tyw=
- -----END CERTIFICATE-----
- TWCA Root Certification Authority
- =================================
- -----BEGIN CERTIFICATE-----
- MIIDezCCAmOgAwIBAgIBATANBgkqhkiG9w0BAQUFADBfMQswCQYDVQQGEwJUVzESMBAGA1UECgwJ
- VEFJV0FOLUNBMRAwDgYDVQQLDAdSb290IENBMSowKAYDVQQDDCFUV0NBIFJvb3QgQ2VydGlmaWNh
- dGlvbiBBdXRob3JpdHkwHhcNMDgwODI4MDcyNDMzWhcNMzAxMjMxMTU1OTU5WjBfMQswCQYDVQQG
- EwJUVzESMBAGA1UECgwJVEFJV0FOLUNBMRAwDgYDVQQLDAdSb290IENBMSowKAYDVQQDDCFUV0NB
- IFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK
- AoIBAQCwfnK4pAOU5qfeCTiRShFAh6d8WWQUe7UREN3+v9XAu1bihSX0NXIP+FPQQeFEAcK0HMMx
- QhZHhTMidrIKbw/lJVBPhYa+v5guEGcevhEFhgWQxFnQfHgQsIBct+HHK3XLfJ+utdGdIzdjp9xC
- oi2SBBtQwXu4PhvJVgSLL1KbralW6cH/ralYhzC2gfeXRfwZVzsrb+RH9JlF/h3x+JejiB03HFyP
- 4HYlmlD4oFT/RJB2I9IyxsOrBr/8+7/zrX2SYgJbKdM1o5OaQ2RgXbL6Mv87BK9NQGr5x+PvI/1r
- y+UPizgN7gr8/g+YnzAx3WxSZfmLgb4i4RxYA7qRG4kHAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIB
- BjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRqOFsmjd6LWvJPelSDGRjjCDWmujANBgkqhkiG
- 9w0BAQUFAAOCAQEAPNV3PdrfibqHDAhUaiBQkr6wQT25JmSDCi/oQMCXKCeCMErJk/9q56YAf4lC
- mtYR5VPOL8zy2gXE/uJQxDqGfczafhAJO5I1KlOy/usrBdlsXebQ79NqZp4VKIV66IIArB6nCWlW
- QtNoURi+VJq/REG6Sb4gumlc7rh3zc5sH62Dlhh9DrUUOYTxKOkto557HnpyWoOzeW/vtPzQCqVY
- T0bf+215WfKEIlKuD8z7fDvnaspHYcN6+NOSBB+4IIThNlQWx0DeO4pz3N/GCUzf7Nr/1FNCocny
- Yh0igzyXxfkZYiesZSLX0zzG5Y6yU8xJzrww/nsOM5D77dIUkR8Hrw==
- -----END CERTIFICATE-----
- Security Communication RootCA2
- ==============================
- -----BEGIN CERTIFICATE-----
- MIIDdzCCAl+gAwIBAgIBADANBgkqhkiG9w0BAQsFADBdMQswCQYDVQQGEwJKUDElMCMGA1UEChMc
- U0VDT00gVHJ1c3QgU3lzdGVtcyBDTy4sTFRELjEnMCUGA1UECxMeU2VjdXJpdHkgQ29tbXVuaWNh
- dGlvbiBSb290Q0EyMB4XDTA5MDUyOTA1MDAzOVoXDTI5MDUyOTA1MDAzOVowXTELMAkGA1UEBhMC
- SlAxJTAjBgNVBAoTHFNFQ09NIFRydXN0IFN5c3RlbXMgQ08uLExURC4xJzAlBgNVBAsTHlNlY3Vy
- aXR5IENvbW11bmljYXRpb24gUm9vdENBMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
- ANAVOVKxUrO6xVmCxF1SrjpDZYBLx/KWvNs2l9amZIyoXvDjChz335c9S672XewhtUGrzbl+dp++
- +T42NKA7wfYxEUV0kz1XgMX5iZnK5atq1LXaQZAQwdbWQonCv/Q4EpVMVAX3NuRFg3sUZdbcDE3R
- 3n4MqzvEFb46VqZab3ZpUql6ucjrappdUtAtCms1FgkQhNBqyjoGADdH5H5XTz+L62e4iKrFvlNV
- spHEfbmwhRkGeC7bYRr6hfVKkaHnFtWOojnflLhwHyg/i/xAXmODPIMqGplrz95Zajv8bxbXH/1K
- EOtOghY6rCcMU/Gt1SSwawNQwS08Ft1ENCcadfsCAwEAAaNCMEAwHQYDVR0OBBYEFAqFqXdlBZh8
- QIH4D5csOPEK7DzPMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEB
- CwUAA4IBAQBMOqNErLlFsceTfsgLCkLfZOoc7llsCLqJX2rKSpWeeo8HxdpFcoJxDjrSzG+ntKEj
- u/Ykn8sX/oymzsLS28yN/HH8AynBbF0zX2S2ZTuJbxh2ePXcokgfGT+Ok+vx+hfuzU7jBBJV1uXk
- 3fs+BXziHV7Gp7yXT2g69ekuCkO2r1dcYmh8t/2jioSgrGK+KwmHNPBqAbubKVY8/gA3zyNs8U6q
- tnRGEmyR7jTV7JqR50S+kDFy1UkC9gLl9B/rfNmWVan/7Ir5mUf/NVoCqgTLiluHcSmRvaS0eg29
- mvVXIwAHIRc/SjnRBUkLp7Y3gaVdjKozXoEofKd9J+sAro03
- -----END CERTIFICATE-----
- Actalis Authentication Root CA
- ==============================
- -----BEGIN CERTIFICATE-----
- MIIFuzCCA6OgAwIBAgIIVwoRl0LE48wwDQYJKoZIhvcNAQELBQAwazELMAkGA1UEBhMCSVQxDjAM
- BgNVBAcMBU1pbGFuMSMwIQYDVQQKDBpBY3RhbGlzIFMucC5BLi8wMzM1ODUyMDk2NzEnMCUGA1UE
- AwweQWN0YWxpcyBBdXRoZW50aWNhdGlvbiBSb290IENBMB4XDTExMDkyMjExMjIwMloXDTMwMDky
- MjExMjIwMlowazELMAkGA1UEBhMCSVQxDjAMBgNVBAcMBU1pbGFuMSMwIQYDVQQKDBpBY3RhbGlz
- IFMucC5BLi8wMzM1ODUyMDk2NzEnMCUGA1UEAwweQWN0YWxpcyBBdXRoZW50aWNhdGlvbiBSb290
- IENBMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAp8bEpSmkLO/lGMWwUKNvUTufClrJ
- wkg4CsIcoBh/kbWHuUA/3R1oHwiD1S0eiKD4j1aPbZkCkpAW1V8IbInX4ay8IMKx4INRimlNAJZa
- by/ARH6jDuSRzVju3PvHHkVH3Se5CAGfpiEd9UEtL0z9KK3giq0itFZljoZUj5NDKd45RnijMCO6
- zfB9E1fAXdKDa0hMxKufgFpbOr3JpyI/gCczWw63igxdBzcIy2zSekciRDXFzMwujt0q7bd9Zg1f
- YVEiVRvjRuPjPdA1YprbrxTIW6HMiRvhMCb8oJsfgadHHwTrozmSBp+Z07/T6k9QnBn+locePGX2
- oxgkg4YQ51Q+qDp2JE+BIcXjDwL4k5RHILv+1A7TaLndxHqEguNTVHnd25zS8gebLra8Pu2Fbe8l
- EfKXGkJh90qX6IuxEAf6ZYGyojnP9zz/GPvG8VqLWeICrHuS0E4UT1lF9gxeKF+w6D9Fz8+vm2/7
- hNN3WpVvrJSEnu68wEqPSpP4RCHiMUVhUE4Q2OM1fEwZtN4Fv6MGn8i1zeQf1xcGDXqVdFUNaBr8
- EBtiZJ1t4JWgw5QHVw0U5r0F+7if5t+L4sbnfpb2U8WANFAoWPASUHEXMLrmeGO89LKtmyuy/uE5
- jF66CyCU3nuDuP/jVo23Eek7jPKxwV2dpAtMK9myGPW1n0sCAwEAAaNjMGEwHQYDVR0OBBYEFFLY
- iDrIn3hm7YnzezhwlMkCAjbQMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUUtiIOsifeGbt
- ifN7OHCUyQICNtAwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEBCwUAA4ICAQALe3KHwGCmSUyI
- WOYdiPcUZEim2FgKDk8TNd81HdTtBjHIgT5q1d07GjLukD0R0i70jsNjLiNmsGe+b7bAEzlgqqI0
- JZN1Ut6nna0Oh4lScWoWPBkdg/iaKWW+9D+a2fDzWochcYBNy+A4mz+7+uAwTc+G02UQGRjRlwKx
- K3JCaKygvU5a2hi/a5iB0P2avl4VSM0RFbnAKVy06Ij3Pjaut2L9HmLecHgQHEhb2rykOLpn7VU+
- Xlff1ANATIGk0k9jpwlCCRT8AKnCgHNPLsBA2RF7SOp6AsDT6ygBJlh0wcBzIm2Tlf05fbsq4/aC
- 4yyXX04fkZT6/iyj2HYauE2yOE+b+h1IYHkm4vP9qdCa6HCPSXrW5b0KDtst842/6+OkfcvHlXHo
- 2qN8xcL4dJIEG4aspCJTQLas/kx2z/uUMsA1n3Y/buWQbqCmJqK4LL7RK4X9p2jIugErsWx0Hbhz
- lefut8cl8ABMALJ+tguLHPPAUJ4lueAI3jZm/zel0btUZCzJJ7VLkn5l/9Mt4blOvH+kQSGQQXem
- OR/qnuOf0GZvBeyqdn6/axag67XH/JJULysRJyU3eExRarDzzFhdFPFqSBX/wge2sY0PjlxQRrM9
- vwGYT7JZVEc+NHt4bVaTLnPqZih4zR0Uv6CPLy64Lo7yFIrM6bV8+2ydDKXhlg==
- -----END CERTIFICATE-----
- Buypass Class 2 Root CA
- =======================
- -----BEGIN CERTIFICATE-----
- MIIFWTCCA0GgAwIBAgIBAjANBgkqhkiG9w0BAQsFADBOMQswCQYDVQQGEwJOTzEdMBsGA1UECgwU
- QnV5cGFzcyBBUy05ODMxNjMzMjcxIDAeBgNVBAMMF0J1eXBhc3MgQ2xhc3MgMiBSb290IENBMB4X
- DTEwMTAyNjA4MzgwM1oXDTQwMTAyNjA4MzgwM1owTjELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1
- eXBhc3MgQVMtOTgzMTYzMzI3MSAwHgYDVQQDDBdCdXlwYXNzIENsYXNzIDIgUm9vdCBDQTCCAiIw
- DQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANfHXvfBB9R3+0Mh9PT1aeTuMgHbo4Yf5FkNuud1
- g1Lr6hxhFUi7HQfKjK6w3Jad6sNgkoaCKHOcVgb/S2TwDCo3SbXlzwx87vFKu3MwZfPVL4O2fuPn
- 9Z6rYPnT8Z2SdIrkHJasW4DptfQxh6NR/Md+oW+OU3fUl8FVM5I+GC911K2GScuVr1QGbNgGE41b
- /+EmGVnAJLqBcXmQRFBoJJRfuLMR8SlBYaNByyM21cHxMlAQTn/0hpPshNOOvEu/XAFOBz3cFIqU
- CqTqc/sLUegTBxj6DvEr0VQVfTzh97QZQmdiXnfgolXsttlpF9U6r0TtSsWe5HonfOV116rLJeff
- awrbD02TTqigzXsu8lkBarcNuAeBfos4GzjmCleZPe4h6KP1DBbdi+w0jpwqHAAVF41og9JwnxgI
- zRFo1clrUs3ERo/ctfPYV3Me6ZQ5BL/T3jjetFPsaRyifsSP5BtwrfKi+fv3FmRmaZ9JUaLiFRhn
- Bkp/1Wy1TbMz4GHrXb7pmA8y1x1LPC5aAVKRCfLf6o3YBkBjqhHk/sM3nhRSP/TizPJhk9H9Z2vX
- Uq6/aKtAQ6BXNVN48FP4YUIHZMbXb5tMOA1jrGKvNouicwoN9SG9dKpN6nIDSdvHXx1iY8f93ZHs
- M+71bbRuMGjeyNYmsHVee7QHIJihdjK4TWxPAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYD
- VR0OBBYEFMmAd+BikoL1RpzzuvdMw964o605MA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsF
- AAOCAgEAU18h9bqwOlI5LJKwbADJ784g7wbylp7ppHR/ehb8t/W2+xUbP6umwHJdELFx7rxP462s
- A20ucS6vxOOto70MEae0/0qyexAQH6dXQbLArvQsWdZHEIjzIVEpMMpghq9Gqx3tOluwlN5E40EI
- osHsHdb9T7bWR9AUC8rmyrV7d35BH16Dx7aMOZawP5aBQW9gkOLo+fsicdl9sz1Gv7SEr5AcD48S
- aq/v7h56rgJKihcrdv6sVIkkLE8/trKnToyokZf7KcZ7XC25y2a2t6hbElGFtQl+Ynhw/qlqYLYd
- DnkM/crqJIByw5c/8nerQyIKx+u2DISCLIBrQYoIwOula9+ZEsuK1V6ADJHgJgg2SMX6OBE1/yWD
- LfJ6v9r9jv6ly0UsH8SIU653DtmadsWOLB2jutXsMq7Aqqz30XpN69QH4kj3Io6wpJ9qzo6ysmD0
- oyLQI+uUWnpp3Q+/QFesa1lQ2aOZ4W7+jQF5JyMV3pKdewlNWudLSDBaGOYKbeaP4NK75t98biGC
- wWg5TbSYWGZizEqQXsP6JwSxeRV0mcy+rSDeJmAc61ZRpqPq5KM/p/9h3PFaTWwyI0PurKju7koS
- CTxdccK+efrCh2gdC/1cacwG0Jp9VJkqyTkaGa9LKkPzY11aWOIv4x3kqdbQCtCev9eBCfHJxyYN
- rJgWVqA=
- -----END CERTIFICATE-----
- Buypass Class 3 Root CA
- =======================
- -----BEGIN CERTIFICATE-----
- MIIFWTCCA0GgAwIBAgIBAjANBgkqhkiG9w0BAQsFADBOMQswCQYDVQQGEwJOTzEdMBsGA1UECgwU
- QnV5cGFzcyBBUy05ODMxNjMzMjcxIDAeBgNVBAMMF0J1eXBhc3MgQ2xhc3MgMyBSb290IENBMB4X
- DTEwMTAyNjA4Mjg1OFoXDTQwMTAyNjA4Mjg1OFowTjELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1
- eXBhc3MgQVMtOTgzMTYzMzI3MSAwHgYDVQQDDBdCdXlwYXNzIENsYXNzIDMgUm9vdCBDQTCCAiIw
- DQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAKXaCpUWUOOV8l6ddjEGMnqb8RB2uACatVI2zSRH
- sJ8YZLya9vrVediQYkwiL944PdbgqOkcLNt4EemOaFEVcsfzM4fkoF0LXOBXByow9c3EN3coTRiR
- 5r/VUv1xLXA+58bEiuPwKAv0dpihi4dVsjoT/Lc+JzeOIuOoTyrvYLs9tznDDgFHmV0ST9tD+leh
- 7fmdvhFHJlsTmKtdFoqwNxxXnUX/iJY2v7vKB3tvh2PX0DJq1l1sDPGzbjniazEuOQAnFN44wOwZ
- ZoYS6J1yFhNkUsepNxz9gjDthBgd9K5c/3ATAOux9TN6S9ZV+AWNS2mw9bMoNlwUxFFzTWsL8TQH
- 2xc519woe2v1n/MuwU8XKhDzzMro6/1rqy6any2CbgTUUgGTLT2G/H783+9CHaZr77kgxve9oKeV
- /afmiSTYzIw0bOIjL9kSGiG5VZFvC5F5GQytQIgLcOJ60g7YaEi7ghM5EFjp2CoHxhLbWNvSO1UQ
- RwUVZ2J+GGOmRj8JDlQyXr8NYnon74Do29lLBlo3WiXQCBJ31G8JUJc9yB3D34xFMFbG02SrZvPA
- Xpacw8Tvw3xrizp5f7NJzz3iiZ+gMEuFuZyUJHmPfWupRWgPK9Dx2hzLabjKSWJtyNBjYt1gD1iq
- j6G8BaVmos8bdrKEZLFMOVLAMLrwjEsCsLa3AgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYD
- VR0OBBYEFEe4zf/lb+74suwvTg75JbCOPGvDMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsF
- AAOCAgEAACAjQTUEkMJAYmDv4jVM1z+s4jSQuKFvdvoWFqRINyzpkMLyPPgKn9iB5btb2iUspKdV
- cSQy9sgL8rxq+JOssgfCX5/bzMiKqr5qb+FJEMwx14C7u8jYog5kV+qi9cKpMRXSIGrs/CIBKM+G
- uIAeqcwRpTzyFrNHnfzSgCHEy9BHcEGhyoMZCCxt8l13nIoUE9Q2HJLw5QY33KbmkJs4j1xrG0aG
- Q0JfPgEHU1RdZX33inOhmlRaHylDFCfChQ+1iHsaO5S3HWCntZznKWlXWpuTekMwGwPXYshApqr8
- ZORK15FTAaggiG6cX0S5y2CBNOxv033aSF/rtJC8LakcC6wc1aJoIIAE1vyxjy+7SjENSoYc6+I2
- KSb12tjE8nVhz36udmNKekBlk4f4HoCMhuWG1o8O/FMsYOgWYRqiPkN7zTlgVGr18okmAWiDSKIz
- 6MkEkbIRNBE+6tBDGR8Dk5AM/1E9V/RBbuHLoL7ryWPNbczk+DaqaJ3tvV2XcEQNtg413OEMXbug
- UZTLfhbrES+jkkXITHHZvMmZUldGL1DPvTVp9D0VzgalLA8+9oG6lLvDu79leNKGef9JOxqDDPDe
- eOzI8k1MGt6CKfjBWtrt7uYnXuhF0J0cUahoq0Tj0Itq4/g7u9xN12TyUb7mqqta6THuBrxzvxNi
- Cp/HuZc=
- -----END CERTIFICATE-----
- T-TeleSec GlobalRoot Class 3
- ============================
- -----BEGIN CERTIFICATE-----
- MIIDwzCCAqugAwIBAgIBATANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoM
- IlQtU3lzdGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBU
- cnVzdCBDZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDMwHhcNMDgx
- MDAxMTAyOTU2WhcNMzMxMDAxMjM1OTU5WjCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoMIlQtU3lz
- dGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBD
- ZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDMwggEiMA0GCSqGSIb3
- DQEBAQUAA4IBDwAwggEKAoIBAQC9dZPwYiJvJK7genasfb3ZJNW4t/zN8ELg63iIVl6bmlQdTQyK
- 9tPPcPRStdiTBONGhnFBSivwKixVA9ZIw+A5OO3yXDw/RLyTPWGrTs0NvvAgJ1gORH8EGoel15YU
- NpDQSXuhdfsaa3Ox+M6pCSzyU9XDFES4hqX2iys52qMzVNn6chr3IhUciJFrf2blw2qAsCTz34ZF
- iP0Zf3WHHx+xGwpzJFu5ZeAsVMhg02YXP+HMVDNzkQI6pn97djmiH5a2OK61yJN0HZ65tOVgnS9W
- 0eDrXltMEnAMbEQgqxHY9Bn20pxSN+f6tsIxO0rUFJmtxxr1XV/6B7h8DR/Wgx6zAgMBAAGjQjBA
- MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBS1A/d2O2GCahKqGFPr
- AyGUv/7OyjANBgkqhkiG9w0BAQsFAAOCAQEAVj3vlNW92nOyWL6ukK2YJ5f+AbGwUgC4TeQbIXQb
- fsDuXmkqJa9c1h3a0nnJ85cp4IaH3gRZD/FZ1GSFS5mvJQQeyUapl96Cshtwn5z2r3Ex3XsFpSzT
- ucpH9sry9uetuUg/vBa3wW306gmv7PO15wWeph6KU1HWk4HMdJP2udqmJQV0eVp+QD6CSyYRMG7h
- P0HHRwA11fXT91Q+gT3aSWqas+8QPebrb9HIIkfLzM8BMZLZGOMivgkeGj5asuRrDFR6fUNOuIml
- e9eiPZaGzPImNC1qkp2aGtAw4l1OBLBfiyB+d8E9lYLRRpo7PHi4b6HQDWSieB4pTpPDpFQUWw==
- -----END CERTIFICATE-----
- D-TRUST Root Class 3 CA 2 2009
- ==============================
- -----BEGIN CERTIFICATE-----
- MIIEMzCCAxugAwIBAgIDCYPzMA0GCSqGSIb3DQEBCwUAME0xCzAJBgNVBAYTAkRFMRUwEwYDVQQK
- DAxELVRydXN0IEdtYkgxJzAlBgNVBAMMHkQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgMjAwOTAe
- Fw0wOTExMDUwODM1NThaFw0yOTExMDUwODM1NThaME0xCzAJBgNVBAYTAkRFMRUwEwYDVQQKDAxE
- LVRydXN0IEdtYkgxJzAlBgNVBAMMHkQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgMjAwOTCCASIw
- DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANOySs96R+91myP6Oi/WUEWJNTrGa9v+2wBoqOAD
- ER03UAifTUpolDWzU9GUY6cgVq/eUXjsKj3zSEhQPgrfRlWLJ23DEE0NkVJD2IfgXU42tSHKXzlA
- BF9bfsyjxiupQB7ZNoTWSPOSHjRGICTBpFGOShrvUD9pXRl/RcPHAY9RySPocq60vFYJfxLLHLGv
- KZAKyVXMD9O0Gu1HNVpK7ZxzBCHQqr0ME7UAyiZsxGsMlFqVlNpQmvH/pStmMaTJOKDfHR+4CS7z
- p+hnUquVH+BGPtikw8paxTGA6Eian5Rp/hnd2HN8gcqW3o7tszIFZYQ05ub9VxC1X3a/L7AQDcUC
- AwEAAaOCARowggEWMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFP3aFMSfMN4hvR5COfyrYyNJ
- 4PGEMA4GA1UdDwEB/wQEAwIBBjCB0wYDVR0fBIHLMIHIMIGAoH6gfIZ6bGRhcDovL2RpcmVjdG9y
- eS5kLXRydXN0Lm5ldC9DTj1ELVRSVVNUJTIwUm9vdCUyMENsYXNzJTIwMyUyMENBJTIwMiUyMDIw
- MDksTz1ELVRydXN0JTIwR21iSCxDPURFP2NlcnRpZmljYXRlcmV2b2NhdGlvbmxpc3QwQ6BBoD+G
- PWh0dHA6Ly93d3cuZC10cnVzdC5uZXQvY3JsL2QtdHJ1c3Rfcm9vdF9jbGFzc18zX2NhXzJfMjAw
- OS5jcmwwDQYJKoZIhvcNAQELBQADggEBAH+X2zDI36ScfSF6gHDOFBJpiBSVYEQBrLLpME+bUMJm
- 2H6NMLVwMeniacfzcNsgFYbQDfC+rAF1hM5+n02/t2A7nPPKHeJeaNijnZflQGDSNiH+0LS4F9p0
- o3/U37CYAqxva2ssJSRyoWXuJVrl5jLn8t+rSfrzkGkj2wTZ51xY/GXUl77M/C4KzCUqNQT4YJEV
- dT1B/yMfGchs64JTBKbkTCJNjYy6zltz7GRUUG3RnFX7acM2w4y8PIWmawomDeCTmGCufsYkl4ph
- X5GOZpIJhzbNi5stPvZR1FDUWSi9g/LMKHtThm3YJohw1+qRzT65ysCQblrGXnRl11z+o+I=
- -----END CERTIFICATE-----
- D-TRUST Root Class 3 CA 2 EV 2009
- =================================
- -----BEGIN CERTIFICATE-----
- MIIEQzCCAyugAwIBAgIDCYP0MA0GCSqGSIb3DQEBCwUAMFAxCzAJBgNVBAYTAkRFMRUwEwYDVQQK
- DAxELVRydXN0IEdtYkgxKjAoBgNVBAMMIUQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgRVYgMjAw
- OTAeFw0wOTExMDUwODUwNDZaFw0yOTExMDUwODUwNDZaMFAxCzAJBgNVBAYTAkRFMRUwEwYDVQQK
- DAxELVRydXN0IEdtYkgxKjAoBgNVBAMMIUQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgRVYgMjAw
- OTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJnxhDRwui+3MKCOvXwEz75ivJn9gpfS
- egpnljgJ9hBOlSJzmY3aFS3nBfwZcyK3jpgAvDw9rKFs+9Z5JUut8Mxk2og+KbgPCdM03TP1YtHh
- zRnp7hhPTFiu4h7WDFsVWtg6uMQYZB7jM7K1iXdODL/ZlGsTl28So/6ZqQTMFexgaDbtCHu39b+T
- 7WYxg4zGcTSHThfqr4uRjRxWQa4iN1438h3Z0S0NL2lRp75mpoo6Kr3HGrHhFPC+Oh25z1uxav60
- sUYgovseO3Dvk5h9jHOW8sXvhXCtKSb8HgQ+HKDYD8tSg2J87otTlZCpV6LqYQXY+U3EJ/pure35
- 11H3a6UCAwEAAaOCASQwggEgMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFNOUikxiEyoZLsyv
- cop9NteaHNxnMA4GA1UdDwEB/wQEAwIBBjCB3QYDVR0fBIHVMIHSMIGHoIGEoIGBhn9sZGFwOi8v
- ZGlyZWN0b3J5LmQtdHJ1c3QubmV0L0NOPUQtVFJVU1QlMjBSb290JTIwQ2xhc3MlMjAzJTIwQ0El
- MjAyJTIwRVYlMjAyMDA5LE89RC1UcnVzdCUyMEdtYkgsQz1ERT9jZXJ0aWZpY2F0ZXJldm9jYXRp
- b25saXN0MEagRKBChkBodHRwOi8vd3d3LmQtdHJ1c3QubmV0L2NybC9kLXRydXN0X3Jvb3RfY2xh
- c3NfM19jYV8yX2V2XzIwMDkuY3JsMA0GCSqGSIb3DQEBCwUAA4IBAQA07XtaPKSUiO8aEXUHL7P+
- PPoeUSbrh/Yp3uDx1MYkCenBz1UbtDDZzhr+BlGmFaQt77JLvyAoJUnRpjZ3NOhk31KxEcdzes05
- nsKtjHEh8lprr988TlWvsoRlFIm5d8sqMb7Po23Pb0iUMkZv53GMoKaEGTcH8gNFCSuGdXzfX2lX
- ANtu2KZyIktQ1HWYVt+3GP9DQ1CuekR78HlR10M9p9OB0/DJT7naxpeG0ILD5EJt/rDiZE4OJudA
- NCa1CInXCGNjOCd1HjPqbqjdn5lPdE2BiYBL3ZqXKVwvvoFBuYz/6n1gBp7N1z3TLqMVvKjmJuVv
- w9y4AyHqnxbxLFS1
- -----END CERTIFICATE-----
- CA Disig Root R2
- ================
- -----BEGIN CERTIFICATE-----
- MIIFaTCCA1GgAwIBAgIJAJK4iNuwisFjMA0GCSqGSIb3DQEBCwUAMFIxCzAJBgNVBAYTAlNLMRMw
- EQYDVQQHEwpCcmF0aXNsYXZhMRMwEQYDVQQKEwpEaXNpZyBhLnMuMRkwFwYDVQQDExBDQSBEaXNp
- ZyBSb290IFIyMB4XDTEyMDcxOTA5MTUzMFoXDTQyMDcxOTA5MTUzMFowUjELMAkGA1UEBhMCU0sx
- EzARBgNVBAcTCkJyYXRpc2xhdmExEzARBgNVBAoTCkRpc2lnIGEucy4xGTAXBgNVBAMTEENBIERp
- c2lnIFJvb3QgUjIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCio8QACdaFXS1tFPbC
- w3OeNcJxVX6B+6tGUODBfEl45qt5WDza/3wcn9iXAng+a0EE6UG9vgMsRfYvZNSrXaNHPWSb6Wia
- xswbP7q+sos0Ai6YVRn8jG+qX9pMzk0DIaPY0jSTVpbLTAwAFjxfGs3Ix2ymrdMxp7zo5eFm1tL7
- A7RBZckQrg4FY8aAamkw/dLukO8NJ9+flXP04SXabBbeQTg06ov80egEFGEtQX6sx3dOy1FU+16S
- GBsEWmjGycT6txOgmLcRK7fWV8x8nhfRyyX+hk4kLlYMeE2eARKmK6cBZW58Yh2EhN/qwGu1pSqV
- g8NTEQxzHQuyRpDRQjrOQG6Vrf/GlK1ul4SOfW+eioANSW1z4nuSHsPzwfPrLgVv2RvPN3YEyLRa
- 5Beny912H9AZdugsBbPWnDTYltxhh5EF5EQIM8HauQhl1K6yNg3ruji6DOWbnuuNZt2Zz9aJQfYE
- koopKW1rOhzndX0CcQ7zwOe9yxndnWCywmZgtrEE7snmhrmaZkCo5xHtgUUDi/ZnWejBBhG93c+A
- Ak9lQHhcR1DIm+YfgXvkRKhbhZri3lrVx/k6RGZL5DJUfORsnLMOPReisjQS1n6yqEm70XooQL6i
- Fh/f5DcfEXP7kAplQ6INfPgGAVUzfbANuPT1rqVCV3w2EYx7XsQDnYx5nQIDAQABo0IwQDAPBgNV
- HRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUtZn4r7CU9eMg1gqtzk5WpC5u
- Qu0wDQYJKoZIhvcNAQELBQADggIBACYGXnDnZTPIgm7ZnBc6G3pmsgH2eDtpXi/q/075KMOYKmFM
- tCQSin1tERT3nLXK5ryeJ45MGcipvXrA1zYObYVybqjGom32+nNjf7xueQgcnYqfGopTpti72TVV
- sRHFqQOzVju5hJMiXn7B9hJSi+osZ7z+Nkz1uM/Rs0mSO9MpDpkblvdhuDvEK7Z4bLQjb/D907Je
- dR+Zlais9trhxTF7+9FGs9K8Z7RiVLoJ92Owk6Ka+elSLotgEqv89WBW7xBci8QaQtyDW2QOy7W8
- 1k/BfDxujRNt+3vrMNDcTa/F1balTFtxyegxvug4BkihGuLq0t4SOVga/4AOgnXmt8kHbA7v/zjx
- mHHEt38OFdAlab0inSvtBfZGR6ztwPDUO+Ls7pZbkBNOHlY667DvlruWIxG68kOGdGSVyCh13x01
- utI3gzhTODY7z2zp+WsO0PsE6E9312UBeIYMej4hYvF/Y3EMyZ9E26gnonW+boE+18DrG5gPcFw0
- sorMwIUY6256s/daoQe/qUKS82Ail+QUoQebTnbAjn39pCXHR+3/H3OszMOl6W8KjptlwlCFtaOg
- UxLMVYdh84GuEEZhvUQhuMI9dM9+JDX6HAcOmz0iyu8xL4ysEr3vQCj8KWefshNPZiTEUxnpHikV
- 7+ZtsH8tZ/3zbBt1RqPlShfppNcL
- -----END CERTIFICATE-----
- ACCVRAIZ1
- =========
- -----BEGIN CERTIFICATE-----
- MIIH0zCCBbugAwIBAgIIXsO3pkN/pOAwDQYJKoZIhvcNAQEFBQAwQjESMBAGA1UEAwwJQUNDVlJB
- SVoxMRAwDgYDVQQLDAdQS0lBQ0NWMQ0wCwYDVQQKDARBQ0NWMQswCQYDVQQGEwJFUzAeFw0xMTA1
- MDUwOTM3MzdaFw0zMDEyMzEwOTM3MzdaMEIxEjAQBgNVBAMMCUFDQ1ZSQUlaMTEQMA4GA1UECwwH
- UEtJQUNDVjENMAsGA1UECgwEQUNDVjELMAkGA1UEBhMCRVMwggIiMA0GCSqGSIb3DQEBAQUAA4IC
- DwAwggIKAoICAQCbqau/YUqXry+XZpp0X9DZlv3P4uRm7x8fRzPCRKPfmt4ftVTdFXxpNRFvu8gM
- jmoYHtiP2Ra8EEg2XPBjs5BaXCQ316PWywlxufEBcoSwfdtNgM3802/J+Nq2DoLSRYWoG2ioPej0
- RGy9ocLLA76MPhMAhN9KSMDjIgro6TenGEyxCQ0jVn8ETdkXhBilyNpAlHPrzg5XPAOBOp0KoVdD
- aaxXbXmQeOW1tDvYvEyNKKGno6e6Ak4l0Squ7a4DIrhrIA8wKFSVf+DuzgpmndFALW4ir50awQUZ
- 0m/A8p/4e7MCQvtQqR0tkw8jq8bBD5L/0KIV9VMJcRz/RROE5iZe+OCIHAr8Fraocwa48GOEAqDG
- WuzndN9wrqODJerWx5eHk6fGioozl2A3ED6XPm4pFdahD9GILBKfb6qkxkLrQaLjlUPTAYVtjrs7
- 8yM2x/474KElB0iryYl0/wiPgL/AlmXz7uxLaL2diMMxs0Dx6M/2OLuc5NF/1OVYm3z61PMOm3WR
- 5LpSLhl+0fXNWhn8ugb2+1KoS5kE3fj5tItQo05iifCHJPqDQsGH+tUtKSpacXpkatcnYGMN285J
- 9Y0fkIkyF/hzQ7jSWpOGYdbhdQrqeWZ2iE9x6wQl1gpaepPluUsXQA+xtrn13k/c4LOsOxFwYIRK
- Q26ZIMApcQrAZQIDAQABo4ICyzCCAscwfQYIKwYBBQUHAQEEcTBvMEwGCCsGAQUFBzAChkBodHRw
- Oi8vd3d3LmFjY3YuZXMvZmlsZWFkbWluL0FyY2hpdm9zL2NlcnRpZmljYWRvcy9yYWl6YWNjdjEu
- Y3J0MB8GCCsGAQUFBzABhhNodHRwOi8vb2NzcC5hY2N2LmVzMB0GA1UdDgQWBBTSh7Tj3zcnk1X2
- VuqB5TbMjB4/vTAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFNKHtOPfNyeTVfZW6oHlNsyM
- Hj+9MIIBcwYDVR0gBIIBajCCAWYwggFiBgRVHSAAMIIBWDCCASIGCCsGAQUFBwICMIIBFB6CARAA
- QQB1AHQAbwByAGkAZABhAGQAIABkAGUAIABDAGUAcgB0AGkAZgBpAGMAYQBjAGkA8wBuACAAUgBh
- AO0AegAgAGQAZQAgAGwAYQAgAEEAQwBDAFYAIAAoAEEAZwBlAG4AYwBpAGEAIABkAGUAIABUAGUA
- YwBuAG8AbABvAGcA7QBhACAAeQAgAEMAZQByAHQAaQBmAGkAYwBhAGMAaQDzAG4AIABFAGwAZQBj
- AHQAcgDzAG4AaQBjAGEALAAgAEMASQBGACAAUQA0ADYAMAAxADEANQA2AEUAKQAuACAAQwBQAFMA
- IABlAG4AIABoAHQAdABwADoALwAvAHcAdwB3AC4AYQBjAGMAdgAuAGUAczAwBggrBgEFBQcCARYk
- aHR0cDovL3d3dy5hY2N2LmVzL2xlZ2lzbGFjaW9uX2MuaHRtMFUGA1UdHwROMEwwSqBIoEaGRGh0
- dHA6Ly93d3cuYWNjdi5lcy9maWxlYWRtaW4vQXJjaGl2b3MvY2VydGlmaWNhZG9zL3JhaXphY2N2
- MV9kZXIuY3JsMA4GA1UdDwEB/wQEAwIBBjAXBgNVHREEEDAOgQxhY2N2QGFjY3YuZXMwDQYJKoZI
- hvcNAQEFBQADggIBAJcxAp/n/UNnSEQU5CmH7UwoZtCPNdpNYbdKl02125DgBS4OxnnQ8pdpD70E
- R9m+27Up2pvZrqmZ1dM8MJP1jaGo/AaNRPTKFpV8M9xii6g3+CfYCS0b78gUJyCpZET/LtZ1qmxN
- YEAZSUNUY9rizLpm5U9EelvZaoErQNV/+QEnWCzI7UiRfD+mAM/EKXMRNt6GGT6d7hmKG9Ww7Y49
- nCrADdg9ZuM8Db3VlFzi4qc1GwQA9j9ajepDvV+JHanBsMyZ4k0ACtrJJ1vnE5Bc5PUzolVt3OAJ
- TS+xJlsndQAJxGJ3KQhfnlmstn6tn1QwIgPBHnFk/vk4CpYY3QIUrCPLBhwepH2NDd4nQeit2hW3
- sCPdK6jT2iWH7ehVRE2I9DZ+hJp4rPcOVkkO1jMl1oRQQmwgEh0q1b688nCBpHBgvgW1m54ERL5h
- I6zppSSMEYCUWqKiuUnSwdzRp+0xESyeGabu4VXhwOrPDYTkF7eifKXeVSUG7szAh1xA2syVP1Xg
- Nce4hL60Xc16gwFy7ofmXx2utYXGJt/mwZrpHgJHnyqobalbz+xFd3+YJ5oyXSrjhO7FmGYvliAd
- 3djDJ9ew+f7Zfc3Qn48LFFhRny+Lwzgt3uiP1o2HpPVWQxaZLPSkVrQ0uGE3ycJYgBugl6H8WY3p
- EfbRD0tVNEYqi4Y7
- -----END CERTIFICATE-----
- TWCA Global Root CA
- ===================
- -----BEGIN CERTIFICATE-----
- MIIFQTCCAymgAwIBAgICDL4wDQYJKoZIhvcNAQELBQAwUTELMAkGA1UEBhMCVFcxEjAQBgNVBAoT
- CVRBSVdBTi1DQTEQMA4GA1UECxMHUm9vdCBDQTEcMBoGA1UEAxMTVFdDQSBHbG9iYWwgUm9vdCBD
- QTAeFw0xMjA2MjcwNjI4MzNaFw0zMDEyMzExNTU5NTlaMFExCzAJBgNVBAYTAlRXMRIwEAYDVQQK
- EwlUQUlXQU4tQ0ExEDAOBgNVBAsTB1Jvb3QgQ0ExHDAaBgNVBAMTE1RXQ0EgR2xvYmFsIFJvb3Qg
- Q0EwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCwBdvI64zEbooh745NnHEKH1Jw7W2C
- nJfF10xORUnLQEK1EjRsGcJ0pDFfhQKX7EMzClPSnIyOt7h52yvVavKOZsTuKwEHktSz0ALfUPZV
- r2YOy+BHYC8rMjk1Ujoog/h7FsYYuGLWRyWRzvAZEk2tY/XTP3VfKfChMBwqoJimFb3u/Rk28OKR
- Q4/6ytYQJ0lM793B8YVwm8rqqFpD/G2Gb3PpN0Wp8DbHzIh1HrtsBv+baz4X7GGqcXzGHaL3SekV
- tTzWoWH1EfcFbx39Eb7QMAfCKbAJTibc46KokWofwpFFiFzlmLhxpRUZyXx1EcxwdE8tmx2RRP1W
- KKD+u4ZqyPpcC1jcxkt2yKsi2XMPpfRaAok/T54igu6idFMqPVMnaR1sjjIsZAAmY2E2TqNGtz99
- sy2sbZCilaLOz9qC5wc0GZbpuCGqKX6mOL6OKUohZnkfs8O1CWfe1tQHRvMq2uYiN2DLgbYPoA/p
- yJV/v1WRBXrPPRXAb94JlAGD1zQbzECl8LibZ9WYkTunhHiVJqRaCPgrdLQABDzfuBSO6N+pjWxn
- kjMdwLfS7JLIvgm/LCkFbwJrnu+8vyq8W8BQj0FwcYeyTbcEqYSjMq+u7msXi7Kx/mzhkIyIqJdI
- zshNy/MGz19qCkKxHh53L46g5pIOBvwFItIm4TFRfTLcDwIDAQABoyMwITAOBgNVHQ8BAf8EBAMC
- AQYwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAgEAXzSBdu+WHdXltdkCY4QWwa6g
- cFGn90xHNcgL1yg9iXHZqjNB6hQbbCEAwGxCGX6faVsgQt+i0trEfJdLjbDorMjupWkEmQqSpqsn
- LhpNgb+E1HAerUf+/UqdM+DyucRFCCEK2mlpc3INvjT+lIutwx4116KD7+U4x6WFH6vPNOw/KP4M
- 8VeGTslV9xzU2KV9Bnpv1d8Q34FOIWWxtuEXeZVFBs5fzNxGiWNoRI2T9GRwoD2dKAXDOXC4Ynsg
- /eTb6QihuJ49CcdP+yz4k3ZB3lLg4VfSnQO8d57+nile98FRYB/e2guyLXW3Q0iT5/Z5xoRdgFlg
- lPx4mI88k1HtQJAH32RjJMtOcQWh15QaiDLxInQirqWm2BJpTGCjAu4r7NRjkgtevi92a6O2JryP
- A9gK8kxkRr05YuWW6zRjESjMlfGt7+/cgFhI6Uu46mWs6fyAtbXIRfmswZ/ZuepiiI7E8UuDEq3m
- i4TWnsLrgxifarsbJGAzcMzs9zLzXNl5fe+epP7JI8Mk7hWSsT2RTyaGvWZzJBPqpK5jwa19hAM8
- EHiGG3njxPPyBJUgriOCxLM6AGK/5jYk4Ve6xx6QddVfP5VhK8E7zeWzaGHQRiapIVJpLesux+t3
- zqY6tQMzT3bR51xUAV3LePTJDL/PEo4XLSNolOer/qmyKwbQBM0=
- -----END CERTIFICATE-----
- TeliaSonera Root CA v1
- ======================
- -----BEGIN CERTIFICATE-----
- MIIFODCCAyCgAwIBAgIRAJW+FqD3LkbxezmCcvqLzZYwDQYJKoZIhvcNAQEFBQAwNzEUMBIGA1UE
- CgwLVGVsaWFTb25lcmExHzAdBgNVBAMMFlRlbGlhU29uZXJhIFJvb3QgQ0EgdjEwHhcNMDcxMDE4
- MTIwMDUwWhcNMzIxMDE4MTIwMDUwWjA3MRQwEgYDVQQKDAtUZWxpYVNvbmVyYTEfMB0GA1UEAwwW
- VGVsaWFTb25lcmEgUm9vdCBDQSB2MTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMK+
- 6yfwIaPzaSZVfp3FVRaRXP3vIb9TgHot0pGMYzHw7CTww6XScnwQbfQ3t+XmfHnqjLWCi65ItqwA
- 3GV17CpNX8GH9SBlK4GoRz6JI5UwFpB/6FcHSOcZrr9FZ7E3GwYq/t75rH2D+1665I+XZ75Ljo1k
- B1c4VWk0Nj0TSO9P4tNmHqTPGrdeNjPUtAa9GAH9d4RQAEX1jF3oI7x+/jXh7VB7qTCNGdMJjmhn
- Xb88lxhTuylixcpecsHHltTbLaC0H2kD7OriUPEMPPCs81Mt8Bz17Ww5OXOAFshSsCPN4D7c3TxH
- oLs1iuKYaIu+5b9y7tL6pe0S7fyYGKkmdtwoSxAgHNN/Fnct7W+A90m7UwW7XWjH1Mh1Fj+JWov3
- F0fUTPHSiXk+TT2YqGHeOh7S+F4D4MHJHIzTjU3TlTazN19jY5szFPAtJmtTfImMMsJu7D0hADnJ
- oWjiUIMusDor8zagrC/kb2HCUQk5PotTubtn2txTuXZZNp1D5SDgPTJghSJRt8czu90VL6R4pgd7
- gUY2BIbdeTXHlSw7sKMXNeVzH7RcWe/a6hBle3rQf5+ztCo3O3CLm1u5K7fsslESl1MpWtTwEhDc
- TwK7EpIvYtQ/aUN8Ddb8WHUBiJ1YFkveupD/RwGJBmr2X7KQarMCpgKIv7NHfirZ1fpoeDVNAgMB
- AAGjPzA9MA8GA1UdEwEB/wQFMAMBAf8wCwYDVR0PBAQDAgEGMB0GA1UdDgQWBBTwj1k4ALP1j5qW
- DNXr+nuqF+gTEjANBgkqhkiG9w0BAQUFAAOCAgEAvuRcYk4k9AwI//DTDGjkk0kiP0Qnb7tt3oNm
- zqjMDfz1mgbldxSR651Be5kqhOX//CHBXfDkH1e3damhXwIm/9fH907eT/j3HEbAek9ALCI18Bmx
- 0GtnLLCo4MBANzX2hFxc469CeP6nyQ1Q6g2EdvZR74NTxnr/DlZJLo961gzmJ1TjTQpgcmLNkQfW
- pb/ImWvtxBnmq0wROMVvMeJuScg/doAmAyYp4Db29iBT4xdwNBedY2gea+zDTYa4EzAvXUYNR0PV
- G6pZDrlcjQZIrXSHX8f8MVRBE+LHIQ6e4B4N4cB7Q4WQxYpYxmUKeFfyxiMPAdkgS94P+5KFdSpc
- c41teyWRyu5FrgZLAMzTsVlQ2jqIOylDRl6XK1TOU2+NSueW+r9xDkKLfP0ooNBIytrEgUy7onOT
- JsjrDNYmiLbAJM+7vVvrdX3pCI6GMyx5dwlppYn8s3CQh3aP0yK7Qs69cwsgJirQmz1wHiRszYd2
- qReWt88NkvuOGKmYSdGe/mBEciG5Ge3C9THxOUiIkCR1VBatzvT4aRRkOfujuLpwQMcnHL/EVlP6
- Y2XQ8xwOFvVrhlhNGNTkDY6lnVuR3HYkUD/GKvvZt5y11ubQ2egZixVxSK236thZiNSQvxaz2ems
- WWFUyBy6ysHK4bkgTI86k4mloMy/0/Z1pHWWbVY=
- -----END CERTIFICATE-----
- E-Tugra Certification Authority
- ===============================
- -----BEGIN CERTIFICATE-----
- MIIGSzCCBDOgAwIBAgIIamg+nFGby1MwDQYJKoZIhvcNAQELBQAwgbIxCzAJBgNVBAYTAlRSMQ8w
- DQYDVQQHDAZBbmthcmExQDA+BgNVBAoMN0UtVHXEn3JhIEVCRyBCaWxpxZ9pbSBUZWtub2xvamls
- ZXJpIHZlIEhpem1ldGxlcmkgQS7Fni4xJjAkBgNVBAsMHUUtVHVncmEgU2VydGlmaWthc3lvbiBN
- ZXJrZXppMSgwJgYDVQQDDB9FLVR1Z3JhIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTEzMDMw
- NTEyMDk0OFoXDTIzMDMwMzEyMDk0OFowgbIxCzAJBgNVBAYTAlRSMQ8wDQYDVQQHDAZBbmthcmEx
- QDA+BgNVBAoMN0UtVHXEn3JhIEVCRyBCaWxpxZ9pbSBUZWtub2xvamlsZXJpIHZlIEhpem1ldGxl
- cmkgQS7Fni4xJjAkBgNVBAsMHUUtVHVncmEgU2VydGlmaWthc3lvbiBNZXJrZXppMSgwJgYDVQQD
- DB9FLVR1Z3JhIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIICIjANBgkqhkiG9w0BAQEFAAOCAg8A
- MIICCgKCAgEA4vU/kwVRHoViVF56C/UYB4Oufq9899SKa6VjQzm5S/fDxmSJPZQuVIBSOTkHS0vd
- hQd2h8y/L5VMzH2nPbxHD5hw+IyFHnSOkm0bQNGZDbt1bsipa5rAhDGvykPL6ys06I+XawGb1Q5K
- CKpbknSFQ9OArqGIW66z6l7LFpp3RMih9lRozt6Plyu6W0ACDGQXwLWTzeHxE2bODHnv0ZEoq1+g
- ElIwcxmOj+GMB6LDu0rw6h8VqO4lzKRG+Bsi77MOQ7osJLjFLFzUHPhdZL3Dk14opz8n8Y4e0ypQ
- BaNV2cvnOVPAmJ6MVGKLJrD3fY185MaeZkJVgkfnsliNZvcHfC425lAcP9tDJMW/hkd5s3kc91r0
- E+xs+D/iWR+V7kI+ua2oMoVJl0b+SzGPWsutdEcf6ZG33ygEIqDUD13ieU/qbIWGvaimzuT6w+Gz
- rt48Ue7LE3wBf4QOXVGUnhMMti6lTPk5cDZvlsouDERVxcr6XQKj39ZkjFqzAQqptQpHF//vkUAq
- jqFGOjGY5RH8zLtJVor8udBhmm9lbObDyz51Sf6Pp+KJxWfXnUYTTjF2OySznhFlhqt/7x3U+Lzn
- rFpct1pHXFXOVbQicVtbC/DP3KBhZOqp12gKY6fgDT+gr9Oq0n7vUaDmUStVkhUXU8u3Zg5mTPj5
- dUyQ5xJwx0UCAwEAAaNjMGEwHQYDVR0OBBYEFC7j27JJ0JxUeVz6Jyr+zE7S6E5UMA8GA1UdEwEB
- /wQFMAMBAf8wHwYDVR0jBBgwFoAULuPbsknQnFR5XPonKv7MTtLoTlQwDgYDVR0PAQH/BAQDAgEG
- MA0GCSqGSIb3DQEBCwUAA4ICAQAFNzr0TbdF4kV1JI+2d1LoHNgQk2Xz8lkGpD4eKexd0dCrfOAK
- kEh47U6YA5n+KGCRHTAduGN8qOY1tfrTYXbm1gdLymmasoR6d5NFFxWfJNCYExL/u6Au/U5Mh/jO
- XKqYGwXgAEZKgoClM4so3O0409/lPun++1ndYYRP0lSWE2ETPo+Aab6TR7U1Q9Jauz1c77NCR807
- VRMGsAnb/WP2OogKmW9+4c4bU2pEZiNRCHu8W1Ki/QY3OEBhj0qWuJA3+GbHeJAAFS6LrVE1Uweo
- a2iu+U48BybNCAVwzDk/dr2l02cmAYamU9JgO3xDf1WKvJUawSg5TB9D0pH0clmKuVb8P7Sd2nCc
- dlqMQ1DujjByTd//SffGqWfZbawCEeI6FiWnWAjLb1NBnEg4R2gz0dfHj9R0IdTDBZB6/86WiLEV
- KV0jq9BgoRJP3vQXzTLlyb/IQ639Lo7xr+L0mPoSHyDYwKcMhcWQ9DstliaxLL5Mq+ux0orJ23gT
- Dx4JnW2PAJ8C2sH6H3p6CcRK5ogql5+Ji/03X186zjhZhkuvcQu02PJwT58yE+Owp1fl2tpDy4Q0
- 8ijE6m30Ku/Ba3ba+367hTzSU8JNvnHhRdH9I2cNE3X7z2VnIp2usAnRCf8dNL/+I5c30jn6PQ0G
- C7TbO6Orb1wdtn7os4I07QZcJA==
- -----END CERTIFICATE-----
- T-TeleSec GlobalRoot Class 2
- ============================
- -----BEGIN CERTIFICATE-----
- MIIDwzCCAqugAwIBAgIBATANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoM
- IlQtU3lzdGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBU
- cnVzdCBDZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDIwHhcNMDgx
- MDAxMTA0MDE0WhcNMzMxMDAxMjM1OTU5WjCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoMIlQtU3lz
- dGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBD
- ZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDIwggEiMA0GCSqGSIb3
- DQEBAQUAA4IBDwAwggEKAoIBAQCqX9obX+hzkeXaXPSi5kfl82hVYAUdAqSzm1nzHoqvNK38DcLZ
- SBnuaY/JIPwhqgcZ7bBcrGXHX+0CfHt8LRvWurmAwhiCFoT6ZrAIxlQjgeTNuUk/9k9uN0goOA/F
- vudocP05l03Sx5iRUKrERLMjfTlH6VJi1hKTXrcxlkIF+3anHqP1wvzpesVsqXFP6st4vGCvx970
- 2cu+fjOlbpSD8DT6IavqjnKgP6TeMFvvhk1qlVtDRKgQFRzlAVfFmPHmBiiRqiDFt1MmUUOyCxGV
- WOHAD3bZwI18gfNycJ5v/hqO2V81xrJvNHy+SE/iWjnX2J14np+GPgNeGYtEotXHAgMBAAGjQjBA
- MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBS/WSA2AHmgoCJrjNXy
- YdK4LMuCSjANBgkqhkiG9w0BAQsFAAOCAQEAMQOiYQsfdOhyNsZt+U2e+iKo4YFWz827n+qrkRk4
- r6p8FU3ztqONpfSO9kSpp+ghla0+AGIWiPACuvxhI+YzmzB6azZie60EI4RYZeLbK4rnJVM3YlNf
- vNoBYimipidx5joifsFvHZVwIEoHNN/q/xWA5brXethbdXwFeilHfkCoMRN3zUA7tFFHei4R40cR
- 3p1m0IvVVGb6g1XqfMIpiRvpb7PO4gWEyS8+eIVibslfwXhjdFjASBgMmTnrpMwatXlajRWc2BQN
- 9noHV8cigwUtPJslJj0Ys6lDfMjIq2SPDqO/nBudMNva0Bkuqjzx+zOAduTNrRlPBSeOE6Fuwg==
- -----END CERTIFICATE-----
- Atos TrustedRoot 2011
- =====================
- -----BEGIN CERTIFICATE-----
- MIIDdzCCAl+gAwIBAgIIXDPLYixfszIwDQYJKoZIhvcNAQELBQAwPDEeMBwGA1UEAwwVQXRvcyBU
- cnVzdGVkUm9vdCAyMDExMQ0wCwYDVQQKDARBdG9zMQswCQYDVQQGEwJERTAeFw0xMTA3MDcxNDU4
- MzBaFw0zMDEyMzEyMzU5NTlaMDwxHjAcBgNVBAMMFUF0b3MgVHJ1c3RlZFJvb3QgMjAxMTENMAsG
- A1UECgwEQXRvczELMAkGA1UEBhMCREUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCV
- hTuXbyo7LjvPpvMpNb7PGKw+qtn4TaA+Gke5vJrf8v7MPkfoepbCJI419KkM/IL9bcFyYie96mvr
- 54rMVD6QUM+A1JX76LWC1BTFtqlVJVfbsVD2sGBkWXppzwO3bw2+yj5vdHLqqjAqc2K+SZFhyBH+
- DgMq92og3AIVDV4VavzjgsG1xZ1kCWyjWZgHJ8cblithdHFsQ/H3NYkQ4J7sVaE3IqKHBAUsR320
- HLliKWYoyrfhk/WklAOZuXCFteZI6o1Q/NnezG8HDt0Lcp2AMBYHlT8oDv3FdU9T1nSatCQujgKR
- z3bFmx5VdJx4IbHwLfELn8LVlhgf8FQieowHAgMBAAGjfTB7MB0GA1UdDgQWBBSnpQaxLKYJYO7R
- l+lwrrw7GWzbITAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFKelBrEspglg7tGX6XCuvDsZ
- bNshMBgGA1UdIAQRMA8wDQYLKwYBBAGwLQMEAQEwDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEB
- CwUAA4IBAQAmdzTblEiGKkGdLD4GkGDEjKwLVLgfuXvTBznk+j57sj1O7Z8jvZfza1zv7v1Apt+h
- k6EKhqzvINB5Ab149xnYJDE0BAGmuhWawyfc2E8PzBhj/5kPDpFrdRbhIfzYJsdHt6bPWHJxfrrh
- TZVHO8mvbaG0weyJ9rQPOLXiZNwlz6bb65pcmaHFCN795trV1lpFDMS3wrUU77QR/w4VtfX128a9
- 61qn8FYiqTxlVMYVqL2Gns2Dlmh6cYGJ4Qvh6hEbaAjMaZ7snkGeRDImeuKHCnE96+RapNLbxc3G
- 3mB/ufNPRJLvKrcYPqcZ2Qt9sTdBQrC6YB3y/gkRsPCHe6ed
- -----END CERTIFICATE-----
- QuoVadis Root CA 1 G3
- =====================
- -----BEGIN CERTIFICATE-----
- MIIFYDCCA0igAwIBAgIUeFhfLq0sGUvjNwc1NBMotZbUZZMwDQYJKoZIhvcNAQELBQAwSDELMAkG
- A1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAcBgNVBAMTFVF1b1ZhZGlzIFJv
- b3QgQ0EgMSBHMzAeFw0xMjAxMTIxNzI3NDRaFw00MjAxMTIxNzI3NDRaMEgxCzAJBgNVBAYTAkJN
- MRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDEg
- RzMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCgvlAQjunybEC0BJyFuTHK3C3kEakE
- PBtVwedYMB0ktMPvhd6MLOHBPd+C5k+tR4ds7FtJwUrVu4/sh6x/gpqG7D0DmVIB0jWerNrwU8lm
- PNSsAgHaJNM7qAJGr6Qc4/hzWHa39g6QDbXwz8z6+cZM5cOGMAqNF34168Xfuw6cwI2H44g4hWf6
- Pser4BOcBRiYz5P1sZK0/CPTz9XEJ0ngnjybCKOLXSoh4Pw5qlPafX7PGglTvF0FBM+hSo+LdoIN
- ofjSxxR3W5A2B4GbPgb6Ul5jxaYA/qXpUhtStZI5cgMJYr2wYBZupt0lwgNm3fME0UDiTouG9G/l
- g6AnhF4EwfWQvTA9xO+oabw4m6SkltFi2mnAAZauy8RRNOoMqv8hjlmPSlzkYZqn0ukqeI1RPToV
- 7qJZjqlc3sX5kCLliEVx3ZGZbHqfPT2YfF72vhZooF6uCyP8Wg+qInYtyaEQHeTTRCOQiJ/GKubX
- 9ZqzWB4vMIkIG1SitZgj7Ah3HJVdYdHLiZxfokqRmu8hqkkWCKi9YSgxyXSthfbZxbGL0eUQMk1f
- iyA6PEkfM4VZDdvLCXVDaXP7a3F98N/ETH3Goy7IlXnLc6KOTk0k+17kBL5yG6YnLUlamXrXXAkg
- t3+UuU/xDRxeiEIbEbfnkduebPRq34wGmAOtzCjvpUfzUwIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
- AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUo5fW816iEOGrRZ88F2Q87gFwnMwwDQYJKoZI
- hvcNAQELBQADggIBABj6W3X8PnrHX3fHyt/PX8MSxEBd1DKquGrX1RUVRpgjpeaQWxiZTOOtQqOC
- MTaIzen7xASWSIsBx40Bz1szBpZGZnQdT+3Btrm0DWHMY37XLneMlhwqI2hrhVd2cDMT/uFPpiN3
- GPoajOi9ZcnPP/TJF9zrx7zABC4tRi9pZsMbj/7sPtPKlL92CiUNqXsCHKnQO18LwIE6PWThv6ct
- Tr1NxNgpxiIY0MWscgKCP6o6ojoilzHdCGPDdRS5YCgtW2jgFqlmgiNR9etT2DGbe+m3nUvriBbP
- +V04ikkwj+3x6xn0dxoxGE1nVGwvb2X52z3sIexe9PSLymBlVNFxZPT5pqOBMzYzcfCkeF9OrYMh
- 3jRJjehZrJ3ydlo28hP0r+AJx2EqbPfgna67hkooby7utHnNkDPDs3b69fBsnQGQ+p6Q9pxyz0fa
- wx/kNSBT8lTR32GDpgLiJTjehTItXnOQUl1CxM49S+H5GYQd1aJQzEH7QRTDvdbJWqNjZgKAvQU6
- O0ec7AAmTPWIUb+oI38YB7AL7YsmoWTTYUrrXJ/es69nA7Mf3W1daWhpq1467HxpvMc7hU6eFbm0
- FU/DlXpY18ls6Wy58yljXrQs8C097Vpl4KlbQMJImYFtnh8GKjwStIsPm6Ik8KaN1nrgS7ZklmOV
- hMJKzRwuJIczYOXD
- -----END CERTIFICATE-----
- QuoVadis Root CA 2 G3
- =====================
- -----BEGIN CERTIFICATE-----
- MIIFYDCCA0igAwIBAgIURFc0JFuBiZs18s64KztbpybwdSgwDQYJKoZIhvcNAQELBQAwSDELMAkG
- A1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAcBgNVBAMTFVF1b1ZhZGlzIFJv
- b3QgQ0EgMiBHMzAeFw0xMjAxMTIxODU5MzJaFw00MjAxMTIxODU5MzJaMEgxCzAJBgNVBAYTAkJN
- MRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDIg
- RzMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQChriWyARjcV4g/Ruv5r+LrI3HimtFh
- ZiFfqq8nUeVuGxbULX1QsFN3vXg6YOJkApt8hpvWGo6t/x8Vf9WVHhLL5hSEBMHfNrMWn4rjyduY
- NM7YMxcoRvynyfDStNVNCXJJ+fKH46nafaF9a7I6JaltUkSs+L5u+9ymc5GQYaYDFCDy54ejiK2t
- oIz/pgslUiXnFgHVy7g1gQyjO/Dh4fxaXc6AcW34Sas+O7q414AB+6XrW7PFXmAqMaCvN+ggOp+o
- MiwMzAkd056OXbxMmO7FGmh77FOm6RQ1o9/NgJ8MSPsc9PG/Srj61YxxSscfrf5BmrODXfKEVu+l
- V0POKa2Mq1W/xPtbAd0jIaFYAI7D0GoT7RPjEiuA3GfmlbLNHiJuKvhB1PLKFAeNilUSxmn1uIZo
- L1NesNKqIcGY5jDjZ1XHm26sGahVpkUG0CM62+tlXSoREfA7T8pt9DTEceT/AFr2XK4jYIVz8eQQ
- sSWu1ZK7E8EM4DnatDlXtas1qnIhO4M15zHfeiFuuDIIfR0ykRVKYnLP43ehvNURG3YBZwjgQQvD
- 6xVu+KQZ2aKrr+InUlYrAoosFCT5v0ICvybIxo/gbjh9Uy3l7ZizlWNof/k19N+IxWA1ksB8aRxh
- lRbQ694Lrz4EEEVlWFA4r0jyWbYW8jwNkALGcC4BrTwV1wIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
- AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQU7edvdlq/YOxJW8ald7tyFnGbxD0wDQYJKoZI
- hvcNAQELBQADggIBAJHfgD9DCX5xwvfrs4iP4VGyvD11+ShdyLyZm3tdquXK4Qr36LLTn91nMX66
- AarHakE7kNQIXLJgapDwyM4DYvmL7ftuKtwGTTwpD4kWilhMSA/ohGHqPHKmd+RCroijQ1h5fq7K
- pVMNqT1wvSAZYaRsOPxDMuHBR//47PERIjKWnML2W2mWeyAMQ0GaW/ZZGYjeVYg3UQt4XAoeo0L9
- x52ID8DyeAIkVJOviYeIyUqAHerQbj5hLja7NQ4nlv1mNDthcnPxFlxHBlRJAHpYErAK74X9sbgz
- dWqTHBLmYF5vHX/JHyPLhGGfHoJE+V+tYlUkmlKY7VHnoX6XOuYvHxHaU4AshZ6rNRDbIl9qxV6X
- U/IyAgkwo1jwDQHVcsaxfGl7w/U2Rcxhbl5MlMVerugOXou/983g7aEOGzPuVBj+D77vfoRrQ+Nw
- mNtddbINWQeFFSM51vHfqSYP1kjHs6Yi9TM3WpVHn3u6GBVv/9YUZINJ0gpnIdsPNWNgKCLjsZWD
- zYWm3S8P52dSbrsvhXz1SnPnxT7AvSESBT/8twNJAlvIJebiVDj1eYeMHVOyToV7BjjHLPj4sHKN
- JeV3UvQDHEimUF+IIDBu8oJDqz2XhOdT+yHBTw8imoa4WSr2Rz0ZiC3oheGe7IUIarFsNMkd7Egr
- O3jtZsSOeWmD3n+M
- -----END CERTIFICATE-----
- QuoVadis Root CA 3 G3
- =====================
- -----BEGIN CERTIFICATE-----
- MIIFYDCCA0igAwIBAgIULvWbAiin23r/1aOp7r0DoM8Sah0wDQYJKoZIhvcNAQELBQAwSDELMAkG
- A1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAcBgNVBAMTFVF1b1ZhZGlzIFJv
- b3QgQ0EgMyBHMzAeFw0xMjAxMTIyMDI2MzJaFw00MjAxMTIyMDI2MzJaMEgxCzAJBgNVBAYTAkJN
- MRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDMg
- RzMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCzyw4QZ47qFJenMioKVjZ/aEzHs286
- IxSR/xl/pcqs7rN2nXrpixurazHb+gtTTK/FpRp5PIpM/6zfJd5O2YIyC0TeytuMrKNuFoM7pmRL
- Mon7FhY4futD4tN0SsJiCnMK3UmzV9KwCoWdcTzeo8vAMvMBOSBDGzXRU7Ox7sWTaYI+FrUoRqHe
- 6okJ7UO4BUaKhvVZR74bbwEhELn9qdIoyhA5CcoTNs+cra1AdHkrAj80//ogaX3T7mH1urPnMNA3
- I4ZyYUUpSFlob3emLoG+B01vr87ERRORFHAGjx+f+IdpsQ7vw4kZ6+ocYfx6bIrc1gMLnia6Et3U
- VDmrJqMz6nWB2i3ND0/kA9HvFZcba5DFApCTZgIhsUfei5pKgLlVj7WiL8DWM2fafsSntARE60f7
- 5li59wzweyuxwHApw0BiLTtIadwjPEjrewl5qW3aqDCYz4ByA4imW0aucnl8CAMhZa634RylsSqi
- Md5mBPfAdOhx3v89WcyWJhKLhZVXGqtrdQtEPREoPHtht+KPZ0/l7DxMYIBpVzgeAVuNVejH38DM
- dyM0SXV89pgR6y3e7UEuFAUCf+D+IOs15xGsIs5XPd7JMG0QA4XN8f+MFrXBsj6IbGB/kE+V9/Yt
- rQE5BwT6dYB9v0lQ7e/JxHwc64B+27bQ3RP+ydOc17KXqQIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
- AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUxhfQvKjqAkPyGwaZXSuQILnXnOQwDQYJKoZI
- hvcNAQELBQADggIBADRh2Va1EodVTd2jNTFGu6QHcrxfYWLopfsLN7E8trP6KZ1/AvWkyaiTt3px
- KGmPc+FSkNrVvjrlt3ZqVoAh313m6Tqe5T72omnHKgqwGEfcIHB9UqM+WXzBusnIFUBhynLWcKzS
- t/Ac5IYp8M7vaGPQtSCKFWGafoaYtMnCdvvMujAWzKNhxnQT5WvvoxXqA/4Ti2Tk08HS6IT7SdEQ
- TXlm66r99I0xHnAUrdzeZxNMgRVhvLfZkXdxGYFgu/BYpbWcC/ePIlUnwEsBbTuZDdQdm2NnL9Du
- DcpmvJRPpq3t/O5jrFc/ZSXPsoaP0Aj/uHYUbt7lJ+yreLVTubY/6CD50qi+YUbKh4yE8/nxoGib
- Ih6BJpsQBJFxwAYf3KDTuVan45gtf4Od34wrnDKOMpTwATwiKp9Dwi7DmDkHOHv8XgBCH/MyJnmD
- hPbl8MFREsALHgQjDFSlTC9JxUrRtm5gDWv8a4uFJGS3iQ6rJUdbPM9+Sb3H6QrG2vd+DhcI00iX
- 0HGS8A85PjRqHH3Y8iKuu2n0M7SmSFXRDw4m6Oy2Cy2nhTXN/VnIn9HNPlopNLk9hM6xZdRZkZFW
- dSHBd575euFgndOtBBj0fOtek49TSiIp+EgrPk2GrFt/ywaZWWDYWGWVjUTR939+J399roD1B0y2
- PpxxVJkES/1Y+Zj0
- -----END CERTIFICATE-----
- DigiCert Assured ID Root G2
- ===========================
- -----BEGIN CERTIFICATE-----
- MIIDljCCAn6gAwIBAgIQC5McOtY5Z+pnI7/Dr5r0SzANBgkqhkiG9w0BAQsFADBlMQswCQYDVQQG
- EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSQw
- IgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzIwHhcNMTMwODAxMTIwMDAwWhcNMzgw
- MTE1MTIwMDAwWjBlMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQL
- ExB3d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzIw
- ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDZ5ygvUj82ckmIkzTz+GoeMVSAn61UQbVH
- 35ao1K+ALbkKz3X9iaV9JPrjIgwrvJUXCzO/GU1BBpAAvQxNEP4HteccbiJVMWWXvdMX0h5i89vq
- bFCMP4QMls+3ywPgym2hFEwbid3tALBSfK+RbLE4E9HpEgjAALAcKxHad3A2m67OeYfcgnDmCXRw
- VWmvo2ifv922ebPynXApVfSr/5Vh88lAbx3RvpO704gqu52/clpWcTs/1PPRCv4o76Pu2ZmvA9OP
- YLfykqGxvYmJHzDNw6YuYjOuFgJ3RFrngQo8p0Quebg/BLxcoIfhG69Rjs3sLPr4/m3wOnyqi+Rn
- lTGNAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBTO
- w0q5mVXyuNtgv6l+vVa1lzan1jANBgkqhkiG9w0BAQsFAAOCAQEAyqVVjOPIQW5pJ6d1Ee88hjZv
- 0p3GeDgdaZaikmkuOGybfQTUiaWxMTeKySHMq2zNixya1r9I0jJmwYrA8y8678Dj1JGG0VDjA9tz
- d29KOVPt3ibHtX2vK0LRdWLjSisCx1BL4GnilmwORGYQRI+tBev4eaymG+g3NJ1TyWGqolKvSnAW
- hsI6yLETcDbYz+70CjTVW0z9B5yiutkBclzzTcHdDrEcDcRjvq30FPuJ7KJBDkzMyFdA0G4Dqs0M
- jomZmWzwPDCvON9vvKO+KSAnq3T/EyJ43pdSVR6DtVQgA+6uwE9W3jfMw3+qBCe703e4YtsXfJwo
- IhNzbM8m9Yop5w==
- -----END CERTIFICATE-----
- DigiCert Assured ID Root G3
- ===========================
- -----BEGIN CERTIFICATE-----
- MIICRjCCAc2gAwIBAgIQC6Fa+h3foLVJRK/NJKBs7DAKBggqhkjOPQQDAzBlMQswCQYDVQQGEwJV
- UzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSQwIgYD
- VQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzMwHhcNMTMwODAxMTIwMDAwWhcNMzgwMTE1
- MTIwMDAwWjBlMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
- d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzMwdjAQ
- BgcqhkjOPQIBBgUrgQQAIgNiAAQZ57ysRGXtzbg/WPuNsVepRC0FFfLvC/8QdJ+1YlJfZn4f5dwb
- RXkLzMZTCp2NXQLZqVneAlr2lSoOjThKiknGvMYDOAdfVdp+CW7if17QRSAPWXYQ1qAk8C3eNvJs
- KTmjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBTL0L2p4ZgF
- UaFNN6KDec6NHSrkhDAKBggqhkjOPQQDAwNnADBkAjAlpIFFAmsSS3V0T8gj43DydXLefInwz5Fy
- YZ5eEJJZVrmDxxDnOOlYJjZ91eQ0hjkCMHw2U/Aw5WJjOpnitqM7mzT6HtoQknFekROn3aRukswy
- 1vUhZscv6pZjamVFkpUBtA==
- -----END CERTIFICATE-----
- DigiCert Global Root G2
- =======================
- -----BEGIN CERTIFICATE-----
- MIIDjjCCAnagAwIBAgIQAzrx5qcRqaC7KGSxHQn65TANBgkqhkiG9w0BAQsFADBhMQswCQYDVQQG
- EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSAw
- HgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBHMjAeFw0xMzA4MDExMjAwMDBaFw0zODAxMTUx
- MjAwMDBaMGExCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3
- dy5kaWdpY2VydC5jb20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IEcyMIIBIjANBgkq
- hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuzfNNNx7a8myaJCtSnX/RrohCgiN9RlUyfuI2/Ou8jqJ
- kTx65qsGGmvPrC3oXgkkRLpimn7Wo6h+4FR1IAWsULecYxpsMNzaHxmx1x7e/dfgy5SDN67sH0NO
- 3Xss0r0upS/kqbitOtSZpLYl6ZtrAGCSYP9PIUkY92eQq2EGnI/yuum06ZIya7XzV+hdG82MHauV
- BJVJ8zUtluNJbd134/tJS7SsVQepj5WztCO7TG1F8PapspUwtP1MVYwnSlcUfIKdzXOS0xZKBgyM
- UNGPHgm+F6HmIcr9g+UQvIOlCsRnKPZzFBQ9RnbDhxSJITRNrw9FDKZJobq7nMWxM4MphQIDAQAB
- o0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjAdBgNVHQ4EFgQUTiJUIBiV5uNu
- 5g/6+rkS7QYXjzkwDQYJKoZIhvcNAQELBQADggEBAGBnKJRvDkhj6zHd6mcY1Yl9PMWLSn/pvtsr
- F9+wX3N3KjITOYFnQoQj8kVnNeyIv/iPsGEMNKSuIEyExtv4NeF22d+mQrvHRAiGfzZ0JFrabA0U
- WTW98kndth/Jsw1HKj2ZL7tcu7XUIOGZX1NGFdtom/DzMNU+MeKNhJ7jitralj41E6Vf8PlwUHBH
- QRFXGU7Aj64GxJUTFy8bJZ918rGOmaFvE7FBcf6IKshPECBV1/MUReXgRPTqh5Uykw7+U0b6LJ3/
- iyK5S9kJRaTepLiaWN0bfVKfjllDiIGknibVb63dDcY3fe0Dkhvld1927jyNxF1WW6LZZm6zNTfl
- MrY=
- -----END CERTIFICATE-----
- DigiCert Global Root G3
- =======================
- -----BEGIN CERTIFICATE-----
- MIICPzCCAcWgAwIBAgIQBVVWvPJepDU1w6QP1atFcjAKBggqhkjOPQQDAzBhMQswCQYDVQQGEwJV
- UzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSAwHgYD
- VQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBHMzAeFw0xMzA4MDExMjAwMDBaFw0zODAxMTUxMjAw
- MDBaMGExCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5k
- aWdpY2VydC5jb20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IEczMHYwEAYHKoZIzj0C
- AQYFK4EEACIDYgAE3afZu4q4C/sLfyHS8L6+c/MzXRq8NOrexpu80JX28MzQC7phW1FGfp4tn+6O
- YwwX7Adw9c+ELkCDnOg/QW07rdOkFFk2eJ0DQ+4QE2xy3q6Ip6FrtUPOZ9wj/wMco+I+o0IwQDAP
- BgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjAdBgNVHQ4EFgQUs9tIpPmhxdiuNkHMEWNp
- Yim8S8YwCgYIKoZIzj0EAwMDaAAwZQIxAK288mw/EkrRLTnDCgmXc/SINoyIJ7vmiI1Qhadj+Z4y
- 3maTD/HMsQmP3Wyr+mt/oAIwOWZbwmSNuJ5Q3KjVSaLtx9zRSX8XAbjIho9OjIgrqJqpisXRAL34
- VOKa5Vt8sycX
- -----END CERTIFICATE-----
- DigiCert Trusted Root G4
- ========================
- -----BEGIN CERTIFICATE-----
- MIIFkDCCA3igAwIBAgIQBZsbV56OITLiOQe9p3d1XDANBgkqhkiG9w0BAQwFADBiMQswCQYDVQQG
- EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSEw
- HwYDVQQDExhEaWdpQ2VydCBUcnVzdGVkIFJvb3QgRzQwHhcNMTMwODAxMTIwMDAwWhcNMzgwMTE1
- MTIwMDAwWjBiMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
- d3cuZGlnaWNlcnQuY29tMSEwHwYDVQQDExhEaWdpQ2VydCBUcnVzdGVkIFJvb3QgRzQwggIiMA0G
- CSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC/5pBzaN675F1KPDAiMGkz7MKnJS7JIT3yithZwuEp
- pz1Yq3aaza57G4QNxDAf8xukOBbrVsaXbR2rsnnyyhHS5F/WBTxSD1Ifxp4VpX6+n6lXFllVcq9o
- k3DCsrp1mWpzMpTREEQQLt+C8weE5nQ7bXHiLQwb7iDVySAdYyktzuxeTsiT+CFhmzTrBcZe7Fsa
- vOvJz82sNEBfsXpm7nfISKhmV1efVFiODCu3T6cw2Vbuyntd463JT17lNecxy9qTXtyOj4DatpGY
- QJB5w3jHtrHEtWoYOAMQjdjUN6QuBX2I9YI+EJFwq1WCQTLX2wRzKm6RAXwhTNS8rhsDdV14Ztk6
- MUSaM0C/CNdaSaTC5qmgZ92kJ7yhTzm1EVgX9yRcRo9k98FpiHaYdj1ZXUJ2h4mXaXpI8OCiEhtm
- mnTK3kse5w5jrubU75KSOp493ADkRSWJtppEGSt+wJS00mFt6zPZxd9LBADMfRyVw4/3IbKyEbe7
- f/LVjHAsQWCqsWMYRJUadmJ+9oCw++hkpjPRiQfhvbfmQ6QYuKZ3AeEPlAwhHbJUKSWJbOUOUlFH
- dL4mrLZBdd56rF+NP8m800ERElvlEFDrMcXKchYiCd98THU/Y+whX8QgUWtvsauGi0/C1kVfnSD8
- oR7FwI+isX4KJpn15GkvmB0t9dmpsh3lGwIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1Ud
- DwEB/wQEAwIBhjAdBgNVHQ4EFgQU7NfjgtJxXWRM3y5nP+e6mK4cD08wDQYJKoZIhvcNAQEMBQAD
- ggIBALth2X2pbL4XxJEbw6GiAI3jZGgPVs93rnD5/ZpKmbnJeFwMDF/k5hQpVgs2SV1EY+CtnJYY
- ZhsjDT156W1r1lT40jzBQ0CuHVD1UvyQO7uYmWlrx8GnqGikJ9yd+SeuMIW59mdNOj6PWTkiU0Tr
- yF0Dyu1Qen1iIQqAyHNm0aAFYF/opbSnr6j3bTWcfFqK1qI4mfN4i/RN0iAL3gTujJtHgXINwBQy
- 7zBZLq7gcfJW5GqXb5JQbZaNaHqasjYUegbyJLkJEVDXCLG4iXqEI2FCKeWjzaIgQdfRnGTZ6iah
- ixTXTBmyUEFxPT9NcCOGDErcgdLMMpSEDQgJlxxPwO5rIHQw0uA5NBCFIRUBCOhVMt5xSdkoF1BN
- 5r5N0XWs0Mr7QbhDparTwwVETyw2m+L64kW4I1NsBm9nVX9GtUw/bihaeSbSpKhil9Ie4u1Ki7wb
- /UdKDd9nZn6yW0HQO+T0O/QEY+nvwlQAUaCKKsnOeMzV6ocEGLPOr0mIr/OSmbaz5mEP0oUA51Aa
- 5BuVnRmhuZyxm7EAHu/QD09CbMkKvO5D+jpxpchNJqU1/YldvIViHTLSoCtU7ZpXwdv6EM8Zt4tK
- G48BtieVU+i2iW1bvGjUI+iLUaJW+fCmgKDWHrO8Dw9TdSmq6hN35N6MgSGtBxBHEa2HPQfRdbzP
- 82Z+
- -----END CERTIFICATE-----
- COMODO RSA Certification Authority
- ==================================
- -----BEGIN CERTIFICATE-----
- MIIF2DCCA8CgAwIBAgIQTKr5yttjb+Af907YWwOGnTANBgkqhkiG9w0BAQwFADCBhTELMAkGA1UE
- BhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgG
- A1UEChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBSU0EgQ2VydGlmaWNhdGlv
- biBBdXRob3JpdHkwHhcNMTAwMTE5MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBhTELMAkGA1UEBhMC
- R0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UE
- ChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBSU0EgQ2VydGlmaWNhdGlvbiBB
- dXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCR6FSS0gpWsawNJN3Fz0Rn
- dJkrN6N9I3AAcbxT38T6KhKPS38QVr2fcHK3YX/JSw8Xpz3jsARh7v8Rl8f0hj4K+j5c+ZPmNHrZ
- FGvnnLOFoIJ6dq9xkNfs/Q36nGz637CC9BR++b7Epi9Pf5l/tfxnQ3K9DADWietrLNPtj5gcFKt+
- 5eNu/Nio5JIk2kNrYrhV/erBvGy2i/MOjZrkm2xpmfh4SDBF1a3hDTxFYPwyllEnvGfDyi62a+pG
- x8cgoLEfZd5ICLqkTqnyg0Y3hOvozIFIQ2dOciqbXL1MGyiKXCJ7tKuY2e7gUYPDCUZObT6Z+pUX
- 2nwzV0E8jVHtC7ZcryxjGt9XyD+86V3Em69FmeKjWiS0uqlWPc9vqv9JWL7wqP/0uK3pN/u6uPQL
- OvnoQ0IeidiEyxPx2bvhiWC4jChWrBQdnArncevPDt09qZahSL0896+1DSJMwBGB7FY79tOi4lu3
- sgQiUpWAk2nojkxl8ZEDLXB0AuqLZxUpaVICu9ffUGpVRr+goyhhf3DQw6KqLCGqR84onAZFdr+C
- GCe01a60y1Dma/RMhnEw6abfFobg2P9A3fvQQoh/ozM6LlweQRGBY84YcWsr7KaKtzFcOmpH4MN5
- WdYgGq/yapiqcrxXStJLnbsQ/LBMQeXtHT1eKJ2czL+zUdqnR+WEUwIDAQABo0IwQDAdBgNVHQ4E
- FgQUu69+Aj36pvE8hI6t7jiY7NkyMtQwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8w
- DQYJKoZIhvcNAQEMBQADggIBAArx1UaEt65Ru2yyTUEUAJNMnMvlwFTPoCWOAvn9sKIN9SCYPBMt
- rFaisNZ+EZLpLrqeLppysb0ZRGxhNaKatBYSaVqM4dc+pBroLwP0rmEdEBsqpIt6xf4FpuHA1sj+
- nq6PK7o9mfjYcwlYRm6mnPTXJ9OV2jeDchzTc+CiR5kDOF3VSXkAKRzH7JsgHAckaVd4sjn8OoSg
- tZx8jb8uk2IntznaFxiuvTwJaP+EmzzV1gsD41eeFPfR60/IvYcjt7ZJQ3mFXLrrkguhxuhoqEwW
- sRqZCuhTLJK7oQkYdQxlqHvLI7cawiiFwxv/0Cti76R7CZGYZ4wUAc1oBmpjIXUDgIiKboHGhfKp
- pC3n9KUkEEeDys30jXlYsQab5xoq2Z0B15R97QNKyvDb6KkBPvVWmckejkk9u+UJueBPSZI9FoJA
- zMxZxuY67RIuaTxslbH9qh17f4a+Hg4yRvv7E491f0yLS0Zj/gA0QHDBw7mh3aZw4gSzQbzpgJHq
- ZJx64SIDqZxubw5lT2yHh17zbqD5daWbQOhTsiedSrnAdyGN/4fy3ryM7xfft0kL0fJuMAsaDk52
- 7RH89elWsn2/x20Kk4yl0MC2Hb46TpSi125sC8KKfPog88Tk5c0NqMuRkrF8hey1FGlmDoLnzc7I
- LaZRfyHBNVOFBkpdn627G190
- -----END CERTIFICATE-----
- USERTrust RSA Certification Authority
- =====================================
- -----BEGIN CERTIFICATE-----
- MIIF3jCCA8agAwIBAgIQAf1tMPyjylGoG7xkDjUDLTANBgkqhkiG9w0BAQwFADCBiDELMAkGA1UE
- BhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQK
- ExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBSU0EgQ2VydGlmaWNh
- dGlvbiBBdXRob3JpdHkwHhcNMTAwMjAxMDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBiDELMAkGA1UE
- BhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQK
- ExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBSU0EgQ2VydGlmaWNh
- dGlvbiBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCAEmUXNg7D2wiz
- 0KxXDXbtzSfTTK1Qg2HiqiBNCS1kCdzOiZ/MPans9s/B3PHTsdZ7NygRK0faOca8Ohm0X6a9fZ2j
- Y0K2dvKpOyuR+OJv0OwWIJAJPuLodMkYtJHUYmTbf6MG8YgYapAiPLz+E/CHFHv25B+O1ORRxhFn
- RghRy4YUVD+8M/5+bJz/Fp0YvVGONaanZshyZ9shZrHUm3gDwFA66Mzw3LyeTP6vBZY1H1dat//O
- +T23LLb2VN3I5xI6Ta5MirdcmrS3ID3KfyI0rn47aGYBROcBTkZTmzNg95S+UzeQc0PzMsNT79uq
- /nROacdrjGCT3sTHDN/hMq7MkztReJVni+49Vv4M0GkPGw/zJSZrM233bkf6c0Plfg6lZrEpfDKE
- Y1WJxA3Bk1QwGROs0303p+tdOmw1XNtB1xLaqUkL39iAigmTYo61Zs8liM2EuLE/pDkP2QKe6xJM
- lXzzawWpXhaDzLhn4ugTncxbgtNMs+1b/97lc6wjOy0AvzVVdAlJ2ElYGn+SNuZRkg7zJn0cTRe8
- yexDJtC/QV9AqURE9JnnV4eeUB9XVKg+/XRjL7FQZQnmWEIuQxpMtPAlR1n6BB6T1CZGSlCBst6+
- eLf8ZxXhyVeEHg9j1uliutZfVS7qXMYoCAQlObgOK6nyTJccBz8NUvXt7y+CDwIDAQABo0IwQDAd
- BgNVHQ4EFgQUU3m/WqorSs9UgOHYm8Cd8rIDZsswDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQF
- MAMBAf8wDQYJKoZIhvcNAQEMBQADggIBAFzUfA3P9wF9QZllDHPFUp/L+M+ZBn8b2kMVn54CVVeW
- FPFSPCeHlCjtHzoBN6J2/FNQwISbxmtOuowhT6KOVWKR82kV2LyI48SqC/3vqOlLVSoGIG1VeCkZ
- 7l8wXEskEVX/JJpuXior7gtNn3/3ATiUFJVDBwn7YKnuHKsSjKCaXqeYalltiz8I+8jRRa8YFWSQ
- Eg9zKC7F4iRO/Fjs8PRF/iKz6y+O0tlFYQXBl2+odnKPi4w2r78NBc5xjeambx9spnFixdjQg3IM
- 8WcRiQycE0xyNN+81XHfqnHd4blsjDwSXWXavVcStkNr/+XeTWYRUc+ZruwXtuhxkYzeSf7dNXGi
- FSeUHM9h4ya7b6NnJSFd5t0dCy5oGzuCr+yDZ4XUmFF0sbmZgIn/f3gZXHlKYC6SQK5MNyosycdi
- yA5d9zZbyuAlJQG03RoHnHcAP9Dc1ew91Pq7P8yF1m9/qS3fuQL39ZeatTXaw2ewh0qpKJ4jjv9c
- J2vhsE/zB+4ALtRZh8tSQZXq9EfX7mRBVXyNWQKV3WKdwrnuWih0hKWbt5DHDAff9Yk2dDLWKMGw
- sAvgnEzDHNb842m1R0aBL6KCq9NjRHDEjf8tM7qtj3u1cIiuPhnPQCjY/MiQu12ZIvVS5ljFH4gx
- Q+6IHdfGjjxDah2nGN59PRbxYvnKkKj9
- -----END CERTIFICATE-----
- USERTrust ECC Certification Authority
- =====================================
- -----BEGIN CERTIFICATE-----
- MIICjzCCAhWgAwIBAgIQXIuZxVqUxdJxVt7NiYDMJjAKBggqhkjOPQQDAzCBiDELMAkGA1UEBhMC
- VVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQKExVU
- aGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBFQ0MgQ2VydGlmaWNhdGlv
- biBBdXRob3JpdHkwHhcNMTAwMjAxMDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBiDELMAkGA1UEBhMC
- VVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQKExVU
- aGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBFQ0MgQ2VydGlmaWNhdGlv
- biBBdXRob3JpdHkwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQarFRaqfloI+d61SRvU8Za2EurxtW2
- 0eZzca7dnNYMYf3boIkDuAUU7FfO7l0/4iGzzvfUinngo4N+LZfQYcTxmdwlkWOrfzCjtHDix6Ez
- nPO/LlxTsV+zfTJ/ijTjeXmjQjBAMB0GA1UdDgQWBBQ64QmG1M8ZwpZ2dEl23OA1xmNjmjAOBgNV
- HQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNoADBlAjA2Z6EWCNzklwBB
- HU6+4WMBzzuqQhFkoJ2UOQIReVx7Hfpkue4WQrO/isIJxOzksU0CMQDpKmFHjFJKS04YcPbWRNZu
- 9YO6bVi9JNlWSOrvxKJGgYhqOkbRqZtNyWHa0V1Xahg=
- -----END CERTIFICATE-----
- GlobalSign ECC Root CA - R5
- ===========================
- -----BEGIN CERTIFICATE-----
- MIICHjCCAaSgAwIBAgIRYFlJ4CYuu1X5CneKcflK2GwwCgYIKoZIzj0EAwMwUDEkMCIGA1UECxMb
- R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI1MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD
- EwpHbG9iYWxTaWduMB4XDTEyMTExMzAwMDAwMFoXDTM4MDExOTAzMTQwN1owUDEkMCIGA1UECxMb
- R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI1MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD
- EwpHbG9iYWxTaWduMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAER0UOlvt9Xb/pOdEh+J8LttV7HpI6
- SFkc8GIxLcB6KP4ap1yztsyX50XUWPrRd21DosCHZTQKH3rd6zwzocWdTaRvQZU4f8kehOvRnkmS
- h5SHDDqFSmafnVmTTZdhBoZKo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAd
- BgNVHQ4EFgQUPeYpSJvqB8ohREom3m7e0oPQn1kwCgYIKoZIzj0EAwMDaAAwZQIxAOVpEslu28Yx
- uglB4Zf4+/2a4n0Sye18ZNPLBSWLVtmg515dTguDnFt2KaAJJiFqYgIwcdK1j1zqO+F4CYWodZI7
- yFz9SO8NdCKoCOJuxUnOxwy8p2Fp8fc74SrL+SvzZpA3
- -----END CERTIFICATE-----
- Staat der Nederlanden EV Root CA
- ================================
- -----BEGIN CERTIFICATE-----
- MIIFcDCCA1igAwIBAgIEAJiWjTANBgkqhkiG9w0BAQsFADBYMQswCQYDVQQGEwJOTDEeMBwGA1UE
- CgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSkwJwYDVQQDDCBTdGFhdCBkZXIgTmVkZXJsYW5kZW4g
- RVYgUm9vdCBDQTAeFw0xMDEyMDgxMTE5MjlaFw0yMjEyMDgxMTEwMjhaMFgxCzAJBgNVBAYTAk5M
- MR4wHAYDVQQKDBVTdGFhdCBkZXIgTmVkZXJsYW5kZW4xKTAnBgNVBAMMIFN0YWF0IGRlciBOZWRl
- cmxhbmRlbiBFViBSb290IENBMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA48d+ifkk
- SzrSM4M1LGns3Amk41GoJSt5uAg94JG6hIXGhaTK5skuU6TJJB79VWZxXSzFYGgEt9nCUiY4iKTW
- O0Cmws0/zZiTs1QUWJZV1VD+hq2kY39ch/aO5ieSZxeSAgMs3NZmdO3dZ//BYY1jTw+bbRcwJu+r
- 0h8QoPnFfxZpgQNH7R5ojXKhTbImxrpsX23Wr9GxE46prfNeaXUmGD5BKyF/7otdBwadQ8QpCiv8
- Kj6GyzyDOvnJDdrFmeK8eEEzduG/L13lpJhQDBXd4Pqcfzho0LKmeqfRMb1+ilgnQ7O6M5HTp5gV
- XJrm0w912fxBmJc+qiXbj5IusHsMX/FjqTf5m3VpTCgmJdrV8hJwRVXj33NeN/UhbJCONVrJ0yPr
- 08C+eKxCKFhmpUZtcALXEPlLVPxdhkqHz3/KRawRWrUgUY0viEeXOcDPusBCAUCZSCELa6fS/ZbV
- 0b5GnUngC6agIk440ME8MLxwjyx1zNDFjFE7PZQIZCZhfbnDZY8UnCHQqv0XcgOPvZuM5l5Tnrmd
- 74K74bzickFbIZTTRTeU0d8JOV3nI6qaHcptqAqGhYqCvkIH1vI4gnPah1vlPNOePqc7nvQDs/nx
- fRN0Av+7oeX6AHkcpmZBiFxgV6YuCcS6/ZrPpx9Aw7vMWgpVSzs4dlG4Y4uElBbmVvMCAwEAAaNC
- MEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFP6rAJCYniT8qcwa
- ivsnuL8wbqg7MA0GCSqGSIb3DQEBCwUAA4ICAQDPdyxuVr5Os7aEAJSrR8kN0nbHhp8dB9O2tLsI
- eK9p0gtJ3jPFrK3CiAJ9Brc1AsFgyb/E6JTe1NOpEyVa/m6irn0F3H3zbPB+po3u2dfOWBfoqSmu
- c0iH55vKbimhZF8ZE/euBhD/UcabTVUlT5OZEAFTdfETzsemQUHSv4ilf0X8rLiltTMMgsT7B/Zq
- 5SWEXwbKwYY5EdtYzXc7LMJMD16a4/CrPmEbUCTCwPTxGfARKbalGAKb12NMcIxHowNDXLldRqAN
- b/9Zjr7dn3LDWyvfjFvO5QxGbJKyCqNMVEIYFRIYvdr8unRu/8G2oGTYqV9Vrp9canaW2HNnh/tN
- f1zuacpzEPuKqf2evTY4SUmH9A4U8OmHuD+nT3pajnnUk+S7aFKErGzp85hwVXIy+TSrK0m1zSBi
- 5Dp6Z2Orltxtrpfs/J92VoguZs9btsmksNcFuuEnL5O7Jiqik7Ab846+HUCjuTaPPoIaGl6I6lD4
- WeKDRikL40Rc4ZW2aZCaFG+XroHPaO+Zmr615+F/+PoTRxZMzG0IQOeLeG9QgkRQP2YGiqtDhFZK
- DyAthg710tvSeopLzaXoTvFeJiUBWSOgftL2fiFX1ye8FVdMpEbB4IMeDExNH08GGeL5qPQ6gqGy
- eUN51q1veieQA6TqJIc/2b3Z6fJfUEkc7uzXLg==
- -----END CERTIFICATE-----
- IdenTrust Commercial Root CA 1
- ==============================
- -----BEGIN CERTIFICATE-----
- MIIFYDCCA0igAwIBAgIQCgFCgAAAAUUjyES1AAAAAjANBgkqhkiG9w0BAQsFADBKMQswCQYDVQQG
- EwJVUzESMBAGA1UEChMJSWRlblRydXN0MScwJQYDVQQDEx5JZGVuVHJ1c3QgQ29tbWVyY2lhbCBS
- b290IENBIDEwHhcNMTQwMTE2MTgxMjIzWhcNMzQwMTE2MTgxMjIzWjBKMQswCQYDVQQGEwJVUzES
- MBAGA1UEChMJSWRlblRydXN0MScwJQYDVQQDEx5JZGVuVHJ1c3QgQ29tbWVyY2lhbCBSb290IENB
- IDEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCnUBneP5k91DNG8W9RYYKyqU+PZ4ld
- hNlT3Qwo2dfw/66VQ3KZ+bVdfIrBQuExUHTRgQ18zZshq0PirK1ehm7zCYofWjK9ouuU+ehcCuz/
- mNKvcbO0U59Oh++SvL3sTzIwiEsXXlfEU8L2ApeN2WIrvyQfYo3fw7gpS0l4PJNgiCL8mdo2yMKi
- 1CxUAGc1bnO/AljwpN3lsKImesrgNqUZFvX9t++uP0D1bVoE/c40yiTcdCMbXTMTEl3EASX2MN0C
- XZ/g1Ue9tOsbobtJSdifWwLziuQkkORiT0/Br4sOdBeo0XKIanoBScy0RnnGF7HamB4HWfp1IYVl
- 3ZBWzvurpWCdxJ35UrCLvYf5jysjCiN2O/cz4ckA82n5S6LgTrx+kzmEB/dEcH7+B1rlsazRGMzy
- NeVJSQjKVsk9+w8YfYs7wRPCTY/JTw436R+hDmrfYi7LNQZReSzIJTj0+kuniVyc0uMNOYZKdHzV
- WYfCP04MXFL0PfdSgvHqo6z9STQaKPNBiDoT7uje/5kdX7rL6B7yuVBgwDHTc+XvvqDtMwt0viAg
- xGds8AgDelWAf0ZOlqf0Hj7h9tgJ4TNkK2PXMl6f+cB7D3hvl7yTmvmcEpB4eoCHFddydJxVdHix
- uuFucAS6T6C6aMN7/zHwcz09lCqxC0EOoP5NiGVreTO01wIDAQABo0IwQDAOBgNVHQ8BAf8EBAMC
- AQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU7UQZwNPwBovupHu+QucmVMiONnYwDQYJKoZI
- hvcNAQELBQADggIBAA2ukDL2pkt8RHYZYR4nKM1eVO8lvOMIkPkp165oCOGUAFjvLi5+U1KMtlwH
- 6oi6mYtQlNeCgN9hCQCTrQ0U5s7B8jeUeLBfnLOic7iPBZM4zY0+sLj7wM+x8uwtLRvM7Kqas6pg
- ghstO8OEPVeKlh6cdbjTMM1gCIOQ045U8U1mwF10A0Cj7oV+wh93nAbowacYXVKV7cndJZ5t+qnt
- ozo00Fl72u1Q8zW/7esUTTHHYPTa8Yec4kjixsU3+wYQ+nVZZjFHKdp2mhzpgq7vmrlR94gjmmmV
- YjzlVYA211QC//G5Xc7UI2/YRYRKW2XviQzdFKcgyxilJbQN+QHwotL0AMh0jqEqSI5l2xPE4iUX
- feu+h1sXIFRRk0pTAwvsXcoz7WL9RccvW9xYoIA55vrX/hMUpu09lEpCdNTDd1lzzY9GvlU47/ro
- kTLql1gEIt44w8y8bckzOmoKaT+gyOpyj4xjhiO9bTyWnpXgSUyqorkqG5w2gXjtw+hG4iZZRHUe
- 2XWJUc0QhJ1hYMtd+ZciTY6Y5uN/9lu7rs3KSoFrXgvzUeF0K+l+J6fZmUlO+KWA2yUPHGNiiskz
- Z2s8EIPGrd6ozRaOjfAHN3Gf8qv8QfXBi+wAN10J5U6A7/qxXDgGpRtK4dw4LTzcqx+QGtVKnO7R
- cGzM7vRX+Bi6hG6H
- -----END CERTIFICATE-----
- IdenTrust Public Sector Root CA 1
- =================================
- -----BEGIN CERTIFICATE-----
- MIIFZjCCA06gAwIBAgIQCgFCgAAAAUUjz0Z8AAAAAjANBgkqhkiG9w0BAQsFADBNMQswCQYDVQQG
- EwJVUzESMBAGA1UEChMJSWRlblRydXN0MSowKAYDVQQDEyFJZGVuVHJ1c3QgUHVibGljIFNlY3Rv
- ciBSb290IENBIDEwHhcNMTQwMTE2MTc1MzMyWhcNMzQwMTE2MTc1MzMyWjBNMQswCQYDVQQGEwJV
- UzESMBAGA1UEChMJSWRlblRydXN0MSowKAYDVQQDEyFJZGVuVHJ1c3QgUHVibGljIFNlY3RvciBS
- b290IENBIDEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC2IpT8pEiv6EdrCvsnduTy
- P4o7ekosMSqMjbCpwzFrqHd2hCa2rIFCDQjrVVi7evi8ZX3yoG2LqEfpYnYeEe4IFNGyRBb06tD6
- Hi9e28tzQa68ALBKK0CyrOE7S8ItneShm+waOh7wCLPQ5CQ1B5+ctMlSbdsHyo+1W/CD80/HLaXI
- rcuVIKQxKFdYWuSNG5qrng0M8gozOSI5Cpcu81N3uURF/YTLNiCBWS2ab21ISGHKTN9T0a9SvESf
- qy9rg3LvdYDaBjMbXcjaY8ZNzaxmMc3R3j6HEDbhuaR672BQssvKplbgN6+rNBM5Jeg5ZuSYeqoS
- mJxZZoY+rfGwyj4GD3vwEUs3oERte8uojHH01bWRNszwFcYr3lEXsZdMUD2xlVl8BX0tIdUAvwFn
- ol57plzy9yLxkA2T26pEUWbMfXYD62qoKjgZl3YNa4ph+bz27nb9cCvdKTz4Ch5bQhyLVi9VGxyh
- LrXHFub4qjySjmm2AcG1hp2JDws4lFTo6tyePSW8Uybt1as5qsVATFSrsrTZ2fjXctscvG29ZV/v
- iDUqZi/u9rNl8DONfJhBaUYPQxxp+pu10GFqzcpL2UyQRqsVWaFHVCkugyhfHMKiq3IXAAaOReyL
- 4jM9f9oZRORicsPfIsbyVtTdX5Vy7W1f90gDW/3FKqD2cyOEEBsB5wIDAQABo0IwQDAOBgNVHQ8B
- Af8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU43HgntinQtnbcZFrlJPrw6PRFKMw
- DQYJKoZIhvcNAQELBQADggIBAEf63QqwEZE4rU1d9+UOl1QZgkiHVIyqZJnYWv6IAcVYpZmxI1Qj
- t2odIFflAWJBF9MJ23XLblSQdf4an4EKwt3X9wnQW3IV5B4Jaj0z8yGa5hV+rVHVDRDtfULAj+7A
- mgjVQdZcDiFpboBhDhXAuM/FSRJSzL46zNQuOAXeNf0fb7iAaJg9TaDKQGXSc3z1i9kKlT/YPyNt
- GtEqJBnZhbMX73huqVjRI9PHE+1yJX9dsXNw0H8GlwmEKYBhHfpe/3OsoOOJuBxxFcbeMX8S3OFt
- m6/n6J91eEyrRjuazr8FGF1NFTwWmhlQBJqymm9li1JfPFgEKCXAZmExfrngdbkaqIHWchezxQMx
- NRF4eKLg6TCMf4DfWN88uieW4oA0beOY02QnrEh+KHdcxiVhJfiFDGX6xDIvpZgF5PgLZxYWxoK4
- Mhn5+bl53B/N66+rDt0b20XkeucC4pVd/GnwU2lhlXV5C15V5jgclKlZM57IcXR5f1GJtshquDDI
- ajjDbp7hNxbqBWJMWxJH7ae0s1hWx0nzfxJoCTFx8G34Tkf71oXuxVhAGaQdp/lLQzfcaFpPz+vC
- ZHTetBXZ9FRUGi8c15dxVJCO2SCdUyt/q4/i6jC8UDfv8Ue1fXwsBOxonbRJRBD0ckscZOf85muQ
- 3Wl9af0AVqW3rLatt8o+Ae+c
- -----END CERTIFICATE-----
- Entrust Root Certification Authority - G2
- =========================================
- -----BEGIN CERTIFICATE-----
- MIIEPjCCAyagAwIBAgIESlOMKDANBgkqhkiG9w0BAQsFADCBvjELMAkGA1UEBhMCVVMxFjAUBgNV
- BAoTDUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVnYWwtdGVy
- bXMxOTA3BgNVBAsTMChjKSAyMDA5IEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXplZCB1c2Ug
- b25seTEyMDAGA1UEAxMpRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzIw
- HhcNMDkwNzA3MTcyNTU0WhcNMzAxMjA3MTc1NTU0WjCBvjELMAkGA1UEBhMCVVMxFjAUBgNVBAoT
- DUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVnYWwtdGVybXMx
- OTA3BgNVBAsTMChjKSAyMDA5IEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXplZCB1c2Ugb25s
- eTEyMDAGA1UEAxMpRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzIwggEi
- MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC6hLZy254Ma+KZ6TABp3bqMriVQRrJ2mFOWHLP
- /vaCeb9zYQYKpSfYs1/TRU4cctZOMvJyig/3gxnQaoCAAEUesMfnmr8SVycco2gvCoe9amsOXmXz
- HHfV1IWNcCG0szLni6LVhjkCsbjSR87kyUnEO6fe+1R9V77w6G7CebI6C1XiUJgWMhNcL3hWwcKU
- s/Ja5CeanyTXxuzQmyWC48zCxEXFjJd6BmsqEZ+pCm5IO2/b1BEZQvePB7/1U1+cPvQXLOZprE4y
- TGJ36rfo5bs0vBmLrpxR57d+tVOxMyLlbc9wPBr64ptntoP0jaWvYkxN4FisZDQSA/i2jZRjJKRx
- AgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRqciZ6
- 0B7vfec7aVHUbI2fkBJmqzANBgkqhkiG9w0BAQsFAAOCAQEAeZ8dlsa2eT8ijYfThwMEYGprmi5Z
- iXMRrEPR9RP/jTkrwPK9T3CMqS/qF8QLVJ7UG5aYMzyorWKiAHarWWluBh1+xLlEjZivEtRh2woZ
- Rkfz6/djwUAFQKXSt/S1mja/qYh2iARVBCuch38aNzx+LaUa2NSJXsq9rD1s2G2v1fN2D807iDgi
- nWyTmsQ9v4IbZT+mD12q/OWyFcq1rca8PdCE6OoGcrBNOTJ4vz4RnAuknZoh8/CbCzB428Hch0P+
- vGOaysXCHMnHjf87ElgI5rY97HosTvuDls4MPGmHVHOkc8KT/1EQrBVUAdj8BbGJoX90g5pJ19xO
- e4pIb4tF9g==
- -----END CERTIFICATE-----
- Entrust Root Certification Authority - EC1
- ==========================================
- -----BEGIN CERTIFICATE-----
- MIIC+TCCAoCgAwIBAgINAKaLeSkAAAAAUNCR+TAKBggqhkjOPQQDAzCBvzELMAkGA1UEBhMCVVMx
- FjAUBgNVBAoTDUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVn
- YWwtdGVybXMxOTA3BgNVBAsTMChjKSAyMDEyIEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXpl
- ZCB1c2Ugb25seTEzMDEGA1UEAxMqRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5
- IC0gRUMxMB4XDTEyMTIxODE1MjUzNloXDTM3MTIxODE1NTUzNlowgb8xCzAJBgNVBAYTAlVTMRYw
- FAYDVQQKEw1FbnRydXN0LCBJbmMuMSgwJgYDVQQLEx9TZWUgd3d3LmVudHJ1c3QubmV0L2xlZ2Fs
- LXRlcm1zMTkwNwYDVQQLEzAoYykgMjAxMiBFbnRydXN0LCBJbmMuIC0gZm9yIGF1dGhvcml6ZWQg
- dXNlIG9ubHkxMzAxBgNVBAMTKkVudHJ1c3QgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAt
- IEVDMTB2MBAGByqGSM49AgEGBSuBBAAiA2IABIQTydC6bUF74mzQ61VfZgIaJPRbiWlH47jCffHy
- AsWfoPZb1YsGGYZPUxBtByQnoaD41UcZYUx9ypMn6nQM72+WCf5j7HBdNq1nd67JnXxVRDqiY1Ef
- 9eNi1KlHBz7MIKNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYE
- FLdj5xrdjekIplWDpOBqUEFlEUJJMAoGCCqGSM49BAMDA2cAMGQCMGF52OVCR98crlOZF7ZvHH3h
- vxGU0QOIdeSNiaSKd0bebWHvAvX7td/M/k7//qnmpwIwW5nXhTcGtXsI/esni0qU+eH6p44mCOh8
- kmhtc9hvJqwhAriZtyZBWyVgrtBIGu4G
- -----END CERTIFICATE-----
- CFCA EV ROOT
- ============
- -----BEGIN CERTIFICATE-----
- MIIFjTCCA3WgAwIBAgIEGErM1jANBgkqhkiG9w0BAQsFADBWMQswCQYDVQQGEwJDTjEwMC4GA1UE
- CgwnQ2hpbmEgRmluYW5jaWFsIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MRUwEwYDVQQDDAxDRkNB
- IEVWIFJPT1QwHhcNMTIwODA4MDMwNzAxWhcNMjkxMjMxMDMwNzAxWjBWMQswCQYDVQQGEwJDTjEw
- MC4GA1UECgwnQ2hpbmEgRmluYW5jaWFsIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MRUwEwYDVQQD
- DAxDRkNBIEVWIFJPT1QwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDXXWvNED8fBVnV
- BU03sQ7smCuOFR36k0sXgiFxEFLXUWRwFsJVaU2OFW2fvwwbwuCjZ9YMrM8irq93VCpLTIpTUnrD
- 7i7es3ElweldPe6hL6P3KjzJIx1qqx2hp/Hz7KDVRM8Vz3IvHWOX6Jn5/ZOkVIBMUtRSqy5J35DN
- uF++P96hyk0g1CXohClTt7GIH//62pCfCqktQT+x8Rgp7hZZLDRJGqgG16iI0gNyejLi6mhNbiyW
- ZXvKWfry4t3uMCz7zEasxGPrb382KzRzEpR/38wmnvFyXVBlWY9ps4deMm/DGIq1lY+wejfeWkU7
- xzbh72fROdOXW3NiGUgthxwG+3SYIElz8AXSG7Ggo7cbcNOIabla1jj0Ytwli3i/+Oh+uFzJlU9f
- py25IGvPa931DfSCt/SyZi4QKPaXWnuWFo8BGS1sbn85WAZkgwGDg8NNkt0yxoekN+kWzqotaK8K
- gWU6cMGbrU1tVMoqLUuFG7OA5nBFDWteNfB/O7ic5ARwiRIlk9oKmSJgamNgTnYGmE69g60dWIol
- hdLHZR4tjsbftsbhf4oEIRUpdPA+nJCdDC7xij5aqgwJHsfVPKPtl8MeNPo4+QgO48BdK4PRVmrJ
- tqhUUy54Mmc9gn900PvhtgVguXDbjgv5E1hvcWAQUhC5wUEJ73IfZzF4/5YFjQIDAQABo2MwYTAf
- BgNVHSMEGDAWgBTj/i39KNALtbq2osS/BqoFjJP7LzAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB
- /wQEAwIBBjAdBgNVHQ4EFgQU4/4t/SjQC7W6tqLEvwaqBYyT+y8wDQYJKoZIhvcNAQELBQADggIB
- ACXGumvrh8vegjmWPfBEp2uEcwPenStPuiB/vHiyz5ewG5zz13ku9Ui20vsXiObTej/tUxPQ4i9q
- ecsAIyjmHjdXNYmEwnZPNDatZ8POQQaIxffu2Bq41gt/UP+TqhdLjOztUmCypAbqTuv0axn96/Ua
- 4CUqmtzHQTb3yHQFhDmVOdYLO6Qn+gjYXB74BGBSESgoA//vU2YApUo0FmZ8/Qmkrp5nGm9BC2sG
- E5uPhnEFtC+NiWYzKXZUmhH4J/qyP5Hgzg0b8zAarb8iXRvTvyUFTeGSGn+ZnzxEk8rUQElsgIfX
- BDrDMlI1Dlb4pd19xIsNER9Tyx6yF7Zod1rg1MvIB671Oi6ON7fQAUtDKXeMOZePglr4UeWJoBjn
- aH9dCi77o0cOPaYjesYBx4/IXr9tgFa+iiS6M+qf4TIRnvHST4D2G0CvOJ4RUHlzEhLN5mydLIhy
- PDCBBpEi6lmt2hkuIsKNuYyH4Ga8cyNfIWRjgEj1oDwYPZTISEEdQLpe/v5WOaHIz16eGWRGENoX
- kbcFgKyLmZJ956LYBws2J+dIeWCKw9cTXPhyQN9Ky8+ZAAoACxGV2lZFA4gKn2fQ1XmxqI1AbQ3C
- ekD6819kR5LLU7m7Wc5P/dAVUwHY3+vZ5nbv0CO7O6l5s9UCKc2Jo5YPSjXnTkLAdc0Hz+Ys63su
- -----END CERTIFICATE-----
- OISTE WISeKey Global Root GB CA
- ===============================
- -----BEGIN CERTIFICATE-----
- MIIDtTCCAp2gAwIBAgIQdrEgUnTwhYdGs/gjGvbCwDANBgkqhkiG9w0BAQsFADBtMQswCQYDVQQG
- EwJDSDEQMA4GA1UEChMHV0lTZUtleTEiMCAGA1UECxMZT0lTVEUgRm91bmRhdGlvbiBFbmRvcnNl
- ZDEoMCYGA1UEAxMfT0lTVEUgV0lTZUtleSBHbG9iYWwgUm9vdCBHQiBDQTAeFw0xNDEyMDExNTAw
- MzJaFw0zOTEyMDExNTEwMzFaMG0xCzAJBgNVBAYTAkNIMRAwDgYDVQQKEwdXSVNlS2V5MSIwIAYD
- VQQLExlPSVNURSBGb3VuZGF0aW9uIEVuZG9yc2VkMSgwJgYDVQQDEx9PSVNURSBXSVNlS2V5IEds
- b2JhbCBSb290IEdCIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2Be3HEokKtaX
- scriHvt9OO+Y9bI5mE4nuBFde9IllIiCFSZqGzG7qFshISvYD06fWvGxWuR51jIjK+FTzJlFXHtP
- rby/h0oLS5daqPZI7H17Dc0hBt+eFf1Biki3IPShehtX1F1Q/7pn2COZH8g/497/b1t3sWtuuMlk
- 9+HKQUYOKXHQuSP8yYFfTvdv37+ErXNku7dCjmn21HYdfp2nuFeKUWdy19SouJVUQHMD9ur06/4o
- Qnc/nSMbsrY9gBQHTC5P99UKFg29ZkM3fiNDecNAhvVMKdqOmq0NpQSHiB6F4+lT1ZvIiwNjeOvg
- GUpuuy9rM2RYk61pv48b74JIxwIDAQABo1EwTzALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB
- /zAdBgNVHQ4EFgQUNQ/INmNe4qPs+TtmFc5RUuORmj0wEAYJKwYBBAGCNxUBBAMCAQAwDQYJKoZI
- hvcNAQELBQADggEBAEBM+4eymYGQfp3FsLAmzYh7KzKNbrghcViXfa43FK8+5/ea4n32cZiZBKpD
- dHij40lhPnOMTZTg+XHEthYOU3gf1qKHLwI5gSk8rxWYITD+KJAAjNHhy/peyP34EEY7onhCkRd0
- VQreUGdNZtGn//3ZwLWoo4rOZvUPQ82nK1d7Y0Zqqi5S2PTt4W2tKZB4SLrhI6qjiey1q5bAtEui
- HZeeevJuQHHfaPFlTc58Bd9TZaml8LGXBHAVRgOY1NK/VLSgWH1Sb9pWJmLU2NuJMW8c8CLC02Ic
- Nc1MaRVUGpCY3useX8p3x8uOPUNpnJpY0CQ73xtAln41rYHHTnG6iBM=
- -----END CERTIFICATE-----
- SZAFIR ROOT CA2
- ===============
- -----BEGIN CERTIFICATE-----
- MIIDcjCCAlqgAwIBAgIUPopdB+xV0jLVt+O2XwHrLdzk1uQwDQYJKoZIhvcNAQELBQAwUTELMAkG
- A1UEBhMCUEwxKDAmBgNVBAoMH0tyYWpvd2EgSXpiYSBSb3psaWN6ZW5pb3dhIFMuQS4xGDAWBgNV
- BAMMD1NaQUZJUiBST09UIENBMjAeFw0xNTEwMTkwNzQzMzBaFw0zNTEwMTkwNzQzMzBaMFExCzAJ
- BgNVBAYTAlBMMSgwJgYDVQQKDB9LcmFqb3dhIEl6YmEgUm96bGljemVuaW93YSBTLkEuMRgwFgYD
- VQQDDA9TWkFGSVIgUk9PVCBDQTIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC3vD5Q
- qEvNQLXOYeeWyrSh2gwisPq1e3YAd4wLz32ohswmUeQgPYUM1ljj5/QqGJ3a0a4m7utT3PSQ1hNK
- DJA8w/Ta0o4NkjrcsbH/ON7Dui1fgLkCvUqdGw+0w8LBZwPd3BucPbOw3gAeqDRHu5rr/gsUvTaE
- 2g0gv/pby6kWIK05YO4vdbbnl5z5Pv1+TW9NL++IDWr63fE9biCloBK0TXC5ztdyO4mTp4CEHCdJ
- ckm1/zuVnsHMyAHs6A6KCpbns6aH5db5BSsNl0BwPLqsdVqc1U2dAgrSS5tmS0YHF2Wtn2yIANwi
- ieDhZNRnvDF5YTy7ykHNXGoAyDw4jlivAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0P
- AQH/BAQDAgEGMB0GA1UdDgQWBBQuFqlKGLXLzPVvUPMjX/hd56zwyDANBgkqhkiG9w0BAQsFAAOC
- AQEAtXP4A9xZWx126aMqe5Aosk3AM0+qmrHUuOQn/6mWmc5G4G18TKI4pAZw8PRBEew/R40/cof5
- O/2kbytTAOD/OblqBw7rHRz2onKQy4I9EYKL0rufKq8h5mOGnXkZ7/e7DDWQw4rtTw/1zBLZpD67
- oPwglV9PJi8RI4NOdQcPv5vRtB3pEAT+ymCPoky4rc/hkA/NrgrHXXu3UNLUYfrVFdvXn4dRVOul
- 4+vJhaAlIDf7js4MNIThPIGyd05DpYhfhmehPea0XGG2Ptv+tyjFogeutcrKjSoS75ftwjCkySp6
- +/NNIxuZMzSgLvWpCz/UXeHPhJ/iGcJfitYgHuNztw==
- -----END CERTIFICATE-----
- Certum Trusted Network CA 2
- ===========================
- -----BEGIN CERTIFICATE-----
- MIIF0jCCA7qgAwIBAgIQIdbQSk8lD8kyN/yqXhKN6TANBgkqhkiG9w0BAQ0FADCBgDELMAkGA1UE
- BhMCUEwxIjAgBgNVBAoTGVVuaXpldG8gVGVjaG5vbG9naWVzIFMuQS4xJzAlBgNVBAsTHkNlcnR1
- bSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTEkMCIGA1UEAxMbQ2VydHVtIFRydXN0ZWQgTmV0d29y
- ayBDQSAyMCIYDzIwMTExMDA2MDgzOTU2WhgPMjA0NjEwMDYwODM5NTZaMIGAMQswCQYDVQQGEwJQ
- TDEiMCAGA1UEChMZVW5pemV0byBUZWNobm9sb2dpZXMgUy5BLjEnMCUGA1UECxMeQ2VydHVtIENl
- cnRpZmljYXRpb24gQXV0aG9yaXR5MSQwIgYDVQQDExtDZXJ0dW0gVHJ1c3RlZCBOZXR3b3JrIENB
- IDIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC9+Xj45tWADGSdhhuWZGc/IjoedQF9
- 7/tcZ4zJzFxrqZHmuULlIEub2pt7uZld2ZuAS9eEQCsn0+i6MLs+CRqnSZXvK0AkwpfHp+6bJe+o
- CgCXhVqqndwpyeI1B+twTUrWwbNWuKFBOJvR+zF/j+Bf4bE/D44WSWDXBo0Y+aomEKsq09DRZ40b
- Rr5HMNUuctHFY9rnY3lEfktjJImGLjQ/KUxSiyqnwOKRKIm5wFv5HdnnJ63/mgKXwcZQkpsCLL2p
- uTRZCr+ESv/f/rOf69me4Jgj7KZrdxYq28ytOxykh9xGc14ZYmhFV+SQgkK7QtbwYeDBoz1mo130
- GO6IyY0XRSmZMnUCMe4pJshrAua1YkV/NxVaI2iJ1D7eTiew8EAMvE0Xy02isx7QBlrd9pPPV3WZ
- 9fqGGmd4s7+W/jTcvedSVuWz5XV710GRBdxdaeOVDUO5/IOWOZV7bIBaTxNyxtd9KXpEulKkKtVB
- Rgkg/iKgtlswjbyJDNXXcPiHUv3a76xRLgezTv7QCdpw75j6VuZt27VXS9zlLCUVyJ4ueE742pye
- hizKV/Ma5ciSixqClnrDvFASadgOWkaLOusm+iPJtrCBvkIApPjW/jAux9JG9uWOdf3yzLnQh1vM
- BhBgu4M1t15n3kfsmUjxpKEV/q2MYo45VU85FrmxY53/twIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
- AQH/MB0GA1UdDgQWBBS2oVQ5AsOgP46KvPrU+Bym0ToO/TAOBgNVHQ8BAf8EBAMCAQYwDQYJKoZI
- hvcNAQENBQADggIBAHGlDs7k6b8/ONWJWsQCYftMxRQXLYtPU2sQF/xlhMcQSZDe28cmk4gmb3DW
- Al45oPePq5a1pRNcgRRtDoGCERuKTsZPpd1iHkTfCVn0W3cLN+mLIMb4Ck4uWBzrM9DPhmDJ2vuA
- L55MYIR4PSFk1vtBHxgP58l1cb29XN40hz5BsA72udY/CROWFC/emh1auVbONTqwX3BNXuMp8SMo
- clm2q8KMZiYcdywmdjWLKKdpoPk79SPdhRB0yZADVpHnr7pH1BKXESLjokmUbOe3lEu6LaTaM4tM
- pkT/WjzGHWTYtTHkpjx6qFcL2+1hGsvxznN3Y6SHb0xRONbkX8eftoEq5IVIeVheO/jbAoJnwTnb
- w3RLPTYe+SmTiGhbqEQZIfCn6IENLOiTNrQ3ssqwGyZ6miUfmpqAnksqP/ujmv5zMnHCnsZy4Ypo
- J/HkD7TETKVhk/iXEAcqMCWpuchxuO9ozC1+9eB+D4Kob7a6bINDd82Kkhehnlt4Fj1F4jNy3eFm
- ypnTycUm/Q1oBEauttmbjL4ZvrHG8hnjXALKLNhvSgfZyTXaQHXyxKcZb55CEJh15pWLYLztxRLX
- is7VmFxWlgPF7ncGNf/P5O4/E2Hu29othfDNrp2yGAlFw5Khchf8R7agCyzxxN5DaAhqXzvwdmP7
- zAYspsbiDrW5viSP
- -----END CERTIFICATE-----
- Hellenic Academic and Research Institutions RootCA 2015
- =======================================================
- -----BEGIN CERTIFICATE-----
- MIIGCzCCA/OgAwIBAgIBADANBgkqhkiG9w0BAQsFADCBpjELMAkGA1UEBhMCR1IxDzANBgNVBAcT
- BkF0aGVuczFEMEIGA1UEChM7SGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2VhcmNoIEluc3RpdHV0
- aW9ucyBDZXJ0LiBBdXRob3JpdHkxQDA+BgNVBAMTN0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNl
- YXJjaCBJbnN0aXR1dGlvbnMgUm9vdENBIDIwMTUwHhcNMTUwNzA3MTAxMTIxWhcNNDAwNjMwMTAx
- MTIxWjCBpjELMAkGA1UEBhMCR1IxDzANBgNVBAcTBkF0aGVuczFEMEIGA1UEChM7SGVsbGVuaWMg
- QWNhZGVtaWMgYW5kIFJlc2VhcmNoIEluc3RpdHV0aW9ucyBDZXJ0LiBBdXRob3JpdHkxQDA+BgNV
- BAMTN0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgUm9vdENBIDIw
- MTUwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDC+Kk/G4n8PDwEXT2QNrCROnk8Zlrv
- bTkBSRq0t89/TSNTt5AA4xMqKKYx8ZEA4yjsriFBzh/a/X0SWwGDD7mwX5nh8hKDgE0GPt+sr+eh
- iGsxr/CL0BgzuNtFajT0AoAkKAoCFZVedioNmToUW/bLy1O8E00BiDeUJRtCvCLYjqOWXjrZMts+
- 6PAQZe104S+nfK8nNLspfZu2zwnI5dMK/IhlZXQK3HMcXM1AsRzUtoSMTFDPaI6oWa7CJ06CojXd
- FPQf/7J31Ycvqm59JCfnxssm5uX+Zwdj2EUN3TpZZTlYepKZcj2chF6IIbjV9Cz82XBST3i4vTwr
- i5WY9bPRaM8gFH5MXF/ni+X1NYEZN9cRCLdmvtNKzoNXADrDgfgXy5I2XdGj2HUb4Ysn6npIQf1F
- GQatJ5lOwXBH3bWfgVMS5bGMSF0xQxfjjMZ6Y5ZLKTBOhE5iGV48zpeQpX8B653g+IuJ3SWYPZK2
- fu/Z8VFRfS0myGlZYeCsargqNhEEelC9MoS+L9xy1dcdFkfkR2YgP/SWxa+OAXqlD3pk9Q0Yh9mu
- iNX6hME6wGkoLfINaFGq46V3xqSQDqE3izEjR8EJCOtu93ib14L8hCCZSRm2Ekax+0VVFqmjZayc
- Bw/qa9wfLgZy7IaIEuQt218FL+TwA9MmM+eAws1CoRc0CwIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
- AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUcRVnyMjJvXVdctA4GGqd83EkVAswDQYJKoZI
- hvcNAQELBQADggIBAHW7bVRLqhBYRjTyYtcWNl0IXtVsyIe9tC5G8jH4fOpCtZMWVdyhDBKg2mF+
- D1hYc2Ryx+hFjtyp8iY/xnmMsVMIM4GwVhO+5lFc2JsKT0ucVlMC6U/2DWDqTUJV6HwbISHTGzrM
- d/K4kPFox/la/vot9L/J9UUbzjgQKjeKeaO04wlshYaT/4mWJ3iBj2fjRnRUjtkNaeJK9E10A/+y
- d+2VZ5fkscWrv2oj6NSU4kQoYsRL4vDY4ilrGnB+JGGTe08DMiUNRSQrlrRGar9KC/eaj8GsGsVn
- 82800vpzY4zvFrCopEYq+OsS7HK07/grfoxSwIuEVPkvPuNVqNxmsdnhX9izjFk0WaSrT2y7Hxjb
- davYy5LNlDhhDgcGH0tGEPEVvo2FXDtKK4F5D7Rpn0lQl033DlZdwJVqwjbDG2jJ9SrcR5q+ss7F
- Jej6A7na+RZukYT1HCjI/CbM1xyQVqdfbzoEvM14iQuODy+jqk+iGxI9FghAD/FGTNeqewjBCvVt
- J94Cj8rDtSvK6evIIVM4pcw72Hc3MKJP2W/R8kCtQXoXxdZKNYm3QdV8hn9VTYNKpXMgwDqvkPGa
- JI7ZjnHKe7iG2rKPmT4dEw0SEe7Uq/DpFXYC5ODfqiAeW2GFZECpkJcNrVPSWh2HagCXZWK0vm9q
- p/UsQu0yrbYhnr68
- -----END CERTIFICATE-----
- Hellenic Academic and Research Institutions ECC RootCA 2015
- ===========================================================
- -----BEGIN CERTIFICATE-----
- MIICwzCCAkqgAwIBAgIBADAKBggqhkjOPQQDAjCBqjELMAkGA1UEBhMCR1IxDzANBgNVBAcTBkF0
- aGVuczFEMEIGA1UEChM7SGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2VhcmNoIEluc3RpdHV0aW9u
- cyBDZXJ0LiBBdXRob3JpdHkxRDBCBgNVBAMTO0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJj
- aCBJbnN0aXR1dGlvbnMgRUNDIFJvb3RDQSAyMDE1MB4XDTE1MDcwNzEwMzcxMloXDTQwMDYzMDEw
- MzcxMlowgaoxCzAJBgNVBAYTAkdSMQ8wDQYDVQQHEwZBdGhlbnMxRDBCBgNVBAoTO0hlbGxlbmlj
- IEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgQ2VydC4gQXV0aG9yaXR5MUQwQgYD
- VQQDEztIZWxsZW5pYyBBY2FkZW1pYyBhbmQgUmVzZWFyY2ggSW5zdGl0dXRpb25zIEVDQyBSb290
- Q0EgMjAxNTB2MBAGByqGSM49AgEGBSuBBAAiA2IABJKgQehLgoRc4vgxEZmGZE4JJS+dQS8KrjVP
- dJWyUWRrjWvmP3CV8AVER6ZyOFB2lQJajq4onvktTpnvLEhvTCUp6NFxW98dwXU3tNf6e3pCnGoK
- Vlp8aQuqgAkkbH7BRqNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0O
- BBYEFLQiC4KZJAEOnLvkDv2/+5cgk5kqMAoGCCqGSM49BAMCA2cAMGQCMGfOFmI4oqxiRaeplSTA
- GiecMjvAwNW6qef4BENThe5SId6d9SWDPp5YSy/XZxMOIQIwBeF1Ad5o7SofTUwJCA3sS61kFyjn
- dc5FZXIhF8siQQ6ME5g4mlRtm8rifOoCWCKR
- -----END CERTIFICATE-----
- ISRG Root X1
- ============
- -----BEGIN CERTIFICATE-----
- MIIFazCCA1OgAwIBAgIRAIIQz7DSQONZRGPgu2OCiwAwDQYJKoZIhvcNAQELBQAwTzELMAkGA1UE
- BhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2VhcmNoIEdyb3VwMRUwEwYDVQQD
- EwxJU1JHIFJvb3QgWDEwHhcNMTUwNjA0MTEwNDM4WhcNMzUwNjA0MTEwNDM4WjBPMQswCQYDVQQG
- EwJVUzEpMCcGA1UEChMgSW50ZXJuZXQgU2VjdXJpdHkgUmVzZWFyY2ggR3JvdXAxFTATBgNVBAMT
- DElTUkcgUm9vdCBYMTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAK3oJHP0FDfzm54r
- Vygch77ct984kIxuPOZXoHj3dcKi/vVqbvYATyjb3miGbESTtrFj/RQSa78f0uoxmyF+0TM8ukj1
- 3Xnfs7j/EvEhmkvBioZxaUpmZmyPfjxwv60pIgbz5MDmgK7iS4+3mX6UA5/TR5d8mUgjU+g4rk8K
- b4Mu0UlXjIB0ttov0DiNewNwIRt18jA8+o+u3dpjq+sWT8KOEUt+zwvo/7V3LvSye0rgTBIlDHCN
- Aymg4VMk7BPZ7hm/ELNKjD+Jo2FR3qyHB5T0Y3HsLuJvW5iB4YlcNHlsdu87kGJ55tukmi8mxdAQ
- 4Q7e2RCOFvu396j3x+UCB5iPNgiV5+I3lg02dZ77DnKxHZu8A/lJBdiB3QW0KtZB6awBdpUKD9jf
- 1b0SHzUvKBds0pjBqAlkd25HN7rOrFleaJ1/ctaJxQZBKT5ZPt0m9STJEadao0xAH0ahmbWnOlFu
- hjuefXKnEgV4We0+UXgVCwOPjdAvBbI+e0ocS3MFEvzG6uBQE3xDk3SzynTnjh8BCNAw1FtxNrQH
- usEwMFxIt4I7mKZ9YIqioymCzLq9gwQbooMDQaHWBfEbwrbwqHyGO0aoSCqI3Haadr8faqU9GY/r
- OPNk3sgrDQoo//fb4hVC1CLQJ13hef4Y53CIrU7m2Ys6xt0nUW7/vGT1M0NPAgMBAAGjQjBAMA4G
- A1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBR5tFnme7bl5AFzgAiIyBpY
- 9umbbjANBgkqhkiG9w0BAQsFAAOCAgEAVR9YqbyyqFDQDLHYGmkgJykIrGF1XIpu+ILlaS/V9lZL
- ubhzEFnTIZd+50xx+7LSYK05qAvqFyFWhfFQDlnrzuBZ6brJFe+GnY+EgPbk6ZGQ3BebYhtF8GaV
- 0nxvwuo77x/Py9auJ/GpsMiu/X1+mvoiBOv/2X/qkSsisRcOj/KKNFtY2PwByVS5uCbMiogziUwt
- hDyC3+6WVwW6LLv3xLfHTjuCvjHIInNzktHCgKQ5ORAzI4JMPJ+GslWYHb4phowim57iaztXOoJw
- TdwJx4nLCgdNbOhdjsnvzqvHu7UrTkXWStAmzOVyyghqpZXjFaH3pO3JLF+l+/+sKAIuvtd7u+Nx
- e5AW0wdeRlN8NwdCjNPElpzVmbUq4JUagEiuTDkHzsxHpFKVK7q4+63SM1N95R1NbdWhscdCb+ZA
- JzVcoyi3B43njTOQ5yOf+1CceWxG1bQVs5ZufpsMljq4Ui0/1lvh+wjChP4kqKOJ2qxq4RgqsahD
- YVvTH9w7jXbyLeiNdd8XM2w9U/t7y0Ff/9yi0GE44Za4rF2LN9d11TPAmRGunUHBcnWEvgJBQl9n
- JEiU0Zsnvgc/ubhPgXRR4Xq37Z0j4r7g1SgEEzwxA57demyPxgcYxn/eR44/KJ4EBs+lVDR3veyJ
- m+kXQ99b21/+jh5Xos1AnX5iItreGCc=
- -----END CERTIFICATE-----
- AC RAIZ FNMT-RCM
- ================
- -----BEGIN CERTIFICATE-----
- MIIFgzCCA2ugAwIBAgIPXZONMGc2yAYdGsdUhGkHMA0GCSqGSIb3DQEBCwUAMDsxCzAJBgNVBAYT
- AkVTMREwDwYDVQQKDAhGTk1ULVJDTTEZMBcGA1UECwwQQUMgUkFJWiBGTk1ULVJDTTAeFw0wODEw
- MjkxNTU5NTZaFw0zMDAxMDEwMDAwMDBaMDsxCzAJBgNVBAYTAkVTMREwDwYDVQQKDAhGTk1ULVJD
- TTEZMBcGA1UECwwQQUMgUkFJWiBGTk1ULVJDTTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoC
- ggIBALpxgHpMhm5/yBNtwMZ9HACXjywMI7sQmkCpGreHiPibVmr75nuOi5KOpyVdWRHbNi63URcf
- qQgfBBckWKo3Shjf5TnUV/3XwSyRAZHiItQDwFj8d0fsjz50Q7qsNI1NOHZnjrDIbzAzWHFctPVr
- btQBULgTfmxKo0nRIBnuvMApGGWn3v7v3QqQIecaZ5JCEJhfTzC8PhxFtBDXaEAUwED653cXeuYL
- j2VbPNmaUtu1vZ5Gzz3rkQUCwJaydkxNEJY7kvqcfw+Z374jNUUeAlz+taibmSXaXvMiwzn15Cou
- 08YfxGyqxRxqAQVKL9LFwag0Jl1mpdICIfkYtwb1TplvqKtMUejPUBjFd8g5CSxJkjKZqLsXF3mw
- WsXmo8RZZUc1g16p6DULmbvkzSDGm0oGObVo/CK67lWMK07q87Hj/LaZmtVC+nFNCM+HHmpxffnT
- tOmlcYF7wk5HlqX2doWjKI/pgG6BU6VtX7hI+cL5NqYuSf+4lsKMB7ObiFj86xsc3i1w4peSMKGJ
- 47xVqCfWS+2QrYv6YyVZLag13cqXM7zlzced0ezvXg5KkAYmY6252TUtB7p2ZSysV4999AeU14EC
- ll2jB0nVetBX+RvnU0Z1qrB5QstocQjpYL05ac70r8NWQMetUqIJ5G+GR4of6ygnXYMgrwTJbFaa
- i0b1AgMBAAGjgYMwgYAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYE
- FPd9xf3E6Jobd2Sn9R2gzL+HYJptMD4GA1UdIAQ3MDUwMwYEVR0gADArMCkGCCsGAQUFBwIBFh1o
- dHRwOi8vd3d3LmNlcnQuZm5tdC5lcy9kcGNzLzANBgkqhkiG9w0BAQsFAAOCAgEAB5BK3/MjTvDD
- nFFlm5wioooMhfNzKWtN/gHiqQxjAb8EZ6WdmF/9ARP67Jpi6Yb+tmLSbkyU+8B1RXxlDPiyN8+s
- D8+Nb/kZ94/sHvJwnvDKuO+3/3Y3dlv2bojzr2IyIpMNOmqOFGYMLVN0V2Ue1bLdI4E7pWYjJ2cJ
- j+F3qkPNZVEI7VFY/uY5+ctHhKQV8Xa7pO6kO8Rf77IzlhEYt8llvhjho6Tc+hj507wTmzl6NLrT
- Qfv6MooqtyuGC2mDOL7Nii4LcK2NJpLuHvUBKwrZ1pebbuCoGRw6IYsMHkCtA+fdZn71uSANA+iW
- +YJF1DngoABd15jmfZ5nc8OaKveri6E6FO80vFIOiZiaBECEHX5FaZNXzuvO+FB8TxxuBEOb+dY7
- Ixjp6o7RTUaN8Tvkasq6+yO3m/qZASlaWFot4/nUbQ4mrcFuNLwy+AwF+mWj2zs3gyLp1txyM/1d
- 8iC9djwj2ij3+RvrWWTV3F9yfiD8zYm1kGdNYno/Tq0dwzn+evQoFt9B9kiABdcPUXmsEKvU7ANm
- 5mqwujGSQkBqvjrTcuFqN1W8rB2Vt2lh8kORdOag0wokRqEIr9baRRmW1FMdW4R58MD3R++Lj8UG
- rp1MYp3/RgT408m2ECVAdf4WqslKYIYvuu8wd+RU4riEmViAqhOLUTpPSPaLtrM=
- -----END CERTIFICATE-----
- Amazon Root CA 1
- ================
- -----BEGIN CERTIFICATE-----
- MIIDQTCCAimgAwIBAgITBmyfz5m/jAo54vB4ikPmljZbyjANBgkqhkiG9w0BAQsFADA5MQswCQYD
- VQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSAxMB4XDTE1
- MDUyNjAwMDAwMFoXDTM4MDExNzAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpv
- bjEZMBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
- ggEBALJ4gHHKeNXjca9HgFB0fW7Y14h29Jlo91ghYPl0hAEvrAIthtOgQ3pOsqTQNroBvo3bSMgH
- FzZM9O6II8c+6zf1tRn4SWiw3te5djgdYZ6k/oI2peVKVuRF4fn9tBb6dNqcmzU5L/qwIFAGbHrQ
- gLKm+a/sRxmPUDgH3KKHOVj4utWp+UhnMJbulHheb4mjUcAwhmahRWa6VOujw5H5SNz/0egwLX0t
- dHA114gk957EWW67c4cX8jJGKLhD+rcdqsq08p8kDi1L93FcXmn/6pUCyziKrlA4b9v7LWIbxcce
- VOF34GfID5yHI9Y/QCB/IIDEgEw+OyQmjgSubJrIqg0CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB
- /zAOBgNVHQ8BAf8EBAMCAYYwHQYDVR0OBBYEFIQYzIU07LwMlJQuCFmcx7IQTgoIMA0GCSqGSIb3
- DQEBCwUAA4IBAQCY8jdaQZChGsV2USggNiMOruYou6r4lK5IpDB/G/wkjUu0yKGX9rbxenDIU5PM
- CCjjmCXPI6T53iHTfIUJrU6adTrCC2qJeHZERxhlbI1Bjjt/msv0tadQ1wUsN+gDS63pYaACbvXy
- 8MWy7Vu33PqUXHeeE6V/Uq2V8viTO96LXFvKWlJbYK8U90vvo/ufQJVtMVT8QtPHRh8jrdkPSHCa
- 2XV4cdFyQzR1bldZwgJcJmApzyMZFo6IQ6XU5MsI+yMRQ+hDKXJioaldXgjUkK642M4UwtBV8ob2
- xJNDd2ZhwLnoQdeXeGADbkpyrqXRfboQnoZsG4q5WTP468SQvvG5
- -----END CERTIFICATE-----
- Amazon Root CA 2
- ================
- -----BEGIN CERTIFICATE-----
- MIIFQTCCAymgAwIBAgITBmyf0pY1hp8KD+WGePhbJruKNzANBgkqhkiG9w0BAQwFADA5MQswCQYD
- VQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSAyMB4XDTE1
- MDUyNjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpv
- bjEZMBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgMjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoC
- ggIBAK2Wny2cSkxKgXlRmeyKy2tgURO8TW0G/LAIjd0ZEGrHJgw12MBvIITplLGbhQPDW9tK6Mj4
- kHbZW0/jTOgGNk3Mmqw9DJArktQGGWCsN0R5hYGCrVo34A3MnaZMUnbqQ523BNFQ9lXg1dKmSYXp
- N+nKfq5clU1Imj+uIFptiJXZNLhSGkOQsL9sBbm2eLfq0OQ6PBJTYv9K8nu+NQWpEjTj82R0Yiw9
- AElaKP4yRLuH3WUnAnE72kr3H9rN9yFVkE8P7K6C4Z9r2UXTu/Bfh+08LDmG2j/e7HJV63mjrdvd
- fLC6HM783k81ds8P+HgfajZRRidhW+mez/CiVX18JYpvL7TFz4QuK/0NURBs+18bvBt+xa47mAEx
- kv8LV/SasrlX6avvDXbR8O70zoan4G7ptGmh32n2M8ZpLpcTnqWHsFcQgTfJU7O7f/aS0ZzQGPSS
- btqDT6ZjmUyl+17vIWR6IF9sZIUVyzfpYgwLKhbcAS4y2j5L9Z469hdAlO+ekQiG+r5jqFoz7Mt0
- Q5X5bGlSNscpb/xVA1wf+5+9R+vnSUeVC06JIglJ4PVhHvG/LopyboBZ/1c6+XUyo05f7O0oYtlN
- c/LMgRdg7c3r3NunysV+Ar3yVAhU/bQtCSwXVEqY0VThUWcI0u1ufm8/0i2BWSlmy5A5lREedCf+
- 3euvAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBSw
- DPBMMPQFWAJI/TPlUq9LhONmUjANBgkqhkiG9w0BAQwFAAOCAgEAqqiAjw54o+Ci1M3m9Zh6O+oA
- A7CXDpO8Wqj2LIxyh6mx/H9z/WNxeKWHWc8w4Q0QshNabYL1auaAn6AFC2jkR2vHat+2/XcycuUY
- +gn0oJMsXdKMdYV2ZZAMA3m3MSNjrXiDCYZohMr/+c8mmpJ5581LxedhpxfL86kSk5Nrp+gvU5LE
- YFiwzAJRGFuFjWJZY7attN6a+yb3ACfAXVU3dJnJUH/jWS5E4ywl7uxMMne0nxrpS10gxdr9HIcW
- xkPo1LsmmkVwXqkLN1PiRnsn/eBG8om3zEK2yygmbtmlyTrIQRNg91CMFa6ybRoVGld45pIq2WWQ
- gj9sAq+uEjonljYE1x2igGOpm/HlurR8FLBOybEfdF849lHqm/osohHUqS0nGkWxr7JOcQ3AWEbW
- aQbLU8uz/mtBzUF+fUwPfHJ5elnNXkoOrJupmHN5fLT0zLm4BwyydFy4x2+IoZCn9Kr5v2c69BoV
- Yh63n749sSmvZ6ES8lgQGVMDMBu4Gon2nL2XA46jCfMdiyHxtN/kHNGfZQIG6lzWE7OE76KlXIx3
- KadowGuuQNKotOrN8I1LOJwZmhsoVLiJkO/KdYE+HvJkJMcYr07/R54H9jVlpNMKVv/1F2Rs76gi
- JUmTtt8AF9pYfl3uxRuw0dFfIRDH+fO6AgonB8Xx1sfT4PsJYGw=
- -----END CERTIFICATE-----
- Amazon Root CA 3
- ================
- -----BEGIN CERTIFICATE-----
- MIIBtjCCAVugAwIBAgITBmyf1XSXNmY/Owua2eiedgPySjAKBggqhkjOPQQDAjA5MQswCQYDVQQG
- EwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSAzMB4XDTE1MDUy
- NjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZ
- MBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgMzBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABCmXp8ZB
- f8ANm+gBG1bG8lKlui2yEujSLtf6ycXYqm0fc4E7O5hrOXwzpcVOho6AF2hiRVd9RFgdszflZwjr
- Zt6jQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBSrttvXBp43
- rDCGB5Fwx5zEGbF4wDAKBggqhkjOPQQDAgNJADBGAiEA4IWSoxe3jfkrBqWTrBqYaGFy+uGh0Psc
- eGCmQ5nFuMQCIQCcAu/xlJyzlvnrxir4tiz+OpAUFteMYyRIHN8wfdVoOw==
- -----END CERTIFICATE-----
- Amazon Root CA 4
- ================
- -----BEGIN CERTIFICATE-----
- MIIB8jCCAXigAwIBAgITBmyf18G7EEwpQ+Vxe3ssyBrBDjAKBggqhkjOPQQDAzA5MQswCQYDVQQG
- EwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSA0MB4XDTE1MDUy
- NjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZ
- MBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgNDB2MBAGByqGSM49AgEGBSuBBAAiA2IABNKrijdPo1MN
- /sGKe0uoe0ZLY7Bi9i0b2whxIdIA6GO9mif78DluXeo9pcmBqqNbIJhFXRbb/egQbeOc4OO9X4Ri
- 83BkM6DLJC9wuoihKqB1+IGuYgbEgds5bimwHvouXKNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNV
- HQ8BAf8EBAMCAYYwHQYDVR0OBBYEFNPsxzplbszh2naaVvuc84ZtV+WBMAoGCCqGSM49BAMDA2gA
- MGUCMDqLIfG9fhGt0O9Yli/W651+kI0rz2ZVwyzjKKlwCkcO8DdZEv8tmZQoTipPNU0zWgIxAOp1
- AE47xDqUEpHJWEadIRNyp4iciuRMStuW1KyLa2tJElMzrdfkviT8tQp21KW8EA==
- -----END CERTIFICATE-----
- TUBITAK Kamu SM SSL Kok Sertifikasi - Surum 1
- =============================================
- -----BEGIN CERTIFICATE-----
- MIIEYzCCA0ugAwIBAgIBATANBgkqhkiG9w0BAQsFADCB0jELMAkGA1UEBhMCVFIxGDAWBgNVBAcT
- D0dlYnplIC0gS29jYWVsaTFCMEAGA1UEChM5VHVya2l5ZSBCaWxpbXNlbCB2ZSBUZWtub2xvamlr
- IEFyYXN0aXJtYSBLdXJ1bXUgLSBUVUJJVEFLMS0wKwYDVQQLEyRLYW11IFNlcnRpZmlrYXN5b24g
- TWVya2V6aSAtIEthbXUgU00xNjA0BgNVBAMTLVRVQklUQUsgS2FtdSBTTSBTU0wgS29rIFNlcnRp
- ZmlrYXNpIC0gU3VydW0gMTAeFw0xMzExMjUwODI1NTVaFw00MzEwMjUwODI1NTVaMIHSMQswCQYD
- VQQGEwJUUjEYMBYGA1UEBxMPR2ViemUgLSBLb2NhZWxpMUIwQAYDVQQKEzlUdXJraXllIEJpbGlt
- c2VsIHZlIFRla25vbG9qaWsgQXJhc3Rpcm1hIEt1cnVtdSAtIFRVQklUQUsxLTArBgNVBAsTJEth
- bXUgU2VydGlmaWthc3lvbiBNZXJrZXppIC0gS2FtdSBTTTE2MDQGA1UEAxMtVFVCSVRBSyBLYW11
- IFNNIFNTTCBLb2sgU2VydGlmaWthc2kgLSBTdXJ1bSAxMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
- MIIBCgKCAQEAr3UwM6q7a9OZLBI3hNmNe5eA027n/5tQlT6QlVZC1xl8JoSNkvoBHToP4mQ4t4y8
- 6Ij5iySrLqP1N+RAjhgleYN1Hzv/bKjFxlb4tO2KRKOrbEz8HdDc72i9z+SqzvBV96I01INrN3wc
- wv61A+xXzry0tcXtAA9TNypN9E8Mg/uGz8v+jE69h/mniyFXnHrfA2eJLJ2XYacQuFWQfw4tJzh0
- 3+f92k4S400VIgLI4OD8D62K18lUUMw7D8oWgITQUVbDjlZ/iSIzL+aFCr2lqBs23tPcLG07xxO9
- WSMs5uWk99gL7eqQQESolbuT1dCANLZGeA4fAJNG4e7p+exPFwIDAQABo0IwQDAdBgNVHQ4EFgQU
- ZT/HiobGPN08VFw1+DrtUgxHV8gwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJ
- KoZIhvcNAQELBQADggEBACo/4fEyjq7hmFxLXs9rHmoJ0iKpEsdeV31zVmSAhHqT5Am5EM2fKifh
- AHe+SMg1qIGf5LgsyX8OsNJLN13qudULXjS99HMpw+0mFZx+CFOKWI3QSyjfwbPfIPP54+M638yc
- lNhOT8NrF7f3cuitZjO1JVOr4PhMqZ398g26rrnZqsZr+ZO7rqu4lzwDGrpDxpa5RXI4s6ehlj2R
- e37AIVNMh+3yC1SVUZPVIqUNivGTDj5UDrDYyU7c8jEyVupk+eq1nRZmQnLzf9OxMUP8pI4X8W0j
- q5Rm+K37DwhuJi1/FwcJsoz7UMCflo3Ptv0AnVoUmr8CRPXBwp8iXqIPoeM=
- -----END CERTIFICATE-----
- GDCA TrustAUTH R5 ROOT
- ======================
- -----BEGIN CERTIFICATE-----
- MIIFiDCCA3CgAwIBAgIIfQmX/vBH6nowDQYJKoZIhvcNAQELBQAwYjELMAkGA1UEBhMCQ04xMjAw
- BgNVBAoMKUdVQU5HIERPTkcgQ0VSVElGSUNBVEUgQVVUSE9SSVRZIENPLixMVEQuMR8wHQYDVQQD
- DBZHRENBIFRydXN0QVVUSCBSNSBST09UMB4XDTE0MTEyNjA1MTMxNVoXDTQwMTIzMTE1NTk1OVow
- YjELMAkGA1UEBhMCQ04xMjAwBgNVBAoMKUdVQU5HIERPTkcgQ0VSVElGSUNBVEUgQVVUSE9SSVRZ
- IENPLixMVEQuMR8wHQYDVQQDDBZHRENBIFRydXN0QVVUSCBSNSBST09UMIICIjANBgkqhkiG9w0B
- AQEFAAOCAg8AMIICCgKCAgEA2aMW8Mh0dHeb7zMNOwZ+Vfy1YI92hhJCfVZmPoiC7XJjDp6L3TQs
- AlFRwxn9WVSEyfFrs0yw6ehGXTjGoqcuEVe6ghWinI9tsJlKCvLriXBjTnnEt1u9ol2x8kECK62p
- OqPseQrsXzrj/e+APK00mxqriCZ7VqKChh/rNYmDf1+uKU49tm7srsHwJ5uu4/Ts765/94Y9cnrr
- pftZTqfrlYwiOXnhLQiPzLyRuEH3FMEjqcOtmkVEs7LXLM3GKeJQEK5cy4KOFxg2fZfmiJqwTTQJ
- 9Cy5WmYqsBebnh52nUpmMUHfP/vFBu8btn4aRjb3ZGM74zkYI+dndRTVdVeSN72+ahsmUPI2JgaQ
- xXABZG12ZuGR224HwGGALrIuL4xwp9E7PLOR5G62xDtw8mySlwnNR30YwPO7ng/Wi64HtloPzgsM
- R6flPri9fcebNaBhlzpBdRfMK5Z3KpIhHtmVdiBnaM8Nvd/WHwlqmuLMc3GkL30SgLdTMEZeS1SZ
- D2fJpcjyIMGC7J0R38IC+xo70e0gmu9lZJIQDSri3nDxGGeCjGHeuLzRL5z7D9Ar7Rt2ueQ5Vfj4
- oR24qoAATILnsn8JuLwwoC8N9VKejveSswoAHQBUlwbgsQfZxw9cZX08bVlX5O2ljelAU58VS6Bx
- 9hoh49pwBiFYFIeFd3mqgnkCAwEAAaNCMEAwHQYDVR0OBBYEFOLJQJ9NzuiaoXzPDj9lxSmIahlR
- MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEBCwUAA4ICAQDRSVfg
- p8xoWLoBDysZzY2wYUWsEe1jUGn4H3++Fo/9nesLqjJHdtJnJO29fDMylyrHBYZmDRd9FBUb1Ov9
- H5r2XpdptxolpAqzkT9fNqyL7FeoPueBihhXOYV0GkLH6VsTX4/5COmSdI31R9KrO9b7eGZONn35
- 6ZLpBN79SWP8bfsUcZNnL0dKt7n/HipzcEYwv1ryL3ml4Y0M2fmyYzeMN2WFcGpcWwlyua1jPLHd
- +PwyvzeG5LuOmCd+uh8W4XAR8gPfJWIyJyYYMoSf/wA6E7qaTfRPuBRwIrHKK5DOKcFw9C+df/KQ
- HtZa37dG/OaG+svgIHZ6uqbL9XzeYqWxi+7egmaKTjowHz+Ay60nugxe19CxVsp3cbK1daFQqUBD
- F8Io2c9Si1vIY9RCPqAzekYu9wogRlR+ak8x8YF+QnQ4ZXMn7sZ8uI7XpTrXmKGcjBBV09tL7ECQ
- 8s1uV9JiDnxXk7Gnbc2dg7sq5+W2O3FYrf3RRbxake5TFW/TRQl1brqQXR4EzzffHqhmsYzmIGrv
- /EhOdJhCrylvLmrH+33RZjEizIYAfmaDDEL0vTSSwxrqT8p+ck0LcIymSLumoRT2+1hEmRSuqguT
- aaApJUqlyyvdimYHFngVV3Eb7PVHhPOeMTd61X8kreS8/f3MboPoDKi3QWwH3b08hpcv0g==
- -----END CERTIFICATE-----
- TrustCor RootCert CA-1
- ======================
- -----BEGIN CERTIFICATE-----
- MIIEMDCCAxigAwIBAgIJANqb7HHzA7AZMA0GCSqGSIb3DQEBCwUAMIGkMQswCQYDVQQGEwJQQTEP
- MA0GA1UECAwGUGFuYW1hMRQwEgYDVQQHDAtQYW5hbWEgQ2l0eTEkMCIGA1UECgwbVHJ1c3RDb3Ig
- U3lzdGVtcyBTLiBkZSBSLkwuMScwJQYDVQQLDB5UcnVzdENvciBDZXJ0aWZpY2F0ZSBBdXRob3Jp
- dHkxHzAdBgNVBAMMFlRydXN0Q29yIFJvb3RDZXJ0IENBLTEwHhcNMTYwMjA0MTIzMjE2WhcNMjkx
- MjMxMTcyMzE2WjCBpDELMAkGA1UEBhMCUEExDzANBgNVBAgMBlBhbmFtYTEUMBIGA1UEBwwLUGFu
- YW1hIENpdHkxJDAiBgNVBAoMG1RydXN0Q29yIFN5c3RlbXMgUy4gZGUgUi5MLjEnMCUGA1UECwwe
- VHJ1c3RDb3IgQ2VydGlmaWNhdGUgQXV0aG9yaXR5MR8wHQYDVQQDDBZUcnVzdENvciBSb290Q2Vy
- dCBDQS0xMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAv463leLCJhJrMxnHQFgKq1mq
- jQCj/IDHUHuO1CAmujIS2CNUSSUQIpidRtLByZ5OGy4sDjjzGiVoHKZaBeYei0i/mJZ0PmnK6bV4
- pQa81QBeCQryJ3pS/C3Vseq0iWEk8xoT26nPUu0MJLq5nux+AHT6k61sKZKuUbS701e/s/OojZz0
- JEsq1pme9J7+wH5COucLlVPat2gOkEz7cD+PSiyU8ybdY2mplNgQTsVHCJCZGxdNuWxu72CVEY4h
- gLW9oHPY0LJ3xEXqWib7ZnZ2+AYfYW0PVcWDtxBWcgYHpfOxGgMFZA6dWorWhnAbJN7+KIor0Gqw
- /Hqi3LJ5DotlDwIDAQABo2MwYTAdBgNVHQ4EFgQU7mtJPHo/DeOxCbeKyKsZn3MzUOcwHwYDVR0j
- BBgwFoAU7mtJPHo/DeOxCbeKyKsZn3MzUOcwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
- AYYwDQYJKoZIhvcNAQELBQADggEBACUY1JGPE+6PHh0RU9otRCkZoB5rMZ5NDp6tPVxBb5UrJKF5
- mDo4Nvu7Zp5I/5CQ7z3UuJu0h3U/IJvOcs+hVcFNZKIZBqEHMwwLKeXx6quj7LUKdJDHfXLy11yf
- ke+Ri7fc7Waiz45mO7yfOgLgJ90WmMCV1Aqk5IGadZQ1nJBfiDcGrVmVCrDRZ9MZyonnMlo2HD6C
- qFqTvsbQZJG2z9m2GM/bftJlo6bEjhcxwft+dtvTheNYsnd6djtsL1Ac59v2Z3kf9YKVmgenFK+P
- 3CghZwnS1k1aHBkcjndcw5QkPTJrS37UeJSDvjdNzl/HHk484IkzlQsPpTLWPFp5LBk=
- -----END CERTIFICATE-----
- TrustCor RootCert CA-2
- ======================
- -----BEGIN CERTIFICATE-----
- MIIGLzCCBBegAwIBAgIIJaHfyjPLWQIwDQYJKoZIhvcNAQELBQAwgaQxCzAJBgNVBAYTAlBBMQ8w
- DQYDVQQIDAZQYW5hbWExFDASBgNVBAcMC1BhbmFtYSBDaXR5MSQwIgYDVQQKDBtUcnVzdENvciBT
- eXN0ZW1zIFMuIGRlIFIuTC4xJzAlBgNVBAsMHlRydXN0Q29yIENlcnRpZmljYXRlIEF1dGhvcml0
- eTEfMB0GA1UEAwwWVHJ1c3RDb3IgUm9vdENlcnQgQ0EtMjAeFw0xNjAyMDQxMjMyMjNaFw0zNDEy
- MzExNzI2MzlaMIGkMQswCQYDVQQGEwJQQTEPMA0GA1UECAwGUGFuYW1hMRQwEgYDVQQHDAtQYW5h
- bWEgQ2l0eTEkMCIGA1UECgwbVHJ1c3RDb3IgU3lzdGVtcyBTLiBkZSBSLkwuMScwJQYDVQQLDB5U
- cnVzdENvciBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkxHzAdBgNVBAMMFlRydXN0Q29yIFJvb3RDZXJ0
- IENBLTIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCnIG7CKqJiJJWQdsg4foDSq8Gb
- ZQWU9MEKENUCrO2fk8eHyLAnK0IMPQo+QVqedd2NyuCb7GgypGmSaIwLgQ5WoD4a3SwlFIIvl9Nk
- RvRUqdw6VC0xK5mC8tkq1+9xALgxpL56JAfDQiDyitSSBBtlVkxs1Pu2YVpHI7TYabS3OtB0PAx1
- oYxOdqHp2yqlO/rOsP9+aij9JxzIsekp8VduZLTQwRVtDr4uDkbIXvRR/u8OYzo7cbrPb1nKDOOb
- XUm4TOJXsZiKQlecdu/vvdFoqNL0Cbt3Nb4lggjEFixEIFapRBF37120Hapeaz6LMvYHL1cEksr1
- /p3C6eizjkxLAjHZ5DxIgif3GIJ2SDpxsROhOdUuxTTCHWKF3wP+TfSvPd9cW436cOGlfifHhi5q
- jxLGhF5DUVCcGZt45vz27Ud+ez1m7xMTiF88oWP7+ayHNZ/zgp6kPwqcMWmLmaSISo5uZk3vFsQP
- eSghYA2FFn3XVDjxklb9tTNMg9zXEJ9L/cb4Qr26fHMC4P99zVvh1Kxhe1fVSntb1IVYJ12/+Ctg
- rKAmrhQhJ8Z3mjOAPF5GP/fDsaOGM8boXg25NSyqRsGFAnWAoOsk+xWq5Gd/bnc/9ASKL3x74xdh
- 8N0JqSDIvgmk0H5Ew7IwSjiqqewYmgeCK9u4nBit2uBGF6zPXQIDAQABo2MwYTAdBgNVHQ4EFgQU
- 2f4hQG6UnrybPZx9mCAZ5YwwYrIwHwYDVR0jBBgwFoAU2f4hQG6UnrybPZx9mCAZ5YwwYrIwDwYD
- VR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAYYwDQYJKoZIhvcNAQELBQADggIBAJ5Fngw7tu/h
- Osh80QA9z+LqBrWyOrsGS2h60COXdKcs8AjYeVrXWoSK2BKaG9l9XE1wxaX5q+WjiYndAfrs3fnp
- kpfbsEZC89NiqpX+MWcUaViQCqoL7jcjx1BRtPV+nuN79+TMQjItSQzL/0kMmx40/W5ulop5A7Zv
- 2wnL/V9lFDfhOPXzYRZY5LVtDQsEGz9QLX+zx3oaFoBg+Iof6Rsqxvm6ARppv9JYx1RXCI/hOWB3
- S6xZhBqI8d3LT3jX5+EzLfzuQfogsL7L9ziUwOHQhQ+77Sxzq+3+knYaZH9bDTMJBzN7Bj8RpFxw
- PIXAz+OQqIN3+tvmxYxoZxBnpVIt8MSZj3+/0WvitUfW2dCFmU2Umw9Lje4AWkcdEQOsQRivh7dv
- DDqPys/cA8GiCcjl/YBeyGBCARsaU1q7N6a3vLqE6R5sGtRk2tRD/pOLS/IseRYQ1JMLiI+h2IYU
- RpFHmygk71dSTlxCnKr3Sewn6EAes6aJInKc9Q0ztFijMDvd1GpUk74aTfOTlPf8hAs/hCBcNANE
- xdqtvArBAs8e5ZTZ845b2EzwnexhF7sUMlQMAimTHpKG9n/v55IFDlndmQguLvqcAFLTxWYp5KeX
- RKQOKIETNcX2b2TmQcTVL8w0RSXPQQCWPUouwpaYT05KnJe32x+SMsj/D1Fu1uwJ
- -----END CERTIFICATE-----
- TrustCor ECA-1
- ==============
- -----BEGIN CERTIFICATE-----
- MIIEIDCCAwigAwIBAgIJAISCLF8cYtBAMA0GCSqGSIb3DQEBCwUAMIGcMQswCQYDVQQGEwJQQTEP
- MA0GA1UECAwGUGFuYW1hMRQwEgYDVQQHDAtQYW5hbWEgQ2l0eTEkMCIGA1UECgwbVHJ1c3RDb3Ig
- U3lzdGVtcyBTLiBkZSBSLkwuMScwJQYDVQQLDB5UcnVzdENvciBDZXJ0aWZpY2F0ZSBBdXRob3Jp
- dHkxFzAVBgNVBAMMDlRydXN0Q29yIEVDQS0xMB4XDTE2MDIwNDEyMzIzM1oXDTI5MTIzMTE3Mjgw
- N1owgZwxCzAJBgNVBAYTAlBBMQ8wDQYDVQQIDAZQYW5hbWExFDASBgNVBAcMC1BhbmFtYSBDaXR5
- MSQwIgYDVQQKDBtUcnVzdENvciBTeXN0ZW1zIFMuIGRlIFIuTC4xJzAlBgNVBAsMHlRydXN0Q29y
- IENlcnRpZmljYXRlIEF1dGhvcml0eTEXMBUGA1UEAwwOVHJ1c3RDb3IgRUNBLTEwggEiMA0GCSqG
- SIb3DQEBAQUAA4IBDwAwggEKAoIBAQDPj+ARtZ+odnbb3w9U73NjKYKtR8aja+3+XzP4Q1HpGjOR
- MRegdMTUpwHmspI+ap3tDvl0mEDTPwOABoJA6LHip1GnHYMma6ve+heRK9jGrB6xnhkB1Zem6g23
- xFUfJ3zSCNV2HykVh0A53ThFEXXQmqc04L/NyFIduUd+Dbi7xgz2c1cWWn5DkR9VOsZtRASqnKmc
- p0yJF4OuowReUoCLHhIlERnXDH19MURB6tuvsBzvgdAsxZohmz3tQjtQJvLsznFhBmIhVE5/wZ0+
- fyCMgMsq2JdiyIMzkX2woloPV+g7zPIlstR8L+xNxqE6FXrntl019fZISjZFZtS6mFjBAgMBAAGj
- YzBhMB0GA1UdDgQWBBREnkj1zG1I1KBLf/5ZJC+Dl5mahjAfBgNVHSMEGDAWgBREnkj1zG1I1KBL
- f/5ZJC+Dl5mahjAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjANBgkqhkiG9w0BAQsF
- AAOCAQEABT41XBVwm8nHc2FvcivUwo/yQ10CzsSUuZQRg2dd4mdsdXa/uwyqNsatR5Nj3B5+1t4u
- /ukZMjgDfxT2AHMsWbEhBuH7rBiVDKP/mZb3Kyeb1STMHd3BOuCYRLDE5D53sXOpZCz2HAF8P11F
- hcCF5yWPldwX8zyfGm6wyuMdKulMY/okYWLW2n62HGz1Ah3UKt1VkOsqEUc8Ll50soIipX1TH0Xs
- J5F95yIW6MBoNtjG8U+ARDL54dHRHareqKucBK+tIA5kmE2la8BIWJZpTdwHjFGTot+fDz2LYLSC
- jaoITmJF4PkL0uDgPFveXHEnJcLmA4GLEFPjx1WitJ/X5g==
- -----END CERTIFICATE-----
- SSL.com Root Certification Authority RSA
- ========================================
- -----BEGIN CERTIFICATE-----
- MIIF3TCCA8WgAwIBAgIIeyyb0xaAMpkwDQYJKoZIhvcNAQELBQAwfDELMAkGA1UEBhMCVVMxDjAM
- BgNVBAgMBVRleGFzMRAwDgYDVQQHDAdIb3VzdG9uMRgwFgYDVQQKDA9TU0wgQ29ycG9yYXRpb24x
- MTAvBgNVBAMMKFNTTC5jb20gUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSBSU0EwHhcNMTYw
- MjEyMTczOTM5WhcNNDEwMjEyMTczOTM5WjB8MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMx
- EDAOBgNVBAcMB0hvdXN0b24xGDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjExMC8GA1UEAwwoU1NM
- LmNvbSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IFJTQTCCAiIwDQYJKoZIhvcNAQEBBQAD
- ggIPADCCAgoCggIBAPkP3aMrfcvQKv7sZ4Wm5y4bunfh4/WvpOz6Sl2RxFdHaxh3a3by/ZPkPQ/C
- Fp4LZsNWlJ4Xg4XOVu/yFv0AYvUiCVToZRdOQbngT0aXqhvIuG5iXmmxX9sqAn78bMrzQdjt0Oj8
- P2FI7bADFB0QDksZ4LtO7IZl/zbzXmcCC52GVWH9ejjt/uIZALdvoVBidXQ8oPrIJZK0bnoix/ge
- oeOy3ZExqysdBP+lSgQ36YWkMyv94tZVNHwZpEpox7Ko07fKoZOI68GXvIz5HdkihCR0xwQ9aqkp
- k8zruFvh/l8lqjRYyMEjVJ0bmBHDOJx+PYZspQ9AhnwC9FwCTyjLrnGfDzrIM/4RJTXq/LrFYD3Z
- fBjVsqnTdXgDciLKOsMf7yzlLqn6niy2UUb9rwPW6mBo6oUWNmuF6R7As93EJNyAKoFBbZQ+yODJ
- gUEAnl6/f8UImKIYLEJAs/lvOCdLToD0PYFH4Ih86hzOtXVcUS4cK38acijnALXRdMbX5J+tB5O2
- UzU1/Dfkw/ZdFr4hc96SCvigY2q8lpJqPvi8ZVWb3vUNiSYE/CUapiVpy8JtynziWV+XrOvvLsi8
- 1xtZPCvM8hnIk2snYxnP/Okm+Mpxm3+T/jRnhE6Z6/yzeAkzcLpmpnbtG3PrGqUNxCITIJRWCk4s
- bE6x/c+cCbqiM+2HAgMBAAGjYzBhMB0GA1UdDgQWBBTdBAkHovV6fVJTEpKV7jiAJQ2mWTAPBgNV
- HRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFN0ECQei9Xp9UlMSkpXuOIAlDaZZMA4GA1UdDwEB/wQE
- AwIBhjANBgkqhkiG9w0BAQsFAAOCAgEAIBgRlCn7Jp0cHh5wYfGVcpNxJK1ok1iOMq8bs3AD/CUr
- dIWQPXhq9LmLpZc7tRiRux6n+UBbkflVma8eEdBcHadm47GUBwwyOabqG7B52B2ccETjit3E+ZUf
- ijhDPwGFpUenPUayvOUiaPd7nNgsPgohyC0zrL/FgZkxdMF1ccW+sfAjRfSda/wZY52jvATGGAsl
- u1OJD7OAUN5F7kR/q5R4ZJjT9ijdh9hwZXT7DrkT66cPYakylszeu+1jTBi7qUD3oFRuIIhxdRjq
- erQ0cuAjJ3dctpDqhiVAq+8zD8ufgr6iIPv2tS0a5sKFsXQP+8hlAqRSAUfdSSLBv9jra6x+3uxj
- MxW3IwiPxg+NQVrdjsW5j+VFP3jbutIbQLH+cU0/4IGiul607BXgk90IH37hVZkLId6Tngr75qNJ
- vTYw/ud3sqB1l7UtgYgXZSD32pAAn8lSzDLKNXz1PQ/YK9f1JmzJBjSWFupwWRoyeXkLtoh/D1JI
- Pb9s2KJELtFOt3JY04kTlf5Eq/jXixtunLwsoFvVagCvXzfh1foQC5ichucmj87w7G6KVwuA406y
- wKBjYZC6VWg3dGq2ktufoYYitmUnDuy2n0Jg5GfCtdpBC8TTi2EbvPofkSvXRAdeuims2cXp71NI
- WuuA8ShYIc2wBlX7Jz9TkHCpBB5XJ7k=
- -----END CERTIFICATE-----
- SSL.com Root Certification Authority ECC
- ========================================
- -----BEGIN CERTIFICATE-----
- MIICjTCCAhSgAwIBAgIIdebfy8FoW6gwCgYIKoZIzj0EAwIwfDELMAkGA1UEBhMCVVMxDjAMBgNV
- BAgMBVRleGFzMRAwDgYDVQQHDAdIb3VzdG9uMRgwFgYDVQQKDA9TU0wgQ29ycG9yYXRpb24xMTAv
- BgNVBAMMKFNTTC5jb20gUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSBFQ0MwHhcNMTYwMjEy
- MTgxNDAzWhcNNDEwMjEyMTgxNDAzWjB8MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMxEDAO
- BgNVBAcMB0hvdXN0b24xGDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjExMC8GA1UEAwwoU1NMLmNv
- bSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IEVDQzB2MBAGByqGSM49AgEGBSuBBAAiA2IA
- BEVuqVDEpiM2nl8ojRfLliJkP9x6jh3MCLOicSS6jkm5BBtHllirLZXI7Z4INcgn64mMU1jrYor+
- 8FsPazFSY0E7ic3s7LaNGdM0B9y7xgZ/wkWV7Mt/qCPgCemB+vNH06NjMGEwHQYDVR0OBBYEFILR
- hXMw5zUE044CkvvlpNHEIejNMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUgtGFczDnNQTT
- jgKS++Wk0cQh6M0wDgYDVR0PAQH/BAQDAgGGMAoGCCqGSM49BAMCA2cAMGQCMG/n61kRpGDPYbCW
- e+0F+S8Tkdzt5fxQaxFGRrMcIQBiu77D5+jNB5n5DQtdcj7EqgIwH7y6C+IwJPt8bYBVCpk+gA0z
- 5Wajs6O7pdWLjwkspl1+4vAHCGht0nxpbl/f5Wpl
- -----END CERTIFICATE-----
- SSL.com EV Root Certification Authority RSA R2
- ==============================================
- -----BEGIN CERTIFICATE-----
- MIIF6zCCA9OgAwIBAgIIVrYpzTS8ePYwDQYJKoZIhvcNAQELBQAwgYIxCzAJBgNVBAYTAlVTMQ4w
- DAYDVQQIDAVUZXhhczEQMA4GA1UEBwwHSG91c3RvbjEYMBYGA1UECgwPU1NMIENvcnBvcmF0aW9u
- MTcwNQYDVQQDDC5TU0wuY29tIEVWIFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgUlNBIFIy
- MB4XDTE3MDUzMTE4MTQzN1oXDTQyMDUzMDE4MTQzN1owgYIxCzAJBgNVBAYTAlVTMQ4wDAYDVQQI
- DAVUZXhhczEQMA4GA1UEBwwHSG91c3RvbjEYMBYGA1UECgwPU1NMIENvcnBvcmF0aW9uMTcwNQYD
- VQQDDC5TU0wuY29tIEVWIFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgUlNBIFIyMIICIjAN
- BgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAjzZlQOHWTcDXtOlG2mvqM0fNTPl9fb69LT3w23jh
- hqXZuglXaO1XPqDQCEGD5yhBJB/jchXQARr7XnAjssufOePPxU7Gkm0mxnu7s9onnQqG6YE3Bf7w
- cXHswxzpY6IXFJ3vG2fThVUCAtZJycxa4bH3bzKfydQ7iEGonL3Lq9ttewkfokxykNorCPzPPFTO
- Zw+oz12WGQvE43LrrdF9HSfvkusQv1vrO6/PgN3B0pYEW3p+pKk8OHakYo6gOV7qd89dAFmPZiw+
- B6KjBSYRaZfqhbcPlgtLyEDhULouisv3D5oi53+aNxPN8k0TayHRwMwi8qFG9kRpnMphNQcAb9Zh
- CBHqurj26bNg5U257J8UZslXWNvNh2n4ioYSA0e/ZhN2rHd9NCSFg83XqpyQGp8hLH94t2S42Oim
- 9HizVcuE0jLEeK6jj2HdzghTreyI/BXkmg3mnxp3zkyPuBQVPWKchjgGAGYS5Fl2WlPAApiiECto
- RHuOec4zSnaqW4EWG7WK2NAAe15itAnWhmMOpgWVSbooi4iTsjQc2KRVbrcc0N6ZVTsj9CLg+Slm
- JuwgUHfbSguPvuUCYHBBXtSuUDkiFCbLsjtzdFVHB3mBOagwE0TlBIqulhMlQg+5U8Sb/M3kHN48
- +qvWBkofZ6aYMBzdLNvcGJVXZsb/XItW9XcCAwEAAaNjMGEwDwYDVR0TAQH/BAUwAwEB/zAfBgNV
- HSMEGDAWgBT5YLvU49U09rj1BoAlp3PbRmmonjAdBgNVHQ4EFgQU+WC71OPVNPa49QaAJadz20Zp
- qJ4wDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEBCwUAA4ICAQBWs47LCp1Jjr+kxJG7ZhcFUZh1
- ++VQLHqe8RT6q9OKPv+RKY9ji9i0qVQBDb6Thi/5Sm3HXvVX+cpVHBK+Rw82xd9qt9t1wkclf7nx
- Y/hoLVUE0fKNsKTPvDxeH3jnpaAgcLAExbf3cqfeIg29MyVGjGSSJuM+LmOW2puMPfgYCdcDzH2G
- guDKBAdRUNf/ktUM79qGn5nX67evaOI5JpS6aLe/g9Pqemc9YmeuJeVy6OLk7K4S9ksrPJ/psEDz
- OFSz/bdoyNrGj1E8svuR3Bznm53htw1yj+KkxKl4+esUrMZDBcJlOSgYAsOCsp0FvmXtll9ldDz7
- CTUue5wT/RsPXcdtgTpWD8w74a8CLyKsRspGPKAcTNZEtF4uXBVmCeEmKf7GUmG6sXP/wwyc5Wxq
- lD8UykAWlYTzWamsX0xhk23RO8yilQwipmdnRC652dKKQbNmC1r7fSOl8hqw/96bg5Qu0T/fkreR
- rwU7ZcegbLHNYhLDkBvjJc40vG93drEQw/cFGsDWr3RiSBd3kmmQYRzelYB0VI8YHMPzA9C/pEN1
- hlMYegouCRw2n5H9gooiS9EOUCXdywMMF8mDAAhONU2Ki+3wApRmLER/y5UnlhetCTCstnEXbosX
- 9hwJ1C07mKVx01QT2WDz9UtmT/rx7iASjbSsV7FFY6GsdqnC+w==
- -----END CERTIFICATE-----
- SSL.com EV Root Certification Authority ECC
- ===========================================
- -----BEGIN CERTIFICATE-----
- MIIClDCCAhqgAwIBAgIILCmcWxbtBZUwCgYIKoZIzj0EAwIwfzELMAkGA1UEBhMCVVMxDjAMBgNV
- BAgMBVRleGFzMRAwDgYDVQQHDAdIb3VzdG9uMRgwFgYDVQQKDA9TU0wgQ29ycG9yYXRpb24xNDAy
- BgNVBAMMK1NTTC5jb20gRVYgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSBFQ0MwHhcNMTYw
- MjEyMTgxNTIzWhcNNDEwMjEyMTgxNTIzWjB/MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMx
- EDAOBgNVBAcMB0hvdXN0b24xGDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjE0MDIGA1UEAwwrU1NM
- LmNvbSBFViBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IEVDQzB2MBAGByqGSM49AgEGBSuB
- BAAiA2IABKoSR5CYG/vvw0AHgyBO8TCCogbR8pKGYfL2IWjKAMTH6kMAVIbc/R/fALhBYlzccBYy
- 3h+Z1MzFB8gIH2EWB1E9fVwHU+M1OIzfzZ/ZLg1KthkuWnBaBu2+8KGwytAJKaNjMGEwHQYDVR0O
- BBYEFFvKXuXe0oGqzagtZFG22XKbl+ZPMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUW8pe
- 5d7SgarNqC1kUbbZcpuX5k8wDgYDVR0PAQH/BAQDAgGGMAoGCCqGSM49BAMCA2gAMGUCMQCK5kCJ
- N+vp1RPZytRrJPOwPYdGWBrssd9v+1a6cGvHOMzosYxPD/fxZ3YOg9AeUY8CMD32IygmTMZgh5Mm
- m7I1HrrW9zzRHM76JTymGoEVW/MSD2zuZYrJh6j5B+BimoxcSg==
- -----END CERTIFICATE-----
- GlobalSign Root CA - R6
- =======================
- -----BEGIN CERTIFICATE-----
- MIIFgzCCA2ugAwIBAgIORea7A4Mzw4VlSOb/RVEwDQYJKoZIhvcNAQEMBQAwTDEgMB4GA1UECxMX
- R2xvYmFsU2lnbiBSb290IENBIC0gUjYxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkds
- b2JhbFNpZ24wHhcNMTQxMjEwMDAwMDAwWhcNMzQxMjEwMDAwMDAwWjBMMSAwHgYDVQQLExdHbG9i
- YWxTaWduIFJvb3QgQ0EgLSBSNjETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFs
- U2lnbjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAJUH6HPKZvnsFMp7PPcNCPG0RQss
- grRIxutbPK6DuEGSMxSkb3/pKszGsIhrxbaJ0cay/xTOURQh7ErdG1rG1ofuTToVBu1kZguSgMpE
- 3nOUTvOniX9PeGMIyBJQbUJmL025eShNUhqKGoC3GYEOfsSKvGRMIRxDaNc9PIrFsmbVkJq3MQbF
- vuJtMgamHvm566qjuL++gmNQ0PAYid/kD3n16qIfKtJwLnvnvJO7bVPiSHyMEAc4/2ayd2F+4OqM
- PKq0pPbzlUoSB239jLKJz9CgYXfIWHSw1CM69106yqLbnQneXUQtkPGBzVeS+n68UARjNN9rkxi+
- azayOeSsJDa38O+2HBNXk7besvjihbdzorg1qkXy4J02oW9UivFyVm4uiMVRQkQVlO6jxTiWm05O
- WgtH8wY2SXcwvHE35absIQh1/OZhFj931dmRl4QKbNQCTXTAFO39OfuD8l4UoQSwC+n+7o/hbguy
- CLNhZglqsQY6ZZZZwPA1/cnaKI0aEYdwgQqomnUdnjqGBQCe24DWJfncBZ4nWUx2OVvq+aWh2IMP
- 0f/fMBH5hc8zSPXKbWQULHpYT9NLCEnFlWQaYw55PfWzjMpYrZxCRXluDocZXFSxZba/jJvcE+kN
- b7gu3GduyYsRtYQUigAZcIN5kZeR1BonvzceMgfYFGM8KEyvAgMBAAGjYzBhMA4GA1UdDwEB/wQE
- AwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBSubAWjkxPioufi1xzWx/B/yGdToDAfBgNV
- HSMEGDAWgBSubAWjkxPioufi1xzWx/B/yGdToDANBgkqhkiG9w0BAQwFAAOCAgEAgyXt6NH9lVLN
- nsAEoJFp5lzQhN7craJP6Ed41mWYqVuoPId8AorRbrcWc+ZfwFSY1XS+wc3iEZGtIxg93eFyRJa0
- lV7Ae46ZeBZDE1ZXs6KzO7V33EByrKPrmzU+sQghoefEQzd5Mr6155wsTLxDKZmOMNOsIeDjHfrY
- BzN2VAAiKrlNIC5waNrlU/yDXNOd8v9EDERm8tLjvUYAGm0CuiVdjaExUd1URhxN25mW7xocBFym
- Fe944Hn+Xds+qkxV/ZoVqW/hpvvfcDDpw+5CRu3CkwWJ+n1jez/QcYF8AOiYrg54NMMl+68KnyBr
- 3TsTjxKM4kEaSHpzoHdpx7Zcf4LIHv5YGygrqGytXm3ABdJ7t+uA/iU3/gKbaKxCXcPu9czc8FB1
- 0jZpnOZ7BN9uBmm23goJSFmH63sUYHpkqmlD75HHTOwY3WzvUy2MmeFe8nI+z1TIvWfspA9MRf/T
- uTAjB0yPEL+GltmZWrSZVxykzLsViVO6LAUP5MSeGbEYNNVMnbrt9x+vJJUEeKgDu+6B5dpffItK
- oZB0JaezPkvILFa9x8jvOOJckvB595yEunQtYQEgfn7R8k8HWV+LLUNS60YMlOH1Zkd5d9VUWx+t
- JDfLRVpOoERIyNiwmcUVhAn21klJwGW45hpxbqCo8YLoRT5s1gLXCmeDBVrJpBA=
- -----END CERTIFICATE-----
- OISTE WISeKey Global Root GC CA
- ===============================
- -----BEGIN CERTIFICATE-----
- MIICaTCCAe+gAwIBAgIQISpWDK7aDKtARb8roi066jAKBggqhkjOPQQDAzBtMQswCQYDVQQGEwJD
- SDEQMA4GA1UEChMHV0lTZUtleTEiMCAGA1UECxMZT0lTVEUgRm91bmRhdGlvbiBFbmRvcnNlZDEo
- MCYGA1UEAxMfT0lTVEUgV0lTZUtleSBHbG9iYWwgUm9vdCBHQyBDQTAeFw0xNzA1MDkwOTQ4MzRa
- Fw00MjA1MDkwOTU4MzNaMG0xCzAJBgNVBAYTAkNIMRAwDgYDVQQKEwdXSVNlS2V5MSIwIAYDVQQL
- ExlPSVNURSBGb3VuZGF0aW9uIEVuZG9yc2VkMSgwJgYDVQQDEx9PSVNURSBXSVNlS2V5IEdsb2Jh
- bCBSb290IEdDIENBMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAETOlQwMYPchi82PG6s4nieUqjFqdr
- VCTbUf/q9Akkwwsin8tqJ4KBDdLArzHkdIJuyiXZjHWd8dvQmqJLIX4Wp2OQ0jnUsYd4XxiWD1Ab
- NTcPasbc2RNNpI6QN+a9WzGRo1QwUjAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAd
- BgNVHQ4EFgQUSIcUrOPDnpBgOtfKie7TrYy0UGYwEAYJKwYBBAGCNxUBBAMCAQAwCgYIKoZIzj0E
- AwMDaAAwZQIwJsdpW9zV57LnyAyMjMPdeYwbY9XJUpROTYJKcx6ygISpJcBMWm1JKWB4E+J+SOtk
- AjEA2zQgMgj/mkkCtojeFK9dbJlxjRo/i9fgojaGHAeCOnZT/cKi7e97sIBPWA9LUzm9
- -----END CERTIFICATE-----
- UCA Global G2 Root
- ==================
- -----BEGIN CERTIFICATE-----
- MIIFRjCCAy6gAwIBAgIQXd+x2lqj7V2+WmUgZQOQ7zANBgkqhkiG9w0BAQsFADA9MQswCQYDVQQG
- EwJDTjERMA8GA1UECgwIVW5pVHJ1c3QxGzAZBgNVBAMMElVDQSBHbG9iYWwgRzIgUm9vdDAeFw0x
- NjAzMTEwMDAwMDBaFw00MDEyMzEwMDAwMDBaMD0xCzAJBgNVBAYTAkNOMREwDwYDVQQKDAhVbmlU
- cnVzdDEbMBkGA1UEAwwSVUNBIEdsb2JhbCBHMiBSb290MIICIjANBgkqhkiG9w0BAQEFAAOCAg8A
- MIICCgKCAgEAxeYrb3zvJgUno4Ek2m/LAfmZmqkywiKHYUGRO8vDaBsGxUypK8FnFyIdK+35KYmT
- oni9kmugow2ifsqTs6bRjDXVdfkX9s9FxeV67HeToI8jrg4aA3++1NDtLnurRiNb/yzmVHqUwCoV
- 8MmNsHo7JOHXaOIxPAYzRrZUEaalLyJUKlgNAQLx+hVRZ2zA+te2G3/RVogvGjqNO7uCEeBHANBS
- h6v7hn4PJGtAnTRnvI3HLYZveT6OqTwXS3+wmeOwcWDcC/Vkw85DvG1xudLeJ1uK6NjGruFZfc8o
- LTW4lVYa8bJYS7cSN8h8s+1LgOGN+jIjtm+3SJUIsUROhYw6AlQgL9+/V087OpAh18EmNVQg7Mc/
- R+zvWr9LesGtOxdQXGLYD0tK3Cv6brxzks3sx1DoQZbXqX5t2Okdj4q1uViSukqSKwxW/YDrCPBe
- KW4bHAyvj5OJrdu9o54hyokZ7N+1wxrrFv54NkzWbtA+FxyQF2smuvt6L78RHBgOLXMDj6DlNaBa
- 4kx1HXHhOThTeEDMg5PXCp6dW4+K5OXgSORIskfNTip1KnvyIvbJvgmRlld6iIis7nCs+dwp4wwc
- OxJORNanTrAmyPPZGpeRaOrvjUYG0lZFWJo8DA+DuAUlwznPO6Q0ibd5Ei9Hxeepl2n8pndntd97
- 8XplFeRhVmUCAwEAAaNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0O
- BBYEFIHEjMz15DD/pQwIX4wVZyF0Ad/fMA0GCSqGSIb3DQEBCwUAA4ICAQATZSL1jiutROTL/7lo
- 5sOASD0Ee/ojL3rtNtqyzm325p7lX1iPyzcyochltq44PTUbPrw7tgTQvPlJ9Zv3hcU2tsu8+Mg5
- 1eRfB70VVJd0ysrtT7q6ZHafgbiERUlMjW+i67HM0cOU2kTC5uLqGOiiHycFutfl1qnN3e92mI0A
- Ds0b+gO3joBYDic/UvuUospeZcnWhNq5NXHzJsBPd+aBJ9J3O5oUb3n09tDh05S60FdRvScFDcH9
- yBIw7m+NESsIndTUv4BFFJqIRNow6rSn4+7vW4LVPtateJLbXDzz2K36uGt/xDYotgIVilQsnLAX
- c47QN6MUPJiVAAwpBVueSUmxX8fjy88nZY41F7dXyDDZQVu5FLbowg+UMaeUmMxq67XhJ/UQqAHo
- jhJi6IjMtX9Gl8CbEGY4GjZGXyJoPd/JxhMnq1MGrKI8hgZlb7F+sSlEmqO6SWkoaY/X5V+tBIZk
- bxqgDMUIYs6Ao9Dz7GjevjPHF1t/gMRMTLGmhIrDO7gJzRSBuhjjVFc2/tsvfEehOjPI+Vg7RE+x
- ygKJBJYoaMVLuCaJu9YzL1DV/pqJuhgyklTGW+Cd+V7lDSKb9triyCGyYiGqhkCyLmTTX8jjfhFn
- RR8F/uOi77Oos/N9j/gMHyIfLXC0uAE0djAA5SN4p1bXUB+K+wb1whnw0A==
- -----END CERTIFICATE-----
- UCA Extended Validation Root
- ============================
- -----BEGIN CERTIFICATE-----
- MIIFWjCCA0KgAwIBAgIQT9Irj/VkyDOeTzRYZiNwYDANBgkqhkiG9w0BAQsFADBHMQswCQYDVQQG
- EwJDTjERMA8GA1UECgwIVW5pVHJ1c3QxJTAjBgNVBAMMHFVDQSBFeHRlbmRlZCBWYWxpZGF0aW9u
- IFJvb3QwHhcNMTUwMzEzMDAwMDAwWhcNMzgxMjMxMDAwMDAwWjBHMQswCQYDVQQGEwJDTjERMA8G
- A1UECgwIVW5pVHJ1c3QxJTAjBgNVBAMMHFVDQSBFeHRlbmRlZCBWYWxpZGF0aW9uIFJvb3QwggIi
- MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCpCQcoEwKwmeBkqh5DFnpzsZGgdT6o+uM4AHrs
- iWogD4vFsJszA1qGxliG1cGFu0/GnEBNyr7uaZa4rYEwmnySBesFK5pI0Lh2PpbIILvSsPGP2KxF
- Rv+qZ2C0d35qHzwaUnoEPQc8hQ2E0B92CvdqFN9y4zR8V05WAT558aopO2z6+I9tTcg1367r3CTu
- eUWnhbYFiN6IXSV8l2RnCdm/WhUFhvMJHuxYMjMR83dksHYf5BA1FxvyDrFspCqjc/wJHx4yGVMR
- 59mzLC52LqGj3n5qiAno8geK+LLNEOfic0CTuwjRP+H8C5SzJe98ptfRr5//lpr1kXuYC3fUfugH
- 0mK1lTnj8/FtDw5lhIpjVMWAtuCeS31HJqcBCF3RiJ7XwzJE+oJKCmhUfzhTA8ykADNkUVkLo4KR
- el7sFsLzKuZi2irbWWIQJUoqgQtHB0MGcIfS+pMRKXpITeuUx3BNr2fVUbGAIAEBtHoIppB/TuDv
- B0GHr2qlXov7z1CymlSvw4m6WC31MJixNnI5fkkE/SmnTHnkBVfblLkWU41Gsx2VYVdWf6/wFlth
- WG82UBEL2KwrlRYaDh8IzTY0ZRBiZtWAXxQgXy0MoHgKaNYs1+lvK9JKBZP8nm9rZ/+I8U6laUpS
- NwXqxhaN0sSZ0YIrO7o1dfdRUVjzyAfd5LQDfwIDAQABo0IwQDAdBgNVHQ4EFgQU2XQ65DA9DfcS
- 3H5aBZ8eNJr34RQwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAYYwDQYJKoZIhvcNAQEL
- BQADggIBADaNl8xCFWQpN5smLNb7rhVpLGsaGvdftvkHTFnq88nIua7Mui563MD1sC3AO6+fcAUR
- ap8lTwEpcOPlDOHqWnzcSbvBHiqB9RZLcpHIojG5qtr8nR/zXUACE/xOHAbKsxSQVBcZEhrxH9cM
- aVr2cXj0lH2RC47skFSOvG+hTKv8dGT9cZr4QQehzZHkPJrgmzI5c6sq1WnIeJEmMX3ixzDx/BR4
- dxIOE/TdFpS/S2d7cFOFyrC78zhNLJA5wA3CXWvp4uXViI3WLL+rG761KIcSF3Ru/H38j9CHJrAb
- +7lsq+KePRXBOy5nAliRn+/4Qh8st2j1da3Ptfb/EX3C8CSlrdP6oDyp+l3cpaDvRKS+1ujl5BOW
- F3sGPjLtx7dCvHaj2GU4Kzg1USEODm8uNBNA4StnDG1KQTAYI1oyVZnJF+A83vbsea0rWBmirSwi
- GpWOvpaQXUJXxPkUAzUrHC1RVwinOt4/5Mi0A3PCwSaAuwtCH60NryZy2sy+s6ODWA2CxR9GUeOc
- GMyNm43sSet1UNWMKFnKdDTajAshqx7qG+XH/RU+wBeq+yNuJkbL+vmxcmtpzyKEC2IPrNkZAJSi
- djzULZrtBJ4tBmIQN1IchXIbJ+XMxjHsN+xjWZsLHXbMfjKaiJUINlK73nZfdklJrX+9ZSCyycEr
- dhh2n1ax
- -----END CERTIFICATE-----
- Certigna Root CA
- ================
- -----BEGIN CERTIFICATE-----
- MIIGWzCCBEOgAwIBAgIRAMrpG4nxVQMNo+ZBbcTjpuEwDQYJKoZIhvcNAQELBQAwWjELMAkGA1UE
- BhMCRlIxEjAQBgNVBAoMCURoaW15b3RpczEcMBoGA1UECwwTMDAwMiA0ODE0NjMwODEwMDAzNjEZ
- MBcGA1UEAwwQQ2VydGlnbmEgUm9vdCBDQTAeFw0xMzEwMDEwODMyMjdaFw0zMzEwMDEwODMyMjda
- MFoxCzAJBgNVBAYTAkZSMRIwEAYDVQQKDAlEaGlteW90aXMxHDAaBgNVBAsMEzAwMDIgNDgxNDYz
- MDgxMDAwMzYxGTAXBgNVBAMMEENlcnRpZ25hIFJvb3QgQ0EwggIiMA0GCSqGSIb3DQEBAQUAA4IC
- DwAwggIKAoICAQDNGDllGlmx6mQWDoyUJJV8g9PFOSbcDO8WV43X2KyjQn+Cyu3NW9sOty3tRQgX
- stmzy9YXUnIo245Onoq2C/mehJpNdt4iKVzSs9IGPjA5qXSjklYcoW9MCiBtnyN6tMbaLOQdLNyz
- KNAT8kxOAkmhVECe5uUFoC2EyP+YbNDrihqECB63aCPuI9Vwzm1RaRDuoXrC0SIxwoKF0vJVdlB8
- JXrJhFwLrN1CTivngqIkicuQstDuI7pmTLtipPlTWmR7fJj6o0ieD5Wupxj0auwuA0Wv8HT4Ks16
- XdG+RCYyKfHx9WzMfgIhC59vpD++nVPiz32pLHxYGpfhPTc3GGYo0kDFUYqMwy3OU4gkWGQwFsWq
- 4NYKpkDfePb1BHxpE4S80dGnBs8B92jAqFe7OmGtBIyT46388NtEbVncSVmurJqZNjBBe3YzIoej
- wpKGbvlw7q6Hh5UbxHq9MfPU0uWZ/75I7HX1eBYdpnDBfzwboZL7z8g81sWTCo/1VTp2lc5ZmIoJ
- lXcymoO6LAQ6l73UL77XbJuiyn1tJslV1c/DeVIICZkHJC1kJWumIWmbat10TWuXekG9qxf5kBdI
- jzb5LdXF2+6qhUVB+s06RbFo5jZMm5BX7CO5hwjCxAnxl4YqKE3idMDaxIzb3+KhF1nOJFl0Mdp/
- /TBt2dzhauH8XwIDAQABo4IBGjCCARYwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYw
- HQYDVR0OBBYEFBiHVuBud+4kNTxOc5of1uHieX4rMB8GA1UdIwQYMBaAFBiHVuBud+4kNTxOc5of
- 1uHieX4rMEQGA1UdIAQ9MDswOQYEVR0gADAxMC8GCCsGAQUFBwIBFiNodHRwczovL3d3d3cuY2Vy
- dGlnbmEuZnIvYXV0b3JpdGVzLzBtBgNVHR8EZjBkMC+gLaArhilodHRwOi8vY3JsLmNlcnRpZ25h
- LmZyL2NlcnRpZ25hcm9vdGNhLmNybDAxoC+gLYYraHR0cDovL2NybC5kaGlteW90aXMuY29tL2Nl
- cnRpZ25hcm9vdGNhLmNybDANBgkqhkiG9w0BAQsFAAOCAgEAlLieT/DjlQgi581oQfccVdV8AOIt
- OoldaDgvUSILSo3L6btdPrtcPbEo/uRTVRPPoZAbAh1fZkYJMyjhDSSXcNMQH+pkV5a7XdrnxIxP
- TGRGHVyH41neQtGbqH6mid2PHMkwgu07nM3A6RngatgCdTer9zQoKJHyBApPNeNgJgH60BGM+RFq
- 7q89w1DTj18zeTyGqHNFkIwgtnJzFyO+B2XleJINugHA64wcZr+shncBlA2c5uk5jR+mUYyZDDl3
- 4bSb+hxnV29qao6pK0xXeXpXIs/NX2NGjVxZOob4Mkdio2cNGJHc+6Zr9UhhcyNZjgKnvETq9Emd
- 8VRY+WCv2hikLyhF3HqgiIZd8zvn/yk1gPxkQ5Tm4xxvvq0OKmOZK8l+hfZx6AYDlf7ej0gcWtSS
- 6Cvu5zHbugRqh5jnxV/vfaci9wHYTfmJ0A6aBVmknpjZbyvKcL5kwlWj9Omvw5Ip3IgWJJk8jSaY
- tlu3zM63Nwf9JtmYhST/WSMDmu2dnajkXjjO11INb9I/bbEFa0nOipFGc/T2L/Coc3cOZayhjWZS
- aX5LaAzHHjcng6WMxwLkFM1JAbBzs/3GkDpv0mztO+7skb6iQ12LAEpmJURw3kAP+HwV96LOPNde
- E4yBFxgX0b3xdxA61GU5wSesVywlVP+i2k+KYTlerj1KjL0=
- -----END CERTIFICATE-----
- emSign Root CA - G1
- ===================
- -----BEGIN CERTIFICATE-----
- MIIDlDCCAnygAwIBAgIKMfXkYgxsWO3W2DANBgkqhkiG9w0BAQsFADBnMQswCQYDVQQGEwJJTjET
- MBEGA1UECxMKZW1TaWduIFBLSTElMCMGA1UEChMcZU11ZGhyYSBUZWNobm9sb2dpZXMgTGltaXRl
- ZDEcMBoGA1UEAxMTZW1TaWduIFJvb3QgQ0EgLSBHMTAeFw0xODAyMTgxODMwMDBaFw00MzAyMTgx
- ODMwMDBaMGcxCzAJBgNVBAYTAklOMRMwEQYDVQQLEwplbVNpZ24gUEtJMSUwIwYDVQQKExxlTXVk
- aHJhIFRlY2hub2xvZ2llcyBMaW1pdGVkMRwwGgYDVQQDExNlbVNpZ24gUm9vdCBDQSAtIEcxMIIB
- IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAk0u76WaK7p1b1TST0Bsew+eeuGQzf2N4aLTN
- LnF115sgxk0pvLZoYIr3IZpWNVrzdr3YzZr/k1ZLpVkGoZM0Kd0WNHVO8oG0x5ZOrRkVUkr+PHB1
- cM2vK6sVmjM8qrOLqs1D/fXqcP/tzxE7lM5OMhbTI0Aqd7OvPAEsbO2ZLIvZTmmYsvePQbAyeGHW
- DV/D+qJAkh1cF+ZwPjXnorfCYuKrpDhMtTk1b+oDafo6VGiFbdbyL0NVHpENDtjVaqSW0RM8LHhQ
- 6DqS0hdW5TUaQBw+jSztOd9C4INBdN+jzcKGYEho42kLVACL5HZpIQ15TjQIXhTCzLG3rdd8cIrH
- hQIDAQABo0IwQDAdBgNVHQ4EFgQU++8Nhp6w492pufEhF38+/PB3KxowDgYDVR0PAQH/BAQDAgEG
- MA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAFn/8oz1h31xPaOfG1vR2vjTnGs2
- vZupYeveFix0PZ7mddrXuqe8QhfnPZHr5X3dPpzxz5KsbEjMwiI/aTvFthUvozXGaCocV685743Q
- NcMYDHsAVhzNixl03r4PEuDQqqE/AjSxcM6dGNYIAwlG7mDgfrbESQRRfXBgvKqy/3lyeqYdPV8q
- +Mri/Tm3R7nrft8EI6/6nAYH6ftjk4BAtcZsCjEozgyfz7MjNYBBjWzEN3uBL4ChQEKF6dk4jeih
- U80Bv2noWgbyRQuQ+q7hv53yrlc8pa6yVvSLZUDp/TGBLPQ5Cdjua6e0ph0VpZj3AYHYhX3zUVxx
- iN66zB+Afko=
- -----END CERTIFICATE-----
- emSign ECC Root CA - G3
- =======================
- -----BEGIN CERTIFICATE-----
- MIICTjCCAdOgAwIBAgIKPPYHqWhwDtqLhDAKBggqhkjOPQQDAzBrMQswCQYDVQQGEwJJTjETMBEG
- A1UECxMKZW1TaWduIFBLSTElMCMGA1UEChMcZU11ZGhyYSBUZWNobm9sb2dpZXMgTGltaXRlZDEg
- MB4GA1UEAxMXZW1TaWduIEVDQyBSb290IENBIC0gRzMwHhcNMTgwMjE4MTgzMDAwWhcNNDMwMjE4
- MTgzMDAwWjBrMQswCQYDVQQGEwJJTjETMBEGA1UECxMKZW1TaWduIFBLSTElMCMGA1UEChMcZU11
- ZGhyYSBUZWNobm9sb2dpZXMgTGltaXRlZDEgMB4GA1UEAxMXZW1TaWduIEVDQyBSb290IENBIC0g
- RzMwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQjpQy4LRL1KPOxst3iAhKAnjlfSU2fySU0WXTsuwYc
- 58Byr+iuL+FBVIcUqEqy6HyC5ltqtdyzdc6LBtCGI79G1Y4PPwT01xySfvalY8L1X44uT6EYGQIr
- MgqCZH0Wk9GjQjBAMB0GA1UdDgQWBBR8XQKEE9TMipuBzhccLikenEhjQjAOBgNVHQ8BAf8EBAMC
- AQYwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNpADBmAjEAvvNhzwIQHWSVB7gYboiFBS+D
- CBeQyh+KTOgNG3qxrdWBCUfvO6wIBHxcmbHtRwfSAjEAnbpV/KlK6O3t5nYBQnvI+GDZjVGLVTv7
- jHvrZQnD+JbNR6iC8hZVdyR+EhCVBCyj
- -----END CERTIFICATE-----
- emSign Root CA - C1
- ===================
- -----BEGIN CERTIFICATE-----
- MIIDczCCAlugAwIBAgILAK7PALrEzzL4Q7IwDQYJKoZIhvcNAQELBQAwVjELMAkGA1UEBhMCVVMx
- EzARBgNVBAsTCmVtU2lnbiBQS0kxFDASBgNVBAoTC2VNdWRocmEgSW5jMRwwGgYDVQQDExNlbVNp
- Z24gUm9vdCBDQSAtIEMxMB4XDTE4MDIxODE4MzAwMFoXDTQzMDIxODE4MzAwMFowVjELMAkGA1UE
- BhMCVVMxEzARBgNVBAsTCmVtU2lnbiBQS0kxFDASBgNVBAoTC2VNdWRocmEgSW5jMRwwGgYDVQQD
- ExNlbVNpZ24gUm9vdCBDQSAtIEMxMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAz+up
- ufGZBczYKCFK83M0UYRWEPWgTywS4/oTmifQz/l5GnRfHXk5/Fv4cI7gklL35CX5VIPZHdPIWoU/
- Xse2B+4+wM6ar6xWQio5JXDWv7V7Nq2s9nPczdcdioOl+yuQFTdrHCZH3DspVpNqs8FqOp099cGX
- OFgFixwR4+S0uF2FHYP+eF8LRWgYSKVGczQ7/g/IdrvHGPMF0Ybzhe3nudkyrVWIzqa2kbBPrH4V
- I5b2P/AgNBbeCsbEBEV5f6f9vtKppa+cxSMq9zwhbL2vj07FOrLzNBL834AaSaTUqZX3noleooms
- lMuoaJuvimUnzYnu3Yy1aylwQ6BpC+S5DwIDAQABo0IwQDAdBgNVHQ4EFgQU/qHgcB4qAzlSWkK+
- XJGFehiqTbUwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQELBQAD
- ggEBAMJKVvoVIXsoounlHfv4LcQ5lkFMOycsxGwYFYDGrK9HWS8mC+M2sO87/kOXSTKZEhVb3xEp
- /6tT+LvBeA+snFOvV71ojD1pM/CjoCNjO2RnIkSt1XHLVip4kqNPEjE2NuLe/gDEo2APJ62gsIq1
- NnpSob0n9CAnYuhNlCQT5AoE6TyrLshDCUrGYQTlSTR+08TI9Q/Aqum6VF7zYytPT1DU/rl7mYw9
- wC68AivTxEDkigcxHpvOJpkT+xHqmiIMERnHXhuBUDDIlhJu58tBf5E7oke3VIAb3ADMmpDqw8NQ
- BmIMMMAVSKeoWXzhriKi4gp6D/piq1JM4fHfyr6DDUI=
- -----END CERTIFICATE-----
- emSign ECC Root CA - C3
- =======================
- -----BEGIN CERTIFICATE-----
- MIICKzCCAbGgAwIBAgIKe3G2gla4EnycqDAKBggqhkjOPQQDAzBaMQswCQYDVQQGEwJVUzETMBEG
- A1UECxMKZW1TaWduIFBLSTEUMBIGA1UEChMLZU11ZGhyYSBJbmMxIDAeBgNVBAMTF2VtU2lnbiBF
- Q0MgUm9vdCBDQSAtIEMzMB4XDTE4MDIxODE4MzAwMFoXDTQzMDIxODE4MzAwMFowWjELMAkGA1UE
- BhMCVVMxEzARBgNVBAsTCmVtU2lnbiBQS0kxFDASBgNVBAoTC2VNdWRocmEgSW5jMSAwHgYDVQQD
- ExdlbVNpZ24gRUNDIFJvb3QgQ0EgLSBDMzB2MBAGByqGSM49AgEGBSuBBAAiA2IABP2lYa57JhAd
- 6bciMK4G9IGzsUJxlTm801Ljr6/58pc1kjZGDoeVjbk5Wum739D+yAdBPLtVb4OjavtisIGJAnB9
- SMVK4+kiVCJNk7tCDK93nCOmfddhEc5lx/h//vXyqaNCMEAwHQYDVR0OBBYEFPtaSNCAIEDyqOkA
- B2kZd6fmw/TPMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MAoGCCqGSM49BAMDA2gA
- MGUCMQC02C8Cif22TGK6Q04ThHK1rt0c3ta13FaPWEBaLd4gTCKDypOofu4SQMfWh0/434UCMBwU
- ZOR8loMRnLDRWmFLpg9J0wD8ofzkpf9/rdcw0Md3f76BB1UwUCAU9Vc4CqgxUQ==
- -----END CERTIFICATE-----
- Hongkong Post Root CA 3
- =======================
- -----BEGIN CERTIFICATE-----
- MIIFzzCCA7egAwIBAgIUCBZfikyl7ADJk0DfxMauI7gcWqQwDQYJKoZIhvcNAQELBQAwbzELMAkG
- A1UEBhMCSEsxEjAQBgNVBAgTCUhvbmcgS29uZzESMBAGA1UEBxMJSG9uZyBLb25nMRYwFAYDVQQK
- Ew1Ib25na29uZyBQb3N0MSAwHgYDVQQDExdIb25na29uZyBQb3N0IFJvb3QgQ0EgMzAeFw0xNzA2
- MDMwMjI5NDZaFw00MjA2MDMwMjI5NDZaMG8xCzAJBgNVBAYTAkhLMRIwEAYDVQQIEwlIb25nIEtv
- bmcxEjAQBgNVBAcTCUhvbmcgS29uZzEWMBQGA1UEChMNSG9uZ2tvbmcgUG9zdDEgMB4GA1UEAxMX
- SG9uZ2tvbmcgUG9zdCBSb290IENBIDMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCz
- iNfqzg8gTr7m1gNt7ln8wlffKWihgw4+aMdoWJwcYEuJQwy51BWy7sFOdem1p+/l6TWZ5Mwc50tf
- jTMwIDNT2aa71T4Tjukfh0mtUC1Qyhi+AViiE3CWu4mIVoBc+L0sPOFMV4i707mV78vH9toxdCim
- 5lSJ9UExyuUmGs2C4HDaOym71QP1mbpV9WTRYA6ziUm4ii8F0oRFKHyPaFASePwLtVPLwpgchKOe
- sL4jpNrcyCse2m5FHomY2vkALgbpDDtw1VAliJnLzXNg99X/NWfFobxeq81KuEXryGgeDQ0URhLj
- 0mRiikKYvLTGCAj4/ahMZJx2Ab0vqWwzD9g/KLg8aQFChn5pwckGyuV6RmXpwtZQQS4/t+TtbNe/
- JgERohYpSms0BpDsE9K2+2p20jzt8NYt3eEV7KObLyzJPivkaTv/ciWxNoZbx39ri1UbSsUgYT2u
- y1DhCDq+sI9jQVMwCFk8mB13umOResoQUGC/8Ne8lYePl8X+l2oBlKN8W4UdKjk60FSh0Tlxnf0h
- +bV78OLgAo9uliQlLKAeLKjEiafv7ZkGL7YKTE/bosw3Gq9HhS2KX8Q0NEwA/RiTZxPRN+ZItIsG
- xVd7GYYKecsAyVKvQv83j+GjHno9UKtjBucVtT+2RTeUN7F+8kjDf8V1/peNRY8apxpyKBpADwID
- AQABo2MwYTAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAfBgNVHSMEGDAWgBQXnc0e
- i9Y5K3DTXNSguB+wAPzFYTAdBgNVHQ4EFgQUF53NHovWOStw01zUoLgfsAD8xWEwDQYJKoZIhvcN
- AQELBQADggIBAFbVe27mIgHSQpsY1Q7XZiNc4/6gx5LS6ZStS6LG7BJ8dNVI0lkUmcDrudHr9Egw
- W62nV3OZqdPlt9EuWSRY3GguLmLYauRwCy0gUCCkMpXRAJi70/33MvJJrsZ64Ee+bs7Lo3I6LWld
- y8joRTnU+kLBEUx3XZL7av9YROXrgZ6voJmtvqkBZss4HTzfQx/0TW60uhdG/H39h4F5ag0zD/ov
- +BS5gLNdTaqX4fnkGMX41TiMJjz98iji7lpJiCzfeT2OnpA8vUFKOt1b9pq0zj8lMH8yfaIDlNDc
- eqFS3m6TjRgm/VWsvY+b0s+v54Ysyx8Jb6NvqYTUc79NoXQbTiNg8swOqn+knEwlqLJmOzj/2ZQw
- 9nKEvmhVEA/GcywWaZMH/rFF7buiVWqw2rVKAiUnhde3t4ZEFolsgCs+l6mc1X5VTMbeRRAc6uk7
- nwNT7u56AQIWeNTowr5GdogTPyK7SBIdUgC0An4hGh6cJfTzPV4e0hz5sy229zdcxsshTrD3mUcY
- hcErulWuBurQB7Lcq9CClnXO0lD+mefPL5/ndtFhKvshuzHQqp9HpLIiyhY6UFfEW0NnxWViA0kB
- 60PZ2Pierc+xYw5F9KBaLJstxabArahH9CdMOA0uG0k7UvToiIMrVCjU8jVStDKDYmlkDJGcn5fq
- dBb9HxEGmpv0
- -----END CERTIFICATE-----
- Entrust Root Certification Authority - G4
- =========================================
- -----BEGIN CERTIFICATE-----
- MIIGSzCCBDOgAwIBAgIRANm1Q3+vqTkPAAAAAFVlrVgwDQYJKoZIhvcNAQELBQAwgb4xCzAJBgNV
- BAYTAlVTMRYwFAYDVQQKEw1FbnRydXN0LCBJbmMuMSgwJgYDVQQLEx9TZWUgd3d3LmVudHJ1c3Qu
- bmV0L2xlZ2FsLXRlcm1zMTkwNwYDVQQLEzAoYykgMjAxNSBFbnRydXN0LCBJbmMuIC0gZm9yIGF1
- dGhvcml6ZWQgdXNlIG9ubHkxMjAwBgNVBAMTKUVudHJ1c3QgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1
- dGhvcml0eSAtIEc0MB4XDTE1MDUyNzExMTExNloXDTM3MTIyNzExNDExNlowgb4xCzAJBgNVBAYT
- AlVTMRYwFAYDVQQKEw1FbnRydXN0LCBJbmMuMSgwJgYDVQQLEx9TZWUgd3d3LmVudHJ1c3QubmV0
- L2xlZ2FsLXRlcm1zMTkwNwYDVQQLEzAoYykgMjAxNSBFbnRydXN0LCBJbmMuIC0gZm9yIGF1dGhv
- cml6ZWQgdXNlIG9ubHkxMjAwBgNVBAMTKUVudHJ1c3QgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhv
- cml0eSAtIEc0MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAsewsQu7i0TD/pZJH4i3D
- umSXbcr3DbVZwbPLqGgZ2K+EbTBwXX7zLtJTmeH+H17ZSK9dE43b/2MzTdMAArzE+NEGCJR5WIoV
- 3imz/f3ET+iq4qA7ec2/a0My3dl0ELn39GjUu9CH1apLiipvKgS1sqbHoHrmSKvS0VnM1n4j5pds
- 8ELl3FFLFUHtSUrJ3hCX1nbB76W1NhSXNdh4IjVS70O92yfbYVaCNNzLiGAMC1rlLAHGVK/XqsEQ
- e9IFWrhAnoanw5CGAlZSCXqc0ieCU0plUmr1POeo8pyvi73TDtTUXm6Hnmo9RR3RXRv06QqsYJn7
- ibT/mCzPfB3pAqoEmh643IhuJbNsZvc8kPNXwbMv9W3y+8qh+CmdRouzavbmZwe+LGcKKh9asj5X
- xNMhIWNlUpEbsZmOeX7m640A2Vqq6nPopIICR5b+W45UYaPrL0swsIsjdXJ8ITzI9vF01Bx7owVV
- 7rtNOzK+mndmnqxpkCIHH2E6lr7lmk/MBTwoWdPBDFSoWWG9yHJM6Nyfh3+9nEg2XpWjDrk4JFX8
- dWbrAuMINClKxuMrLzOg2qOGpRKX/YAr2hRC45K9PvJdXmd0LhyIRyk0X+IyqJwlN4y6mACXi0mW
- Hv0liqzc2thddG5msP9E36EYxr5ILzeUePiVSj9/E15dWf10hkNjc0kCAwEAAaNCMEAwDwYDVR0T
- AQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFJ84xFYjwznooHFs6FRM5Og6sb9n
- MA0GCSqGSIb3DQEBCwUAA4ICAQAS5UKme4sPDORGpbZgQIeMJX6tuGguW8ZAdjwD+MlZ9POrYs4Q
- jbRaZIxowLByQzTSGwv2LFPSypBLhmb8qoMi9IsabyZIrHZ3CL/FmFz0Jomee8O5ZDIBf9PD3Vht
- 7LGrhFV0d4QEJ1JrhkzO3bll/9bGXp+aEJlLdWr+aumXIOTkdnrG0CSqkM0gkLpHZPt/B7NTeLUK
- YvJzQ85BK4FqLoUWlFPUa19yIqtRLULVAJyZv967lDtX/Zr1hstWO1uIAeV8KEsD+UmDfLJ/fOPt
- jqF/YFOOVZ1QNBIPt5d7bIdKROf1beyAN/BYGW5KaHbwH5Lk6rWS02FREAutp9lfx1/cH6NcjKF+
- m7ee01ZvZl4HliDtC3T7Zk6LERXpgUl+b7DUUH8i119lAg2m9IUe2K4GS0qn0jFmwvjO5QimpAKW
- RGhXxNUzzxkvFMSUHHuk2fCfDrGA4tGeEWSpiBE6doLlYsKA2KSD7ZPvfC+QsDJMlhVoSFLUmQjA
- JOgc47OlIQ6SwJAfzyBfyjs4x7dtOvPmRLgOMWuIjnDrnBdSqEGULoe256YSxXXfW8AKbnuk5F6G
- +TaU33fD6Q3AOfF5u0aOq0NZJ7cguyPpVkAh7DE9ZapD8j3fcEThuk0mEDuYn/PIjhs4ViFqUZPT
- kcpG2om3PVODLAgfi49T3f+sHw==
- -----END CERTIFICATE-----
- Microsoft ECC Root Certificate Authority 2017
- =============================================
- -----BEGIN CERTIFICATE-----
- MIICWTCCAd+gAwIBAgIQZvI9r4fei7FK6gxXMQHC7DAKBggqhkjOPQQDAzBlMQswCQYDVQQGEwJV
- UzEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMTYwNAYDVQQDEy1NaWNyb3NvZnQgRUND
- IFJvb3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5IDIwMTcwHhcNMTkxMjE4MjMwNjQ1WhcNNDIwNzE4
- MjMxNjA0WjBlMQswCQYDVQQGEwJVUzEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMTYw
- NAYDVQQDEy1NaWNyb3NvZnQgRUNDIFJvb3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5IDIwMTcwdjAQ
- BgcqhkjOPQIBBgUrgQQAIgNiAATUvD0CQnVBEyPNgASGAlEvaqiBYgtlzPbKnR5vSmZRogPZnZH6
- thaxjG7efM3beaYvzrvOcS/lpaso7GMEZpn4+vKTEAXhgShC48Zo9OYbhGBKia/teQ87zvH2RPUB
- eMCjVDBSMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBTIy5lycFIM
- +Oa+sgRXKSrPQhDtNTAQBgkrBgEEAYI3FQEEAwIBADAKBggqhkjOPQQDAwNoADBlAjBY8k3qDPlf
- Xu5gKcs68tvWMoQZP3zVL8KxzJOuULsJMsbG7X7JNpQS5GiFBqIb0C8CMQCZ6Ra0DvpWSNSkMBaR
- eNtUjGUBiudQZsIxtzm6uBoiB078a1QWIP8rtedMDE2mT3M=
- -----END CERTIFICATE-----
- Microsoft RSA Root Certificate Authority 2017
- =============================================
- -----BEGIN CERTIFICATE-----
- MIIFqDCCA5CgAwIBAgIQHtOXCV/YtLNHcB6qvn9FszANBgkqhkiG9w0BAQwFADBlMQswCQYDVQQG
- EwJVUzEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMTYwNAYDVQQDEy1NaWNyb3NvZnQg
- UlNBIFJvb3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5IDIwMTcwHhcNMTkxMjE4MjI1MTIyWhcNNDIw
- NzE4MjMwMDIzWjBlMQswCQYDVQQGEwJVUzEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9u
- MTYwNAYDVQQDEy1NaWNyb3NvZnQgUlNBIFJvb3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5IDIwMTcw
- ggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDKW76UM4wplZEWCpW9R2LBifOZNt9GkMml
- 7Xhqb0eRaPgnZ1AzHaGm++DlQ6OEAlcBXZxIQIJTELy/xztokLaCLeX0ZdDMbRnMlfl7rEqUrQ7e
- S0MdhweSE5CAg2Q1OQT85elss7YfUJQ4ZVBcF0a5toW1HLUX6NZFndiyJrDKxHBKrmCk3bPZ7Pw7
- 1VdyvD/IybLeS2v4I2wDwAW9lcfNcztmgGTjGqwu+UcF8ga2m3P1eDNbx6H7JyqhtJqRjJHTOoI+
- dkC0zVJhUXAoP8XFWvLJjEm7FFtNyP9nTUwSlq31/niol4fX/V4ggNyhSyL71Imtus5Hl0dVe49F
- yGcohJUcaDDv70ngNXtk55iwlNpNhTs+VcQor1fznhPbRiefHqJeRIOkpcrVE7NLP8TjwuaGYaRS
- MLl6IE9vDzhTyzMMEyuP1pq9KsgtsRx9S1HKR9FIJ3Jdh+vVReZIZZ2vUpC6W6IYZVcSn2i51BVr
- lMRpIpj0M+Dt+VGOQVDJNE92kKz8OMHY4Xu54+OU4UZpyw4KUGsTuqwPN1q3ErWQgR5WrlcihtnJ
- 0tHXUeOrO8ZV/R4O03QK0dqq6mm4lyiPSMQH+FJDOvTKVTUssKZqwJz58oHhEmrARdlns87/I6KJ
- ClTUFLkqqNfs+avNJVgyeY+QW5g5xAgGwax/Dj0ApQIDAQABo1QwUjAOBgNVHQ8BAf8EBAMCAYYw
- DwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUCctZf4aycI8awznjwNnpv7tNsiMwEAYJKwYBBAGC
- NxUBBAMCAQAwDQYJKoZIhvcNAQEMBQADggIBAKyvPl3CEZaJjqPnktaXFbgToqZCLgLNFgVZJ8og
- 6Lq46BrsTaiXVq5lQ7GPAJtSzVXNUzltYkyLDVt8LkS/gxCP81OCgMNPOsduET/m4xaRhPtthH80
- dK2Jp86519efhGSSvpWhrQlTM93uCupKUY5vVau6tZRGrox/2KJQJWVggEbbMwSubLWYdFQl3JPk
- +ONVFT24bcMKpBLBaYVu32TxU5nhSnUgnZUP5NbcA/FZGOhHibJXWpS2qdgXKxdJ5XbLwVaZOjex
- /2kskZGT4d9Mozd2TaGf+G0eHdP67Pv0RR0Tbc/3WeUiJ3IrhvNXuzDtJE3cfVa7o7P4NHmJweDy
- AmH3pvwPuxwXC65B2Xy9J6P9LjrRk5Sxcx0ki69bIImtt2dmefU6xqaWM/5TkshGsRGRxpl/j8nW
- ZjEgQRCHLQzWwa80mMpkg/sTV9HB8Dx6jKXB/ZUhoHHBk2dxEuqPiAppGWSZI1b7rCoucL5mxAyE
- 7+WL85MB+GqQk2dLsmijtWKP6T+MejteD+eMuMZ87zf9dOLITzNy4ZQ5bb0Sr74MTnB8G2+NszKT
- c0QWbej09+CVgI+WXTik9KveCjCHk9hNAHFiRSdLOkKEW39lt2c0Ui2cFmuqqNh7o0JMcccMyj6D
- 5KbvtwEwXlGjefVwaaZBRA+GsCyRxj3qrg+E
- -----END CERTIFICATE-----
- e-Szigno Root CA 2017
- =====================
- -----BEGIN CERTIFICATE-----
- MIICQDCCAeWgAwIBAgIMAVRI7yH9l1kN9QQKMAoGCCqGSM49BAMCMHExCzAJBgNVBAYTAkhVMREw
- DwYDVQQHDAhCdWRhcGVzdDEWMBQGA1UECgwNTWljcm9zZWMgTHRkLjEXMBUGA1UEYQwOVkFUSFUt
- MjM1ODQ0OTcxHjAcBgNVBAMMFWUtU3ppZ25vIFJvb3QgQ0EgMjAxNzAeFw0xNzA4MjIxMjA3MDZa
- Fw00MjA4MjIxMjA3MDZaMHExCzAJBgNVBAYTAkhVMREwDwYDVQQHDAhCdWRhcGVzdDEWMBQGA1UE
- CgwNTWljcm9zZWMgTHRkLjEXMBUGA1UEYQwOVkFUSFUtMjM1ODQ0OTcxHjAcBgNVBAMMFWUtU3pp
- Z25vIFJvb3QgQ0EgMjAxNzBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABJbcPYrYsHtvxie+RJCx
- s1YVe45DJH0ahFnuY2iyxl6H0BVIHqiQrb1TotreOpCmYF9oMrWGQd+HWyx7xf58etqjYzBhMA8G
- A1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBSHERUI0arBeAyxr87GyZDv
- vzAEwDAfBgNVHSMEGDAWgBSHERUI0arBeAyxr87GyZDvvzAEwDAKBggqhkjOPQQDAgNJADBGAiEA
- tVfd14pVCzbhhkT61NlojbjcI4qKDdQvfepz7L9NbKgCIQDLpbQS+ue16M9+k/zzNY9vTlp8tLxO
- svxyqltZ+efcMQ==
- -----END CERTIFICATE-----
- certSIGN Root CA G2
- ===================
- -----BEGIN CERTIFICATE-----
- MIIFRzCCAy+gAwIBAgIJEQA0tk7GNi02MA0GCSqGSIb3DQEBCwUAMEExCzAJBgNVBAYTAlJPMRQw
- EgYDVQQKEwtDRVJUU0lHTiBTQTEcMBoGA1UECxMTY2VydFNJR04gUk9PVCBDQSBHMjAeFw0xNzAy
- MDYwOTI3MzVaFw00MjAyMDYwOTI3MzVaMEExCzAJBgNVBAYTAlJPMRQwEgYDVQQKEwtDRVJUU0lH
- TiBTQTEcMBoGA1UECxMTY2VydFNJR04gUk9PVCBDQSBHMjCCAiIwDQYJKoZIhvcNAQEBBQADggIP
- ADCCAgoCggIBAMDFdRmRfUR0dIf+DjuW3NgBFszuY5HnC2/OOwppGnzC46+CjobXXo9X69MhWf05
- N0IwvlDqtg+piNguLWkh59E3GE59kdUWX2tbAMI5Qw02hVK5U2UPHULlj88F0+7cDBrZuIt4Imfk
- abBoxTzkbFpG583H+u/E7Eu9aqSs/cwoUe+StCmrqzWaTOTECMYmzPhpn+Sc8CnTXPnGFiWeI8Mg
- wT0PPzhAsP6CRDiqWhqKa2NYOLQV07YRaXseVO6MGiKscpc/I1mbySKEwQdPzH/iV8oScLumZfNp
- dWO9lfsbl83kqK/20U6o2YpxJM02PbyWxPFsqa7lzw1uKA2wDrXKUXt4FMMgL3/7FFXhEZn91Qqh
- ngLjYl/rNUssuHLoPj1PrCy7Lobio3aP5ZMqz6WryFyNSwb/EkaseMsUBzXgqd+L6a8VTxaJW732
- jcZZroiFDsGJ6x9nxUWO/203Nit4ZoORUSs9/1F3dmKh7Gc+PoGD4FapUB8fepmrY7+EF3fxDTvf
- 95xhszWYijqy7DwaNz9+j5LP2RIUZNoQAhVB/0/E6xyjyfqZ90bp4RjZsbgyLcsUDFDYg2WD7rlc
- z8sFWkz6GZdr1l0T08JcVLwyc6B49fFtHsufpaafItzRUZ6CeWRgKRM+o/1Pcmqr4tTluCRVLERL
- iohEnMqE0yo7AgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1Ud
- DgQWBBSCIS1mxteg4BXrzkwJd8RgnlRuAzANBgkqhkiG9w0BAQsFAAOCAgEAYN4auOfyYILVAzOB
- ywaK8SJJ6ejqkX/GM15oGQOGO0MBzwdw5AgeZYWR5hEit/UCI46uuR59H35s5r0l1ZUa8gWmr4UC
- b6741jH/JclKyMeKqdmfS0mbEVeZkkMR3rYzpMzXjWR91M08KCy0mpbqTfXERMQlqiCA2ClV9+BB
- /AYm/7k29UMUA2Z44RGx2iBfRgB4ACGlHgAoYXhvqAEBj500mv/0OJD7uNGzcgbJceaBxXntC6Z5
- 8hMLnPddDnskk7RI24Zf3lCGeOdA5jGokHZwYa+cNywRtYK3qq4kNFtyDGkNzVmf9nGvnAvRCjj5
- BiKDUyUM/FHE5r7iOZULJK2v0ZXkltd0ZGtxTgI8qoXzIKNDOXZbbFD+mpwUHmUUihW9o4JFWklW
- atKcsWMy5WHgUyIOpwpJ6st+H6jiYoD2EEVSmAYY3qXNL3+q1Ok+CHLsIwMCPKaq2LxndD0UF/tU
- Sxfj03k9bWtJySgOLnRQvwzZRjoQhsmnP+mg7H/rpXdYaXHmgwo38oZJar55CJD2AhZkPuXaTH4M
- NMn5X7azKFGnpyuqSfqNZSlO42sTp5SjLVFteAxEy9/eCG/Oo2Sr05WE1LlSVHJ7liXMvGnjSG4N
- 0MedJ5qq+BOS3R7fY581qRY27Iy4g/Q9iY/NtBde17MXQRBdJ3NghVdJIgc=
- -----END CERTIFICATE-----
- Trustwave Global Certification Authority
- ========================================
- -----BEGIN CERTIFICATE-----
- MIIF2jCCA8KgAwIBAgIMBfcOhtpJ80Y1LrqyMA0GCSqGSIb3DQEBCwUAMIGIMQswCQYDVQQGEwJV
- UzERMA8GA1UECAwISWxsaW5vaXMxEDAOBgNVBAcMB0NoaWNhZ28xITAfBgNVBAoMGFRydXN0d2F2
- ZSBIb2xkaW5ncywgSW5jLjExMC8GA1UEAwwoVHJ1c3R3YXZlIEdsb2JhbCBDZXJ0aWZpY2F0aW9u
- IEF1dGhvcml0eTAeFw0xNzA4MjMxOTM0MTJaFw00MjA4MjMxOTM0MTJaMIGIMQswCQYDVQQGEwJV
- UzERMA8GA1UECAwISWxsaW5vaXMxEDAOBgNVBAcMB0NoaWNhZ28xITAfBgNVBAoMGFRydXN0d2F2
- ZSBIb2xkaW5ncywgSW5jLjExMC8GA1UEAwwoVHJ1c3R3YXZlIEdsb2JhbCBDZXJ0aWZpY2F0aW9u
- IEF1dGhvcml0eTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBALldUShLPDeS0YLOvR29
- zd24q88KPuFd5dyqCblXAj7mY2Hf8g+CY66j96xz0XznswuvCAAJWX/NKSqIk4cXGIDtiLK0thAf
- LdZfVaITXdHG6wZWiYj+rDKd/VzDBcdu7oaJuogDnXIhhpCujwOl3J+IKMujkkkP7NAP4m1ET4Bq
- stTnoApTAbqOl5F2brz81Ws25kCI1nsvXwXoLG0R8+eyvpJETNKXpP7ScoFDB5zpET71ixpZfR9o
- WN0EACyW80OzfpgZdNmcc9kYvkHHNHnZ9GLCQ7mzJ7Aiy/k9UscwR7PJPrhq4ufogXBeQotPJqX+
- OsIgbrv4Fo7NDKm0G2x2EOFYeUY+VM6AqFcJNykbmROPDMjWLBz7BegIlT1lRtzuzWniTY+HKE40
- Cz7PFNm73bZQmq131BnW2hqIyE4bJ3XYsgjxroMwuREOzYfwhI0Vcnyh78zyiGG69Gm7DIwLdVcE
- uE4qFC49DxweMqZiNu5m4iK4BUBjECLzMx10coos9TkpoNPnG4CELcU9402x/RpvumUHO1jsQkUm
- +9jaJXLE9gCxInm943xZYkqcBW89zubWR2OZxiRvchLIrH+QtAuRcOi35hYQcRfO3gZPSEF9NUqj
- ifLJS3tBEW1ntwiYTOURGa5CgNz7kAXU+FDKvuStx8KU1xad5hePrzb7AgMBAAGjQjBAMA8GA1Ud
- EwEB/wQFMAMBAf8wHQYDVR0OBBYEFJngGWcNYtt2s9o9uFvo/ULSMQ6HMA4GA1UdDwEB/wQEAwIB
- BjANBgkqhkiG9w0BAQsFAAOCAgEAmHNw4rDT7TnsTGDZqRKGFx6W0OhUKDtkLSGm+J1WE2pIPU/H
- PinbbViDVD2HfSMF1OQc3Og4ZYbFdada2zUFvXfeuyk3QAUHw5RSn8pk3fEbK9xGChACMf1KaA0H
- ZJDmHvUqoai7PF35owgLEQzxPy0QlG/+4jSHg9bP5Rs1bdID4bANqKCqRieCNqcVtgimQlRXtpla
- 4gt5kNdXElE1GYhBaCXUNxeEFfsBctyV3lImIJgm4nb1J2/6ADtKYdkNy1GTKv0WBpanI5ojSP5R
- vbbEsLFUzt5sQa0WZ37b/TjNuThOssFgy50X31ieemKyJo90lZvkWx3SD92YHJtZuSPTMaCm/zjd
- zyBP6VhWOmfD0faZmZ26NraAL4hHT4a/RDqA5Dccprrql5gR0IRiR2Qequ5AvzSxnI9O4fKSTx+O
- 856X3vOmeWqJcU9LJxdI/uz0UA9PSX3MReO9ekDFQdxhVicGaeVyQYHTtgGJoC86cnn+OjC/QezH
- Yj6RS8fZMXZC+fc8Y+wmjHMMfRod6qh8h6jCJ3zhM0EPz8/8AKAigJ5Kp28AsEFFtyLKaEjFQqKu
- 3R3y4G5OBVixwJAWKqQ9EEC+j2Jjg6mcgn0tAumDMHzLJ8n9HmYAsC7TIS+OMxZsmO0QqAfWzJPP
- 29FpHOTKyeC2nOnOcXHebD8WpHk=
- -----END CERTIFICATE-----
- Trustwave Global ECC P256 Certification Authority
- =================================================
- -----BEGIN CERTIFICATE-----
- MIICYDCCAgegAwIBAgIMDWpfCD8oXD5Rld9dMAoGCCqGSM49BAMCMIGRMQswCQYDVQQGEwJVUzER
- MA8GA1UECBMISWxsaW5vaXMxEDAOBgNVBAcTB0NoaWNhZ28xITAfBgNVBAoTGFRydXN0d2F2ZSBI
- b2xkaW5ncywgSW5jLjE6MDgGA1UEAxMxVHJ1c3R3YXZlIEdsb2JhbCBFQ0MgUDI1NiBDZXJ0aWZp
- Y2F0aW9uIEF1dGhvcml0eTAeFw0xNzA4MjMxOTM1MTBaFw00MjA4MjMxOTM1MTBaMIGRMQswCQYD
- VQQGEwJVUzERMA8GA1UECBMISWxsaW5vaXMxEDAOBgNVBAcTB0NoaWNhZ28xITAfBgNVBAoTGFRy
- dXN0d2F2ZSBIb2xkaW5ncywgSW5jLjE6MDgGA1UEAxMxVHJ1c3R3YXZlIEdsb2JhbCBFQ0MgUDI1
- NiBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABH77bOYj
- 43MyCMpg5lOcunSNGLB4kFKA3TjASh3RqMyTpJcGOMoNFWLGjgEqZZ2q3zSRLoHB5DOSMcT9CTqm
- P62jQzBBMA8GA1UdEwEB/wQFMAMBAf8wDwYDVR0PAQH/BAUDAwcGADAdBgNVHQ4EFgQUo0EGrJBt
- 0UrrdaVKEJmzsaGLSvcwCgYIKoZIzj0EAwIDRwAwRAIgB+ZU2g6gWrKuEZ+Hxbb/ad4lvvigtwjz
- RM4q3wghDDcCIC0mA6AFvWvR9lz4ZcyGbbOcNEhjhAnFjXca4syc4XR7
- -----END CERTIFICATE-----
- Trustwave Global ECC P384 Certification Authority
- =================================================
- -----BEGIN CERTIFICATE-----
- MIICnTCCAiSgAwIBAgIMCL2Fl2yZJ6SAaEc7MAoGCCqGSM49BAMDMIGRMQswCQYDVQQGEwJVUzER
- MA8GA1UECBMISWxsaW5vaXMxEDAOBgNVBAcTB0NoaWNhZ28xITAfBgNVBAoTGFRydXN0d2F2ZSBI
- b2xkaW5ncywgSW5jLjE6MDgGA1UEAxMxVHJ1c3R3YXZlIEdsb2JhbCBFQ0MgUDM4NCBDZXJ0aWZp
- Y2F0aW9uIEF1dGhvcml0eTAeFw0xNzA4MjMxOTM2NDNaFw00MjA4MjMxOTM2NDNaMIGRMQswCQYD
- VQQGEwJVUzERMA8GA1UECBMISWxsaW5vaXMxEDAOBgNVBAcTB0NoaWNhZ28xITAfBgNVBAoTGFRy
- dXN0d2F2ZSBIb2xkaW5ncywgSW5jLjE6MDgGA1UEAxMxVHJ1c3R3YXZlIEdsb2JhbCBFQ0MgUDM4
- NCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTB2MBAGByqGSM49AgEGBSuBBAAiA2IABGvaDXU1CDFH
- Ba5FmVXxERMuSvgQMSOjfoPTfygIOiYaOs+Xgh+AtycJj9GOMMQKmw6sWASr9zZ9lCOkmwqKi6vr
- /TklZvFe/oyujUF5nQlgziip04pt89ZF1PKYhDhloKNDMEEwDwYDVR0TAQH/BAUwAwEB/zAPBgNV
- HQ8BAf8EBQMDBwYAMB0GA1UdDgQWBBRVqYSJ0sEyvRjLbKYHTsjnnb6CkDAKBggqhkjOPQQDAwNn
- ADBkAjA3AZKXRRJ+oPM+rRk6ct30UJMDEr5E0k9BpIycnR+j9sKS50gU/k6bpZFXrsY3crsCMGcl
- CrEMXu6pY5Jv5ZAL/mYiykf9ijH3g/56vxC+GCsej/YpHpRZ744hN8tRmKVuSw==
- -----END CERTIFICATE-----
- NAVER Global Root Certification Authority
- =========================================
- -----BEGIN CERTIFICATE-----
- MIIFojCCA4qgAwIBAgIUAZQwHqIL3fXFMyqxQ0Rx+NZQTQ0wDQYJKoZIhvcNAQEMBQAwaTELMAkG
- A1UEBhMCS1IxJjAkBgNVBAoMHU5BVkVSIEJVU0lORVNTIFBMQVRGT1JNIENvcnAuMTIwMAYDVQQD
- DClOQVZFUiBHbG9iYWwgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0xNzA4MTgwODU4
- NDJaFw0zNzA4MTgyMzU5NTlaMGkxCzAJBgNVBAYTAktSMSYwJAYDVQQKDB1OQVZFUiBCVVNJTkVT
- UyBQTEFURk9STSBDb3JwLjEyMDAGA1UEAwwpTkFWRVIgR2xvYmFsIFJvb3QgQ2VydGlmaWNhdGlv
- biBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC21PGTXLVAiQqrDZBb
- UGOukJR0F0Vy1ntlWilLp1agS7gvQnXp2XskWjFlqxcX0TM62RHcQDaH38dq6SZeWYp34+hInDEW
- +j6RscrJo+KfziFTowI2MMtSAuXaMl3Dxeb57hHHi8lEHoSTGEq0n+USZGnQJoViAbbJAh2+g1G7
- XNr4rRVqmfeSVPc0W+m/6imBEtRTkZazkVrd/pBzKPswRrXKCAfHcXLJZtM0l/aM9BhK4dA9WkW2
- aacp+yPOiNgSnABIqKYPszuSjXEOdMWLyEz59JuOuDxp7W87UC9Y7cSw0BwbagzivESq2M0UXZR4
- Yb8ObtoqvC8MC3GmsxY/nOb5zJ9TNeIDoKAYv7vxvvTWjIcNQvcGufFt7QSUqP620wbGQGHfnZ3z
- VHbOUzoBppJB7ASjjw2i1QnK1sua8e9DXcCrpUHPXFNwcMmIpi3Ua2FzUCaGYQ5fG8Ir4ozVu53B
- A0K6lNpfqbDKzE0K70dpAy8i+/Eozr9dUGWokG2zdLAIx6yo0es+nPxdGoMuK8u180SdOqcXYZai
- cdNwlhVNt0xz7hlcxVs+Qf6sdWA7G2POAN3aCJBitOUt7kinaxeZVL6HSuOpXgRM6xBtVNbv8ejy
- YhbLgGvtPe31HzClrkvJE+2KAQHJuFFYwGY6sWZLxNUxAmLpdIQM201GLQIDAQABo0IwQDAdBgNV
- HQ4EFgQU0p+I36HNLL3s9TsBAZMzJ7LrYEswDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMB
- Af8wDQYJKoZIhvcNAQEMBQADggIBADLKgLOdPVQG3dLSLvCkASELZ0jKbY7gyKoNqo0hV4/GPnrK
- 21HUUrPUloSlWGB/5QuOH/XcChWB5Tu2tyIvCZwTFrFsDDUIbatjcu3cvuzHV+YwIHHW1xDBE1UB
- jCpD5EHxzzp6U5LOogMFDTjfArsQLtk70pt6wKGm+LUx5vR1yblTmXVHIloUFcd4G7ad6Qz4G3bx
- hYTeodoS76TiEJd6eN4MUZeoIUCLhr0N8F5OSza7OyAfikJW4Qsav3vQIkMsRIz75Sq0bBwcupTg
- E34h5prCy8VCZLQelHsIJchxzIdFV4XTnyliIoNRlwAYl3dqmJLJfGBs32x9SuRwTMKeuB330DTH
- D8z7p/8Dvq1wkNoL3chtl1+afwkyQf3NosxabUzyqkn+Zvjp2DXrDige7kgvOtB5CTh8piKCk5XQ
- A76+AqAF3SAi428diDRgxuYKuQl1C/AH6GmWNcf7I4GOODm4RStDeKLRLBT/DShycpWbXgnbiUSY
- qqFJu3FS8r/2/yehNq+4tneI3TqkbZs0kNwUXTC/t+sX5Ie3cdCh13cV1ELX8vMxmV2b3RZtP+oG
- I/hGoiLtk/bdmuYqh7GYVPEi92tF4+KOdh2ajcQGjTa3FPOdVGm3jjzVpG2Tgbet9r1ke8LJaDmg
- kpzNNIaRkPpkUZ3+/uul9XXeifdy
- -----END CERTIFICATE-----
- AC RAIZ FNMT-RCM SERVIDORES SEGUROS
- ===================================
- -----BEGIN CERTIFICATE-----
- MIICbjCCAfOgAwIBAgIQYvYybOXE42hcG2LdnC6dlTAKBggqhkjOPQQDAzB4MQswCQYDVQQGEwJF
- UzERMA8GA1UECgwIRk5NVC1SQ00xDjAMBgNVBAsMBUNlcmVzMRgwFgYDVQRhDA9WQVRFUy1RMjgy
- NjAwNEoxLDAqBgNVBAMMI0FDIFJBSVogRk5NVC1SQ00gU0VSVklET1JFUyBTRUdVUk9TMB4XDTE4
- MTIyMDA5MzczM1oXDTQzMTIyMDA5MzczM1oweDELMAkGA1UEBhMCRVMxETAPBgNVBAoMCEZOTVQt
- UkNNMQ4wDAYDVQQLDAVDZXJlczEYMBYGA1UEYQwPVkFURVMtUTI4MjYwMDRKMSwwKgYDVQQDDCNB
- QyBSQUlaIEZOTVQtUkNNIFNFUlZJRE9SRVMgU0VHVVJPUzB2MBAGByqGSM49AgEGBSuBBAAiA2IA
- BPa6V1PIyqvfNkpSIeSX0oNnnvBlUdBeh8dHsVnyV0ebAAKTRBdp20LHsbI6GA60XYyzZl2hNPk2
- LEnb80b8s0RpRBNm/dfF/a82Tc4DTQdxz69qBdKiQ1oKUm8BA06Oi6NCMEAwDwYDVR0TAQH/BAUw
- AwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFAG5L++/EYZg8k/QQW6rcx/n0m5JMAoGCCqG
- SM49BAMDA2kAMGYCMQCuSuMrQMN0EfKVrRYj3k4MGuZdpSRea0R7/DjiT8ucRRcRTBQnJlU5dUoD
- zBOQn5ICMQD6SmxgiHPz7riYYqnOK8LZiqZwMR2vsJRM60/G49HzYqc8/5MuB1xJAWdpEgJyv+c=
- -----END CERTIFICATE-----
- GlobalSign Root R46
- ===================
- -----BEGIN CERTIFICATE-----
- MIIFWjCCA0KgAwIBAgISEdK7udcjGJ5AXwqdLdDfJWfRMA0GCSqGSIb3DQEBDAUAMEYxCzAJBgNV
- BAYTAkJFMRkwFwYDVQQKExBHbG9iYWxTaWduIG52LXNhMRwwGgYDVQQDExNHbG9iYWxTaWduIFJv
- b3QgUjQ2MB4XDTE5MDMyMDAwMDAwMFoXDTQ2MDMyMDAwMDAwMFowRjELMAkGA1UEBhMCQkUxGTAX
- BgNVBAoTEEdsb2JhbFNpZ24gbnYtc2ExHDAaBgNVBAMTE0dsb2JhbFNpZ24gUm9vdCBSNDYwggIi
- MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCsrHQy6LNl5brtQyYdpokNRbopiLKkHWPd08Es
- CVeJOaFV6Wc0dwxu5FUdUiXSE2te4R2pt32JMl8Nnp8semNgQB+msLZ4j5lUlghYruQGvGIFAha/
- r6gjA7aUD7xubMLL1aa7DOn2wQL7Id5m3RerdELv8HQvJfTqa1VbkNud316HCkD7rRlr+/fKYIje
- 2sGP1q7Vf9Q8g+7XFkyDRTNrJ9CG0Bwta/OrffGFqfUo0q3v84RLHIf8E6M6cqJaESvWJ3En7YEt
- bWaBkoe0G1h6zD8K+kZPTXhc+CtI4wSEy132tGqzZfxCnlEmIyDLPRT5ge1lFgBPGmSXZgjPjHvj
- K8Cd+RTyG/FWaha/LIWFzXg4mutCagI0GIMXTpRW+LaCtfOW3T3zvn8gdz57GSNrLNRyc0NXfeD4
- 12lPFzYE+cCQYDdF3uYM2HSNrpyibXRdQr4G9dlkbgIQrImwTDsHTUB+JMWKmIJ5jqSngiCNI/on
- ccnfxkF0oE32kRbcRoxfKWMxWXEM2G/CtjJ9++ZdU6Z+Ffy7dXxd7Pj2Fxzsx2sZy/N78CsHpdls
- eVR2bJ0cpm4O6XkMqCNqo98bMDGfsVR7/mrLZqrcZdCinkqaByFrgY/bxFn63iLABJzjqls2k+g9
- vXqhnQt2sQvHnf3PmKgGwvgqo6GDoLclcqUC4wIDAQABo0IwQDAOBgNVHQ8BAf8EBAMCAYYwDwYD
- VR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUA1yrc4GHqMywptWU4jaWSf8FmSwwDQYJKoZIhvcNAQEM
- BQADggIBAHx47PYCLLtbfpIrXTncvtgdokIzTfnvpCo7RGkerNlFo048p9gkUbJUHJNOxO97k4Vg
- JuoJSOD1u8fpaNK7ajFxzHmuEajwmf3lH7wvqMxX63bEIaZHU1VNaL8FpO7XJqti2kM3S+LGteWy
- gxk6x9PbTZ4IevPuzz5i+6zoYMzRx6Fcg0XERczzF2sUyQQCPtIkpnnpHs6i58FZFZ8d4kuaPp92
- CC1r2LpXFNqD6v6MVenQTqnMdzGxRBF6XLE+0xRFFRhiJBPSy03OXIPBNvIQtQ6IbbjhVp+J3pZm
- OUdkLG5NrmJ7v2B0GbhWrJKsFjLtrWhV/pi60zTe9Mlhww6G9kuEYO4Ne7UyWHmRVSyBQ7N0H3qq
- JZ4d16GLuc1CLgSkZoNNiTW2bKg2SnkheCLQQrzRQDGQob4Ez8pn7fXwgNNgyYMqIgXQBztSvwye
- qiv5u+YfjyW6hY0XHgL+XVAEV8/+LbzvXMAaq7afJMbfc2hIkCwU9D9SGuTSyxTDYWnP4vkYxboz
- nxSjBF25cfe1lNj2M8FawTSLfJvdkzrnE6JwYZ+vj+vYxXX4M2bUdGc6N3ec592kD3ZDZopD8p/7
- DEJ4Y9HiD2971KE9dJeFt0g5QdYg/NA6s/rob8SKunE3vouXsXgxT7PntgMTzlSdriVZzH81Xwj3
- QEUxeCp6
- -----END CERTIFICATE-----
- GlobalSign Root E46
- ===================
- -----BEGIN CERTIFICATE-----
- MIICCzCCAZGgAwIBAgISEdK7ujNu1LzmJGjFDYQdmOhDMAoGCCqGSM49BAMDMEYxCzAJBgNVBAYT
- AkJFMRkwFwYDVQQKExBHbG9iYWxTaWduIG52LXNhMRwwGgYDVQQDExNHbG9iYWxTaWduIFJvb3Qg
- RTQ2MB4XDTE5MDMyMDAwMDAwMFoXDTQ2MDMyMDAwMDAwMFowRjELMAkGA1UEBhMCQkUxGTAXBgNV
- BAoTEEdsb2JhbFNpZ24gbnYtc2ExHDAaBgNVBAMTE0dsb2JhbFNpZ24gUm9vdCBFNDYwdjAQBgcq
- hkjOPQIBBgUrgQQAIgNiAAScDrHPt+ieUnd1NPqlRqetMhkytAepJ8qUuwzSChDH2omwlwxwEwkB
- jtjqR+q+soArzfwoDdusvKSGN+1wCAB16pMLey5SnCNoIwZD7JIvU4Tb+0cUB+hflGddyXqBPCCj
- QjBAMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBQxCpCPtsad0kRL
- gLWi5h+xEk8blTAKBggqhkjOPQQDAwNoADBlAjEA31SQ7Zvvi5QCkxeCmb6zniz2C5GMn0oUsfZk
- vLtoURMMA/cVi4RguYv/Uo7njLwcAjA8+RHUjE7AwWHCFUyqqx0LMV87HOIAl0Qx5v5zli/altP+
- CAezNIm8BZ/3Hobui3A=
- -----END CERTIFICATE-----
- GLOBALTRUST 2020
- ================
- -----BEGIN CERTIFICATE-----
- MIIFgjCCA2qgAwIBAgILWku9WvtPilv6ZeUwDQYJKoZIhvcNAQELBQAwTTELMAkGA1UEBhMCQVQx
- IzAhBgNVBAoTGmUtY29tbWVyY2UgbW9uaXRvcmluZyBHbWJIMRkwFwYDVQQDExBHTE9CQUxUUlVT
- VCAyMDIwMB4XDTIwMDIxMDAwMDAwMFoXDTQwMDYxMDAwMDAwMFowTTELMAkGA1UEBhMCQVQxIzAh
- BgNVBAoTGmUtY29tbWVyY2UgbW9uaXRvcmluZyBHbWJIMRkwFwYDVQQDExBHTE9CQUxUUlVTVCAy
- MDIwMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAri5WrRsc7/aVj6B3GyvTY4+ETUWi
- D59bRatZe1E0+eyLinjF3WuvvcTfk0Uev5E4C64OFudBc/jbu9G4UeDLgztzOG53ig9ZYybNpyrO
- VPu44sB8R85gfD+yc/LAGbaKkoc1DZAoouQVBGM+uq/ufF7MpotQsjj3QWPKzv9pj2gOlTblzLmM
- CcpL3TGQlsjMH/1WljTbjhzqLL6FLmPdqqmV0/0plRPwyJiT2S0WR5ARg6I6IqIoV6Lr/sCMKKCm
- fecqQjuCgGOlYx8ZzHyyZqjC0203b+J+BlHZRYQfEs4kUmSFC0iAToexIiIwquuuvuAC4EDosEKA
- A1GqtH6qRNdDYfOiaxaJSaSjpCuKAsR49GiKweR6NrFvG5Ybd0mN1MkGco/PU+PcF4UgStyYJ9OR
- JitHHmkHr96i5OTUawuzXnzUJIBHKWk7buis/UDr2O1xcSvy6Fgd60GXIsUf1DnQJ4+H4xj04KlG
- DfV0OoIu0G4skaMxXDtG6nsEEFZegB31pWXogvziB4xiRfUg3kZwhqG8k9MedKZssCz3AwyIDMvU
- clOGvGBG85hqwvG/Q/lwIHfKN0F5VVJjjVsSn8VoxIidrPIwq7ejMZdnrY8XD2zHc+0klGvIg5rQ
- mjdJBKuxFshsSUktq6HQjJLyQUp5ISXbY9e2nKd+Qmn7OmMCAwEAAaNjMGEwDwYDVR0TAQH/BAUw
- AwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFNwuH9FhN3nkq9XVsxJxaD1qaJwiMB8GA1Ud
- IwQYMBaAFNwuH9FhN3nkq9XVsxJxaD1qaJwiMA0GCSqGSIb3DQEBCwUAA4ICAQCR8EICaEDuw2jA
- VC/f7GLDw56KoDEoqoOOpFaWEhCGVrqXctJUMHytGdUdaG/7FELYjQ7ztdGl4wJCXtzoRlgHNQIw
- 4Lx0SsFDKv/bGtCwr2zD/cuz9X9tAy5ZVp0tLTWMstZDFyySCstd6IwPS3BD0IL/qMy/pJTAvoe9
- iuOTe8aPmxadJ2W8esVCgmxcB9CpwYhgROmYhRZf+I/KARDOJcP5YBugxZfD0yyIMaK9MOzQ0MAS
- 8cE54+X1+NZK3TTN+2/BT+MAi1bikvcoskJ3ciNnxz8RFbLEAwW+uxF7Cr+obuf/WEPPm2eggAe2
- HcqtbepBEX4tdJP7wry+UUTF72glJ4DjyKDUEuzZpTcdN3y0kcra1LGWge9oXHYQSa9+pTeAsRxS
- vTOBTI/53WXZFM2KJVj04sWDpQmQ1GwUY7VA3+vA/MRYfg0UFodUJ25W5HCEuGwyEn6CMUO+1918
- oa2u1qsgEu8KwxCMSZY13At1XrFP1U80DhEgB3VDRemjEdqso5nCtnkn4rnvyOL2NSl6dPrFf4IF
- YqYK6miyeUcGbvJXqBUzxvd4Sj1Ce2t+/vdG6tHrju+IaFvowdlxfv1k7/9nR4hYJS8+hge9+6jl
- gqispdNpQ80xiEmEU5LAsTkbOYMBMMTyqfrQA71yN2BWHzZ8vTmR9W0Nv3vXkg==
- -----END CERTIFICATE-----
- ANF Secure Server Root CA
- =========================
- -----BEGIN CERTIFICATE-----
- MIIF7zCCA9egAwIBAgIIDdPjvGz5a7EwDQYJKoZIhvcNAQELBQAwgYQxEjAQBgNVBAUTCUc2MzI4
- NzUxMDELMAkGA1UEBhMCRVMxJzAlBgNVBAoTHkFORiBBdXRvcmlkYWQgZGUgQ2VydGlmaWNhY2lv
- bjEUMBIGA1UECxMLQU5GIENBIFJhaXoxIjAgBgNVBAMTGUFORiBTZWN1cmUgU2VydmVyIFJvb3Qg
- Q0EwHhcNMTkwOTA0MTAwMDM4WhcNMzkwODMwMTAwMDM4WjCBhDESMBAGA1UEBRMJRzYzMjg3NTEw
- MQswCQYDVQQGEwJFUzEnMCUGA1UEChMeQU5GIEF1dG9yaWRhZCBkZSBDZXJ0aWZpY2FjaW9uMRQw
- EgYDVQQLEwtBTkYgQ0EgUmFpejEiMCAGA1UEAxMZQU5GIFNlY3VyZSBTZXJ2ZXIgUm9vdCBDQTCC
- AiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANvrayvmZFSVgpCjcqQZAZ2cC4Ffc0m6p6zz
- BE57lgvsEeBbphzOG9INgxwruJ4dfkUyYA8H6XdYfp9qyGFOtibBTI3/TO80sh9l2Ll49a2pcbnv
- T1gdpd50IJeh7WhM3pIXS7yr/2WanvtH2Vdy8wmhrnZEE26cLUQ5vPnHO6RYPUG9tMJJo8gN0pcv
- B2VSAKduyK9o7PQUlrZXH1bDOZ8rbeTzPvY1ZNoMHKGESy9LS+IsJJ1tk0DrtSOOMspvRdOoiXse
- zx76W0OLzc2oD2rKDF65nkeP8Nm2CgtYZRczuSPkdxl9y0oukntPLxB3sY0vaJxizOBQ+OyRp1RM
- VwnVdmPF6GUe7m1qzwmd+nxPrWAI/VaZDxUse6mAq4xhj0oHdkLePfTdsiQzW7i1o0TJrH93PB0j
- 7IKppuLIBkwC/qxcmZkLLxCKpvR/1Yd0DVlJRfbwcVw5Kda/SiOL9V8BY9KHcyi1Swr1+KuCLH5z
- JTIdC2MKF4EA/7Z2Xue0sUDKIbvVgFHlSFJnLNJhiQcND85Cd8BEc5xEUKDbEAotlRyBr+Qc5RQe
- 8TZBAQIvfXOn3kLMTOmJDVb3n5HUA8ZsyY/b2BzgQJhdZpmYgG4t/wHFzstGH6wCxkPmrqKEPMVO
- Hj1tyRRM4y5Bu8o5vzY8KhmqQYdOpc5LMnndkEl/AgMBAAGjYzBhMB8GA1UdIwQYMBaAFJxf0Gxj
- o1+TypOYCK2Mh6UsXME3MB0GA1UdDgQWBBScX9BsY6Nfk8qTmAitjIelLFzBNzAOBgNVHQ8BAf8E
- BAMCAYYwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAgEATh65isagmD9uw2nAalxJ
- UqzLK114OMHVVISfk/CHGT0sZonrDUL8zPB1hT+L9IBdeeUXZ701guLyPI59WzbLWoAAKfLOKyzx
- j6ptBZNscsdW699QIyjlRRA96Gejrw5VD5AJYu9LWaL2U/HANeQvwSS9eS9OICI7/RogsKQOLHDt
- dD+4E5UGUcjohybKpFtqFiGS3XNgnhAY3jyB6ugYw3yJ8otQPr0R4hUDqDZ9MwFsSBXXiJCZBMXM
- 5gf0vPSQ7RPi6ovDj6MzD8EpTBNO2hVWcXNyglD2mjN8orGoGjR0ZVzO0eurU+AagNjqOknkJjCb
- 5RyKqKkVMoaZkgoQI1YS4PbOTOK7vtuNknMBZi9iPrJyJ0U27U1W45eZ/zo1PqVUSlJZS2Db7v54
- EX9K3BR5YLZrZAPbFYPhor72I5dQ8AkzNqdxliXzuUJ92zg/LFis6ELhDtjTO0wugumDLmsx2d1H
- hk9tl5EuT+IocTUW0fJz/iUrB0ckYyfI+PbZa/wSMVYIwFNCr5zQM378BvAxRAMU8Vjq8moNqRGy
- g77FGr8H6lnco4g175x2MjxNBiLOFeXdntiP2t7SxDnlF4HPOEfrf4htWRvfn0IUrn7PqLBmZdo3
- r5+qPeoott7VMVgWglvquxl1AnMaykgaIZOQCo6ThKd9OyMYkomgjaw=
- -----END CERTIFICATE-----
- Certum EC-384 CA
- ================
- -----BEGIN CERTIFICATE-----
- MIICZTCCAeugAwIBAgIQeI8nXIESUiClBNAt3bpz9DAKBggqhkjOPQQDAzB0MQswCQYDVQQGEwJQ
- TDEhMB8GA1UEChMYQXNzZWNvIERhdGEgU3lzdGVtcyBTLkEuMScwJQYDVQQLEx5DZXJ0dW0gQ2Vy
- dGlmaWNhdGlvbiBBdXRob3JpdHkxGTAXBgNVBAMTEENlcnR1bSBFQy0zODQgQ0EwHhcNMTgwMzI2
- MDcyNDU0WhcNNDMwMzI2MDcyNDU0WjB0MQswCQYDVQQGEwJQTDEhMB8GA1UEChMYQXNzZWNvIERh
- dGEgU3lzdGVtcyBTLkEuMScwJQYDVQQLEx5DZXJ0dW0gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkx
- GTAXBgNVBAMTEENlcnR1bSBFQy0zODQgQ0EwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAATEKI6rGFtq
- vm5kN2PkzeyrOvfMobgOgknXhimfoZTy42B4mIF4Bk3y7JoOV2CDn7TmFy8as10CW4kjPMIRBSqn
- iBMY81CE1700LCeJVf/OTOffph8oxPBUw7l8t1Ot68KjQjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYD
- VR0OBBYEFI0GZnQkdjrzife81r1HfS+8EF9LMA4GA1UdDwEB/wQEAwIBBjAKBggqhkjOPQQDAwNo
- ADBlAjADVS2m5hjEfO/JUG7BJw+ch69u1RsIGL2SKcHvlJF40jocVYli5RsJHrpka/F2tNQCMQC0
- QoSZ/6vnnvuRlydd3LBbMHHOXjgaatkl5+r3YZJW+OraNsKHZZYuciUvf9/DE8k=
- -----END CERTIFICATE-----
- Certum Trusted Root CA
- ======================
- -----BEGIN CERTIFICATE-----
- MIIFwDCCA6igAwIBAgIQHr9ZULjJgDdMBvfrVU+17TANBgkqhkiG9w0BAQ0FADB6MQswCQYDVQQG
- EwJQTDEhMB8GA1UEChMYQXNzZWNvIERhdGEgU3lzdGVtcyBTLkEuMScwJQYDVQQLEx5DZXJ0dW0g
- Q2VydGlmaWNhdGlvbiBBdXRob3JpdHkxHzAdBgNVBAMTFkNlcnR1bSBUcnVzdGVkIFJvb3QgQ0Ew
- HhcNMTgwMzE2MTIxMDEzWhcNNDMwMzE2MTIxMDEzWjB6MQswCQYDVQQGEwJQTDEhMB8GA1UEChMY
- QXNzZWNvIERhdGEgU3lzdGVtcyBTLkEuMScwJQYDVQQLEx5DZXJ0dW0gQ2VydGlmaWNhdGlvbiBB
- dXRob3JpdHkxHzAdBgNVBAMTFkNlcnR1bSBUcnVzdGVkIFJvb3QgQ0EwggIiMA0GCSqGSIb3DQEB
- AQUAA4ICDwAwggIKAoICAQDRLY67tzbqbTeRn06TpwXkKQMlzhyC93yZn0EGze2jusDbCSzBfN8p
- fktlL5On1AFrAygYo9idBcEq2EXxkd7fO9CAAozPOA/qp1x4EaTByIVcJdPTsuclzxFUl6s1wB52
- HO8AU5853BSlLCIls3Jy/I2z5T4IHhQqNwuIPMqw9MjCoa68wb4pZ1Xi/K1ZXP69VyywkI3C7Te2
- fJmItdUDmj0VDT06qKhF8JVOJVkdzZhpu9PMMsmN74H+rX2Ju7pgE8pllWeg8xn2A1bUatMn4qGt
- g/BKEiJ3HAVz4hlxQsDsdUaakFjgao4rpUYwBI4Zshfjvqm6f1bxJAPXsiEodg42MEx51UGamqi4
- NboMOvJEGyCI98Ul1z3G4z5D3Yf+xOr1Uz5MZf87Sst4WmsXXw3Hw09Omiqi7VdNIuJGmj8PkTQk
- fVXjjJU30xrwCSss0smNtA0Aq2cpKNgB9RkEth2+dv5yXMSFytKAQd8FqKPVhJBPC/PgP5sZ0jeJ
- P/J7UhyM9uH3PAeXjA6iWYEMspA90+NZRu0PqafegGtaqge2Gcu8V/OXIXoMsSt0Puvap2ctTMSY
- njYJdmZm/Bo/6khUHL4wvYBQv3y1zgD2DGHZ5yQD4OMBgQ692IU0iL2yNqh7XAjlRICMb/gv1SHK
- HRzQ+8S1h9E6Tsd2tTVItQIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBSM+xx1
- vALTn04uSNn5YFSqxLNP+jAOBgNVHQ8BAf8EBAMCAQYwDQYJKoZIhvcNAQENBQADggIBAEii1QAL
- LtA/vBzVtVRJHlpr9OTy4EA34MwUe7nJ+jW1dReTagVphZzNTxl4WxmB82M+w85bj/UvXgF2Ez8s
- ALnNllI5SW0ETsXpD4YN4fqzX4IS8TrOZgYkNCvozMrnadyHncI013nR03e4qllY/p0m+jiGPp2K
- h2RX5Rc64vmNueMzeMGQ2Ljdt4NR5MTMI9UGfOZR0800McD2RrsLrfw9EAUqO0qRJe6M1ISHgCq8
- CYyqOhNf6DR5UMEQGfnTKB7U0VEwKbOukGfWHwpjscWpxkIxYxeU72nLL/qMFH3EQxiJ2fAyQOaA
- 4kZf5ePBAFmo+eggvIksDkc0C+pXwlM2/KfUrzHN/gLldfq5Jwn58/U7yn2fqSLLiMmq0Uc9Nneo
- WWRrJ8/vJ8HjJLWG965+Mk2weWjROeiQWMODvA8s1pfrzgzhIMfatz7DP78v3DSk+yshzWePS/Tj
- 6tQ/50+6uaWTRRxmHyH6ZF5v4HaUMst19W7l9o/HuKTMqJZ9ZPskWkoDbGs4xugDQ5r3V7mzKWmT
- OPQD8rv7gmsHINFSH5pkAnuYZttcTVoP0ISVoDwUQwbKytu4QTbaakRnh6+v40URFWkIsr4WOZck
- bxJF0WddCajJFdr60qZfE2Efv4WstK2tBZQIgx51F9NxO5NQI1mg7TyRVJ12AMXDuDjb
- -----END CERTIFICATE-----
- TunTrust Root CA
- ================
- -----BEGIN CERTIFICATE-----
- MIIFszCCA5ugAwIBAgIUEwLV4kBMkkaGFmddtLu7sms+/BMwDQYJKoZIhvcNAQELBQAwYTELMAkG
- A1UEBhMCVE4xNzA1BgNVBAoMLkFnZW5jZSBOYXRpb25hbGUgZGUgQ2VydGlmaWNhdGlvbiBFbGVj
- dHJvbmlxdWUxGTAXBgNVBAMMEFR1blRydXN0IFJvb3QgQ0EwHhcNMTkwNDI2MDg1NzU2WhcNNDQw
- NDI2MDg1NzU2WjBhMQswCQYDVQQGEwJUTjE3MDUGA1UECgwuQWdlbmNlIE5hdGlvbmFsZSBkZSBD
- ZXJ0aWZpY2F0aW9uIEVsZWN0cm9uaXF1ZTEZMBcGA1UEAwwQVHVuVHJ1c3QgUm9vdCBDQTCCAiIw
- DQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMPN0/y9BFPdDCA61YguBUtB9YOCfvdZn56eY+hz
- 2vYGqU8ftPkLHzmMmiDQfgbU7DTZhrx1W4eI8NLZ1KMKsmwb60ksPqxd2JQDoOw05TDENX37Jk0b
- bjBU2PWARZw5rZzJJQRNmpA+TkBuimvNKWfGzC3gdOgFVwpIUPp6Q9p+7FuaDmJ2/uqdHYVy7BG7
- NegfJ7/Boce7SBbdVtfMTqDhuazb1YMZGoXRlJfXyqNlC/M4+QKu3fZnz8k/9YosRxqZbwUN/dAd
- gjH8KcwAWJeRTIAAHDOFli/LQcKLEITDCSSJH7UP2dl3RxiSlGBcx5kDPP73lad9UKGAwqmDrViW
- VSHbhlnUr8a83YFuB9tgYv7sEG7aaAH0gxupPqJbI9dkxt/con3YS7qC0lH4Zr8GRuR5KiY2eY8f
- Tpkdso8MDhz/yV3A/ZAQprE38806JG60hZC/gLkMjNWb1sjxVj8agIl6qeIbMlEsPvLfe/ZdeikZ
- juXIvTZxi11Mwh0/rViizz1wTaZQmCXcI/m4WEEIcb9PuISgjwBUFfyRbVinljvrS5YnzWuioYas
- DXxU5mZMZl+QviGaAkYt5IPCgLnPSz7ofzwB7I9ezX/SKEIBlYrilz0QIX32nRzFNKHsLA4KUiwS
- VXAkPcvCFDVDXSdOvsC9qnyW5/yeYa1E0wCXAgMBAAGjYzBhMB0GA1UdDgQWBBQGmpsfU33x9aTI
- 04Y+oXNZtPdEITAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFAaamx9TffH1pMjThj6hc1m0
- 90QhMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsFAAOCAgEAqgVutt0Vyb+zxiD2BkewhpMl
- 0425yAA/l/VSJ4hxyXT968pk21vvHl26v9Hr7lxpuhbI87mP0zYuQEkHDVneixCwSQXi/5E/S7fd
- Ao74gShczNxtr18UnH1YeA32gAm56Q6XKRm4t+v4FstVEuTGfbvE7Pi1HE4+Z7/FXxttbUcoqgRY
- YdZ2vyJ/0Adqp2RT8JeNnYA/u8EH22Wv5psymsNUk8QcCMNE+3tjEUPRahphanltkE8pjkcFwRJp
- adbGNjHh/PqAulxPxOu3Mqz4dWEX1xAZufHSCe96Qp1bWgvUxpVOKs7/B9dPfhgGiPEZtdmYu65x
- xBzndFlY7wyJz4sfdZMaBBSSSFCp61cpABbjNhzI+L/wM9VBD8TMPN3pM0MBkRArHtG5Xc0yGYuP
- jCB31yLEQtyEFpslbei0VXF/sHyz03FJuc9SpAQ/3D2gu68zngowYI7bnV2UqL1g52KAdoGDDIzM
- MEZJ4gzSqK/rYXHv5yJiqfdcZGyfFoxnNidF9Ql7v/YQCvGwjVRDjAS6oz/v4jXH+XTgbzRB0L9z
- ZVcg+ZtnemZoJE6AZb0QmQZZ8mWvuMZHu/2QeItBcy6vVR/cO5JyboTT0GFMDcx2V+IthSIVNg3r
- AZ3r2OvEhJn7wAzMMujjd9qDRIueVSjAi1jTkD5OGwDxFa2DK5o=
- -----END CERTIFICATE-----
- HARICA TLS RSA Root CA 2021
- ===========================
- -----BEGIN CERTIFICATE-----
- MIIFpDCCA4ygAwIBAgIQOcqTHO9D88aOk8f0ZIk4fjANBgkqhkiG9w0BAQsFADBsMQswCQYDVQQG
- EwJHUjE3MDUGA1UECgwuSGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2VhcmNoIEluc3RpdHV0aW9u
- cyBDQTEkMCIGA1UEAwwbSEFSSUNBIFRMUyBSU0EgUm9vdCBDQSAyMDIxMB4XDTIxMDIxOTEwNTUz
- OFoXDTQ1MDIxMzEwNTUzN1owbDELMAkGA1UEBhMCR1IxNzA1BgNVBAoMLkhlbGxlbmljIEFjYWRl
- bWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgQ0ExJDAiBgNVBAMMG0hBUklDQSBUTFMgUlNB
- IFJvb3QgQ0EgMjAyMTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAIvC569lmwVnlskN
- JLnQDmT8zuIkGCyEf3dRywQRNrhe7Wlxp57kJQmXZ8FHws+RFjZiPTgE4VGC/6zStGndLuwRo0Xu
- a2s7TL+MjaQenRG56Tj5eg4MmOIjHdFOY9TnuEFE+2uva9of08WRiFukiZLRgeaMOVig1mlDqa2Y
- Ulhu2wr7a89o+uOkXjpFc5gH6l8Cct4MpbOfrqkdtx2z/IpZ525yZa31MJQjB/OCFks1mJxTuy/K
- 5FrZx40d/JiZ+yykgmvwKh+OC19xXFyuQnspiYHLA6OZyoieC0AJQTPb5lh6/a6ZcMBaD9YThnEv
- dmn8kN3bLW7R8pv1GmuebxWMevBLKKAiOIAkbDakO/IwkfN4E8/BPzWr8R0RI7VDIp4BkrcYAuUR
- 0YLbFQDMYTfBKnya4dC6s1BG7oKsnTH4+yPiAwBIcKMJJnkVU2DzOFytOOqBAGMUuTNe3QvboEUH
- GjMJ+E20pwKmafTCWQWIZYVWrkvL4N48fS0ayOn7H6NhStYqE613TBoYm5EPWNgGVMWX+Ko/IIqm
- haZ39qb8HOLubpQzKoNQhArlT4b4UEV4AIHrW2jjJo3Me1xR9BQsQL4aYB16cmEdH2MtiKrOokWQ
- CPxrvrNQKlr9qEgYRtaQQJKQCoReaDH46+0N0x3GfZkYVVYnZS6NRcUk7M7jAgMBAAGjQjBAMA8G
- A1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFApII6ZgpJIKM+qTW8VX6iVNvRLuMA4GA1UdDwEB/wQE
- AwIBhjANBgkqhkiG9w0BAQsFAAOCAgEAPpBIqm5iFSVmewzVjIuJndftTgfvnNAUX15QvWiWkKQU
- EapobQk1OUAJ2vQJLDSle1mESSmXdMgHHkdt8s4cUCbjnj1AUz/3f5Z2EMVGpdAgS1D0NTsY9FVq
- QRtHBmg8uwkIYtlfVUKqrFOFrJVWNlar5AWMxajaH6NpvVMPxP/cyuN+8kyIhkdGGvMA9YCRotxD
- QpSbIPDRzbLrLFPCU3hKTwSUQZqPJzLB5UkZv/HywouoCjkxKLR9YjYsTewfM7Z+d21+UPCfDtcR
- j88YxeMn/ibvBZ3PzzfF0HvaO7AWhAw6k9a+F9sPPg4ZeAnHqQJyIkv3N3a6dcSFA1pj1bF1BcK5
- vZStjBWZp5N99sXzqnTPBIWUmAD04vnKJGW/4GKvyMX6ssmeVkjaef2WdhW+o45WxLM0/L5H9MG0
- qPzVMIho7suuyWPEdr6sOBjhXlzPrjoiUevRi7PzKzMHVIf6tLITe7pTBGIBnfHAT+7hOtSLIBD6
- Alfm78ELt5BGnBkpjNxvoEppaZS3JGWg/6w/zgH7IS79aPib8qXPMThcFarmlwDB31qlpzmq6YR/
- PFGoOtmUW4y/Twhx5duoXNTSpv4Ao8YWxw/ogM4cKGR0GQjTQuPOAF1/sdwTsOEFy9EgqoZ0njnn
- kf3/W9b3raYvAwtt41dU63ZTGI0RmLo=
- -----END CERTIFICATE-----
- HARICA TLS ECC Root CA 2021
- ===========================
- -----BEGIN CERTIFICATE-----
- MIICVDCCAdugAwIBAgIQZ3SdjXfYO2rbIvT/WeK/zjAKBggqhkjOPQQDAzBsMQswCQYDVQQGEwJH
- UjE3MDUGA1UECgwuSGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2VhcmNoIEluc3RpdHV0aW9ucyBD
- QTEkMCIGA1UEAwwbSEFSSUNBIFRMUyBFQ0MgUm9vdCBDQSAyMDIxMB4XDTIxMDIxOTExMDExMFoX
- DTQ1MDIxMzExMDEwOVowbDELMAkGA1UEBhMCR1IxNzA1BgNVBAoMLkhlbGxlbmljIEFjYWRlbWlj
- IGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgQ0ExJDAiBgNVBAMMG0hBUklDQSBUTFMgRUNDIFJv
- b3QgQ0EgMjAyMTB2MBAGByqGSM49AgEGBSuBBAAiA2IABDgI/rGgltJ6rK9JOtDA4MM7KKrxcm1l
- AEeIhPyaJmuqS7psBAqIXhfyVYf8MLA04jRYVxqEU+kw2anylnTDUR9YSTHMmE5gEYd103KUkE+b
- ECUqqHgtvpBBWJAVcqeht6NCMEAwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUyRtTgRL+BNUW
- 0aq8mm+3oJUZbsowDgYDVR0PAQH/BAQDAgGGMAoGCCqGSM49BAMDA2cAMGQCMBHervjcToiwqfAi
- rcJRQO9gcS3ujwLEXQNwSaSS6sUUiHCm0w2wqsosQJz76YJumgIwK0eaB8bRwoF8yguWGEEbo/Qw
- CZ61IygNnxS2PFOiTAZpffpskcYqSUXm7LcT4Tps
- -----END CERTIFICATE-----
- Autoridad de Certificacion Firmaprofesional CIF A62634068
- =========================================================
- -----BEGIN CERTIFICATE-----
- MIIGFDCCA/ygAwIBAgIIG3Dp0v+ubHEwDQYJKoZIhvcNAQELBQAwUTELMAkGA1UEBhMCRVMxQjBA
- BgNVBAMMOUF1dG9yaWRhZCBkZSBDZXJ0aWZpY2FjaW9uIEZpcm1hcHJvZmVzaW9uYWwgQ0lGIEE2
- MjYzNDA2ODAeFw0xNDA5MjMxNTIyMDdaFw0zNjA1MDUxNTIyMDdaMFExCzAJBgNVBAYTAkVTMUIw
- QAYDVQQDDDlBdXRvcmlkYWQgZGUgQ2VydGlmaWNhY2lvbiBGaXJtYXByb2Zlc2lvbmFsIENJRiBB
- NjI2MzQwNjgwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDKlmuO6vj78aI14H9M2uDD
- Utd9thDIAl6zQyrET2qyyhxdKJp4ERppWVevtSBC5IsP5t9bpgOSL/UR5GLXMnE42QQMcas9UX4P
- B99jBVzpv5RvwSmCwLTaUbDBPLutN0pcyvFLNg4kq7/DhHf9qFD0sefGL9ItWY16Ck6WaVICqjaY
- 7Pz6FIMMNx/Jkjd/14Et5cS54D40/mf0PmbR0/RAz15iNA9wBj4gGFrO93IbJWyTdBSTo3OxDqqH
- ECNZXyAFGUftaI6SEspd/NYrspI8IM/hX68gvqB2f3bl7BqGYTM+53u0P6APjqK5am+5hyZvQWyI
- plD9amML9ZMWGxmPsu2bm8mQ9QEM3xk9Dz44I8kvjwzRAv4bVdZO0I08r0+k8/6vKtMFnXkIoctX
- MbScyJCyZ/QYFpM6/EfY0XiWMR+6KwxfXZmtY4laJCB22N/9q06mIqqdXuYnin1oKaPnirjaEbsX
- LZmdEyRG98Xi2J+Of8ePdG1asuhy9azuJBCtLxTa/y2aRnFHvkLfuwHb9H/TKI8xWVvTyQKmtFLK
- bpf7Q8UIJm+K9Lv9nyiqDdVF8xM6HdjAeI9BZzwelGSuewvF6NkBiDkal4ZkQdU7hwxu+g/GvUgU
- vzlN1J5Bto+WHWOWk9mVBngxaJ43BjuAiUVhOSPHG0SjFeUc+JIwuwIDAQABo4HvMIHsMB0GA1Ud
- DgQWBBRlzeurNR4APn7VdMActHNHDhpkLzASBgNVHRMBAf8ECDAGAQH/AgEBMIGmBgNVHSAEgZ4w
- gZswgZgGBFUdIAAwgY8wLwYIKwYBBQUHAgEWI2h0dHA6Ly93d3cuZmlybWFwcm9mZXNpb25hbC5j
- b20vY3BzMFwGCCsGAQUFBwICMFAeTgBQAGEAcwBlAG8AIABkAGUAIABsAGEAIABCAG8AbgBhAG4A
- bwB2AGEAIAA0ADcAIABCAGEAcgBjAGUAbABvAG4AYQAgADAAOAAwADEANzAOBgNVHQ8BAf8EBAMC
- AQYwDQYJKoZIhvcNAQELBQADggIBAHSHKAIrdx9miWTtj3QuRhy7qPj4Cx2Dtjqn6EWKB7fgPiDL
- 4QjbEwj4KKE1soCzC1HA01aajTNFSa9J8OA9B3pFE1r/yJfY0xgsfZb43aJlQ3CTkBW6kN/oGbDb
- LIpgD7dvlAceHabJhfa9NPhAeGIQcDq+fUs5gakQ1JZBu/hfHAsdCPKxsIl68veg4MSPi3i1O1il
- I45PVf42O+AMt8oqMEEgtIDNrvx2ZnOorm7hfNoD6JQg5iKj0B+QXSBTFCZX2lSX3xZEEAEeiGaP
- cjiT3SC3NL7X8e5jjkd5KAb881lFJWAiMxujX6i6KtoaPc1A6ozuBRWV1aUsIC+nmCjuRfzxuIgA
- LI9C2lHVnOUTaHFFQ4ueCyE8S1wF3BqfmI7avSKecs2tCsvMo2ebKHTEm9caPARYpoKdrcd7b/+A
- lun4jWq9GJAd/0kakFI3ky88Al2CdgtR5xbHV/g4+afNmyJU72OwFW1TZQNKXkqgsqeOSQBZONXH
- 9IBk9W6VULgRfhVwOEqwf9DEMnDAGf/JOC0ULGb0QkTmVXYbgBVX/8Cnp6o5qtjTcNAuuuuUavpf
- NIbnYrX9ivAwhZTJryQCL2/W3Wf+47BVTwSYT6RBVuKT0Gro1vP7ZeDOdcQxWQzugsgMYDNKGbqE
- ZycPvEJdvSRUDewdcAZfpLz6IHxV
- -----END CERTIFICATE-----
- vTrus ECC Root CA
- =================
- -----BEGIN CERTIFICATE-----
- MIICDzCCAZWgAwIBAgIUbmq8WapTvpg5Z6LSa6Q75m0c1towCgYIKoZIzj0EAwMwRzELMAkGA1UE
- BhMCQ04xHDAaBgNVBAoTE2lUcnVzQ2hpbmEgQ28uLEx0ZC4xGjAYBgNVBAMTEXZUcnVzIEVDQyBS
- b290IENBMB4XDTE4MDczMTA3MjY0NFoXDTQzMDczMTA3MjY0NFowRzELMAkGA1UEBhMCQ04xHDAa
- BgNVBAoTE2lUcnVzQ2hpbmEgQ28uLEx0ZC4xGjAYBgNVBAMTEXZUcnVzIEVDQyBSb290IENBMHYw
- EAYHKoZIzj0CAQYFK4EEACIDYgAEZVBKrox5lkqqHAjDo6LN/llWQXf9JpRCux3NCNtzslt188+c
- ToL0v/hhJoVs1oVbcnDS/dtitN9Ti72xRFhiQgnH+n9bEOf+QP3A2MMrMudwpremIFUde4BdS49n
- TPEQo0IwQDAdBgNVHQ4EFgQUmDnNvtiyjPeyq+GtJK97fKHbH88wDwYDVR0TAQH/BAUwAwEB/zAO
- BgNVHQ8BAf8EBAMCAQYwCgYIKoZIzj0EAwMDaAAwZQIwV53dVvHH4+m4SVBrm2nDb+zDfSXkV5UT
- QJtS0zvzQBm8JsctBp61ezaf9SXUY2sAAjEA6dPGnlaaKsyh2j/IZivTWJwghfqrkYpwcBE4YGQL
- YgmRWAD5Tfs0aNoJrSEGGJTO
- -----END CERTIFICATE-----
- vTrus Root CA
- =============
- -----BEGIN CERTIFICATE-----
- MIIFVjCCAz6gAwIBAgIUQ+NxE9izWRRdt86M/TX9b7wFjUUwDQYJKoZIhvcNAQELBQAwQzELMAkG
- A1UEBhMCQ04xHDAaBgNVBAoTE2lUcnVzQ2hpbmEgQ28uLEx0ZC4xFjAUBgNVBAMTDXZUcnVzIFJv
- b3QgQ0EwHhcNMTgwNzMxMDcyNDA1WhcNNDMwNzMxMDcyNDA1WjBDMQswCQYDVQQGEwJDTjEcMBoG
- A1UEChMTaVRydXNDaGluYSBDby4sTHRkLjEWMBQGA1UEAxMNdlRydXMgUm9vdCBDQTCCAiIwDQYJ
- KoZIhvcNAQEBBQADggIPADCCAgoCggIBAL1VfGHTuB0EYgWgrmy3cLRB6ksDXhA/kFocizuwZots
- SKYcIrrVQJLuM7IjWcmOvFjai57QGfIvWcaMY1q6n6MLsLOaXLoRuBLpDLvPbmyAhykUAyyNJJrI
- ZIO1aqwTLDPxn9wsYTwaP3BVm60AUn/PBLn+NvqcwBauYv6WTEN+VRS+GrPSbcKvdmaVayqwlHeF
- XgQPYh1jdfdr58tbmnDsPmcF8P4HCIDPKNsFxhQnL4Z98Cfe/+Z+M0jnCx5Y0ScrUw5XSmXX+6KA
- YPxMvDVTAWqXcoKv8R1w6Jz1717CbMdHflqUhSZNO7rrTOiwCcJlwp2dCZtOtZcFrPUGoPc2BX70
- kLJrxLT5ZOrpGgrIDajtJ8nU57O5q4IikCc9Kuh8kO+8T/3iCiSn3mUkpF3qwHYw03dQ+A0Em5Q2
- AXPKBlim0zvc+gRGE1WKyURHuFE5Gi7oNOJ5y1lKCn+8pu8fA2dqWSslYpPZUxlmPCdiKYZNpGvu
- /9ROutW04o5IWgAZCfEF2c6Rsffr6TlP9m8EQ5pV9T4FFL2/s1m02I4zhKOQUqqzApVg+QxMaPnu
- 1RcN+HFXtSXkKe5lXa/R7jwXC1pDxaWG6iSe4gUH3DRCEpHWOXSuTEGC2/KmSNGzm/MzqvOmwMVO
- 9fSddmPmAsYiS8GVP1BkLFTltvA8Kc9XAgMBAAGjQjBAMB0GA1UdDgQWBBRUYnBj8XWEQ1iO0RYg
- scasGrz2iTAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsFAAOC
- AgEAKbqSSaet8PFww+SX8J+pJdVrnjT+5hpk9jprUrIQeBqfTNqK2uwcN1LgQkv7bHbKJAs5EhWd
- nxEt/Hlk3ODg9d3gV8mlsnZwUKT+twpw1aA08XXXTUm6EdGz2OyC/+sOxL9kLX1jbhd47F18iMjr
- jld22VkE+rxSH0Ws8HqA7Oxvdq6R2xCOBNyS36D25q5J08FsEhvMKar5CKXiNxTKsbhm7xqC5PD4
- 8acWabfbqWE8n/Uxy+QARsIvdLGx14HuqCaVvIivTDUHKgLKeBRtRytAVunLKmChZwOgzoy8sHJn
- xDHO2zTlJQNgJXtxmOTAGytfdELSS8VZCAeHvsXDf+eW2eHcKJfWjwXj9ZtOyh1QRwVTsMo554Wg
- icEFOwE30z9J4nfrI8iIZjs9OXYhRvHsXyO466JmdXTBQPfYaJqT4i2pLr0cox7IdMakLXogqzu4
- sEb9b91fUlV1YvCXoHzXOP0l382gmxDPi7g4Xl7FtKYCNqEeXxzP4padKar9mK5S4fNBUvupLnKW
- nyfjqnN9+BojZns7q2WwMgFLFT49ok8MKzWixtlnEjUwzXYuFrOZnk1PTi07NEPhmg4NpGaXutIc
- SkwsKouLgU9xGqndXHt7CMUADTdA43x7VF8vhV929vensBxXVsFy6K2ir40zSbofitzmdHxghm+H
- l3s=
- -----END CERTIFICATE-----
- ISRG Root X2
- ============
- -----BEGIN CERTIFICATE-----
- MIICGzCCAaGgAwIBAgIQQdKd0XLq7qeAwSxs6S+HUjAKBggqhkjOPQQDAzBPMQswCQYDVQQGEwJV
- UzEpMCcGA1UEChMgSW50ZXJuZXQgU2VjdXJpdHkgUmVzZWFyY2ggR3JvdXAxFTATBgNVBAMTDElT
- UkcgUm9vdCBYMjAeFw0yMDA5MDQwMDAwMDBaFw00MDA5MTcxNjAwMDBaME8xCzAJBgNVBAYTAlVT
- MSkwJwYDVQQKEyBJbnRlcm5ldCBTZWN1cml0eSBSZXNlYXJjaCBHcm91cDEVMBMGA1UEAxMMSVNS
- RyBSb290IFgyMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEzZvVn4CDCuwJSvMWSj5cz3es3mcFDR0H
- ttwW+1qLFNvicWDEukWVEYmO6gbf9yoWHKS5xcUy4APgHoIYOIvXRdgKam7mAHf7AlF9ItgKbppb
- d9/w+kHsOdx1ymgHDB/qo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNV
- HQ4EFgQUfEKWrt5LSDv6kviejM9ti6lyN5UwCgYIKoZIzj0EAwMDaAAwZQIwe3lORlCEwkSHRhtF
- cP9Ymd70/aTSVaYgLXTWNLxBo1BfASdWtL4ndQavEi51mI38AjEAi/V3bNTIZargCyzuFJ0nN6T5
- U6VR5CmD1/iQMVtCnwr1/q4AaOeMSQ+2b1tbFfLn
- -----END CERTIFICATE-----
- HiPKI Root CA - G1
- ==================
- -----BEGIN CERTIFICATE-----
- MIIFajCCA1KgAwIBAgIQLd2szmKXlKFD6LDNdmpeYDANBgkqhkiG9w0BAQsFADBPMQswCQYDVQQG
- EwJUVzEjMCEGA1UECgwaQ2h1bmdod2EgVGVsZWNvbSBDby4sIEx0ZC4xGzAZBgNVBAMMEkhpUEtJ
- IFJvb3QgQ0EgLSBHMTAeFw0xOTAyMjIwOTQ2MDRaFw0zNzEyMzExNTU5NTlaME8xCzAJBgNVBAYT
- AlRXMSMwIQYDVQQKDBpDaHVuZ2h3YSBUZWxlY29tIENvLiwgTHRkLjEbMBkGA1UEAwwSSGlQS0kg
- Um9vdCBDQSAtIEcxMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA9B5/UnMyDHPkvRN0
- o9QwqNCuS9i233VHZvR85zkEHmpwINJaR3JnVfSl6J3VHiGh8Ge6zCFovkRTv4354twvVcg3Px+k
- wJyz5HdcoEb+d/oaoDjq7Zpy3iu9lFc6uux55199QmQ5eiY29yTw1S+6lZgRZq2XNdZ1AYDgr/SE
- YYwNHl98h5ZeQa/rh+r4XfEuiAU+TCK72h8q3VJGZDnzQs7ZngyzsHeXZJzA9KMuH5UHsBffMNsA
- GJZMoYFL3QRtU6M9/Aes1MU3guvklQgZKILSQjqj2FPseYlgSGDIcpJQ3AOPgz+yQlda22rpEZfd
- hSi8MEyr48KxRURHH+CKFgeW0iEPU8DtqX7UTuybCeyvQqww1r/REEXgphaypcXTT3OUM3ECoWqj
- 1jOXTyFjHluP2cFeRXF3D4FdXyGarYPM+l7WjSNfGz1BryB1ZlpK9p/7qxj3ccC2HTHsOyDry+K4
- 9a6SsvfhhEvyovKTmiKe0xRvNlS9H15ZFblzqMF8b3ti6RZsR1pl8w4Rm0bZ/W3c1pzAtH2lsN0/
- Vm+h+fbkEkj9Bn8SV7apI09bA8PgcSojt/ewsTu8mL3WmKgMa/aOEmem8rJY5AIJEzypuxC00jBF
- 8ez3ABHfZfjcK0NVvxaXxA/VLGGEqnKG/uY6fsI/fe78LxQ+5oXdUG+3Se0CAwEAAaNCMEAwDwYD
- VR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU8ncX+l6o/vY9cdVouslGDDjYr7AwDgYDVR0PAQH/BAQD
- AgGGMA0GCSqGSIb3DQEBCwUAA4ICAQBQUfB13HAE4/+qddRxosuej6ip0691x1TPOhwEmSKsxBHi
- 7zNKpiMdDg1H2DfHb680f0+BazVP6XKlMeJ45/dOlBhbQH3PayFUhuaVevvGyuqcSE5XCV0vrPSl
- tJczWNWseanMX/mF+lLFjfiRFOs6DRfQUsJ748JzjkZ4Bjgs6FzaZsT0pPBWGTMpWmWSBUdGSquE
- wx4noR8RkpkndZMPvDY7l1ePJlsMu5wP1G4wB9TcXzZoZjmDlicmisjEOf6aIW/Vcobpf2Lll07Q
- JNBAsNB1CI69aO4I1258EHBGG3zgiLKecoaZAeO/n0kZtCW+VmWuF2PlHt/o/0elv+EmBYTksMCv
- 5wiZqAxeJoBF1PhoL5aPruJKHJwWDBNvOIf2u8g0X5IDUXlwpt/L9ZlNec1OvFefQ05rLisY+Gpz
- jLrFNe85akEez3GoorKGB1s6yeHvP2UEgEcyRHCVTjFnanRbEEV16rCf0OY1/k6fi8wrkkVbbiVg
- hUbN0aqwdmaTd5a+g744tiROJgvM7XpWGuDpWsZkrUx6AEhEL7lAuxM+vhV4nYWBSipX3tUZQ9rb
- yltHhoMLP7YNdnhzeSJesYAfz77RP1YQmCuVh6EfnWQUYDksswBVLuT1sw5XxJFBAJw/6KXf6vb/
- yPCtbVKoF6ubYfwSUTXkJf2vqmqGOQ==
- -----END CERTIFICATE-----
- GlobalSign ECC Root CA - R4
- ===========================
- -----BEGIN CERTIFICATE-----
- MIIB3DCCAYOgAwIBAgINAgPlfvU/k/2lCSGypjAKBggqhkjOPQQDAjBQMSQwIgYDVQQLExtHbG9i
- YWxTaWduIEVDQyBSb290IENBIC0gUjQxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkds
- b2JhbFNpZ24wHhcNMTIxMTEzMDAwMDAwWhcNMzgwMTE5MDMxNDA3WjBQMSQwIgYDVQQLExtHbG9i
- YWxTaWduIEVDQyBSb290IENBIC0gUjQxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkds
- b2JhbFNpZ24wWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAS4xnnTj2wlDp8uORkcA6SumuU5BwkW
- ymOxuYb4ilfBV85C+nOh92VC/x7BALJucw7/xyHlGKSq2XE/qNS5zowdo0IwQDAOBgNVHQ8BAf8E
- BAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUVLB7rUW44kB/+wpu+74zyTyjhNUwCgYI
- KoZIzj0EAwIDRwAwRAIgIk90crlgr/HmnKAWBVBfw147bmF0774BxL4YSFlhgjICICadVGNA3jdg
- UM/I2O2dgq43mLyjj0xMqTQrbO/7lZsm
- -----END CERTIFICATE-----
- GTS Root R1
- ===========
- -----BEGIN CERTIFICATE-----
- MIIFVzCCAz+gAwIBAgINAgPlk28xsBNJiGuiFzANBgkqhkiG9w0BAQwFADBHMQswCQYDVQQGEwJV
- UzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3Qg
- UjEwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAwMDAwWjBHMQswCQYDVQQGEwJVUzEiMCAGA1UE
- ChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjEwggIiMA0G
- CSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC2EQKLHuOhd5s73L+UPreVp0A8of2C+X0yBoJx9vaM
- f/vo27xqLpeXo4xL+Sv2sfnOhB2x+cWX3u+58qPpvBKJXqeqUqv4IyfLpLGcY9vXmX7wCl7raKb0
- xlpHDU0QM+NOsROjyBhsS+z8CZDfnWQpJSMHobTSPS5g4M/SCYe7zUjwTcLCeoiKu7rPWRnWr4+w
- B7CeMfGCwcDfLqZtbBkOtdh+JhpFAz2weaSUKK0PfyblqAj+lug8aJRT7oM6iCsVlgmy4HqMLnXW
- nOunVmSPlk9orj2XwoSPwLxAwAtcvfaHszVsrBhQf4TgTM2S0yDpM7xSma8ytSmzJSq0SPly4cpk
- 9+aCEI3oncKKiPo4Zor8Y/kB+Xj9e1x3+naH+uzfsQ55lVe0vSbv1gHR6xYKu44LtcXFilWr06zq
- kUspzBmkMiVOKvFlRNACzqrOSbTqn3yDsEB750Orp2yjj32JgfpMpf/VjsPOS+C12LOORc92wO1A
- K/1TD7Cn1TsNsYqiA94xrcx36m97PtbfkSIS5r762DL8EGMUUXLeXdYWk70paDPvOmbsB4om3xPX
- V2V4J95eSRQAogB/mqghtqmxlbCluQ0WEdrHbEg8QOB+DVrNVjzRlwW5y0vtOUucxD/SVRNuJLDW
- cfr0wbrM7Rv1/oFB2ACYPTrIrnqYNxgFlQIDAQABo0IwQDAOBgNVHQ8BAf8EBAMCAYYwDwYDVR0T
- AQH/BAUwAwEB/zAdBgNVHQ4EFgQU5K8rJnEaK0gnhS9SZizv8IkTcT4wDQYJKoZIhvcNAQEMBQAD
- ggIBAJ+qQibbC5u+/x6Wki4+omVKapi6Ist9wTrYggoGxval3sBOh2Z5ofmmWJyq+bXmYOfg6LEe
- QkEzCzc9zolwFcq1JKjPa7XSQCGYzyI0zzvFIoTgxQ6KfF2I5DUkzps+GlQebtuyh6f88/qBVRRi
- ClmpIgUxPoLW7ttXNLwzldMXG+gnoot7TiYaelpkttGsN/H9oPM47HLwEXWdyzRSjeZ2axfG34ar
- J45JK3VmgRAhpuo+9K4l/3wV3s6MJT/KYnAK9y8JZgfIPxz88NtFMN9iiMG1D53Dn0reWVlHxYci
- NuaCp+0KueIHoI17eko8cdLiA6EfMgfdG+RCzgwARWGAtQsgWSl4vflVy2PFPEz0tv/bal8xa5me
- LMFrUKTX5hgUvYU/Z6tGn6D/Qqc6f1zLXbBwHSs09dR2CQzreExZBfMzQsNhFRAbd03OIozUhfJF
- fbdT6u9AWpQKXCBfTkBdYiJ23//OYb2MI3jSNwLgjt7RETeJ9r/tSQdirpLsQBqvFAnZ0E6yove+
- 7u7Y/9waLd64NnHi/Hm3lCXRSHNboTXns5lndcEZOitHTtNCjv0xyBZm2tIMPNuzjsmhDYAPexZ3
- FL//2wmUspO8IFgV6dtxQ/PeEMMA3KgqlbbC1j+Qa3bbbP6MvPJwNQzcmRk13NfIRmPVNnGuV/u3
- gm3c
- -----END CERTIFICATE-----
- GTS Root R2
- ===========
- -----BEGIN CERTIFICATE-----
- MIIFVzCCAz+gAwIBAgINAgPlrsWNBCUaqxElqjANBgkqhkiG9w0BAQwFADBHMQswCQYDVQQGEwJV
- UzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3Qg
- UjIwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAwMDAwWjBHMQswCQYDVQQGEwJVUzEiMCAGA1UE
- ChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjIwggIiMA0G
- CSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDO3v2m++zsFDQ8BwZabFn3GTXd98GdVarTzTukk3Lv
- CvptnfbwhYBboUhSnznFt+4orO/LdmgUud+tAWyZH8QiHZ/+cnfgLFuv5AS/T3KgGjSY6Dlo7JUl
- e3ah5mm5hRm9iYz+re026nO8/4Piy33B0s5Ks40FnotJk9/BW9BuXvAuMC6C/Pq8tBcKSOWIm8Wb
- a96wyrQD8Nr0kLhlZPdcTK3ofmZemde4wj7I0BOdre7kRXuJVfeKH2JShBKzwkCX44ofR5GmdFrS
- +LFjKBC4swm4VndAoiaYecb+3yXuPuWgf9RhD1FLPD+M2uFwdNjCaKH5wQzpoeJ/u1U8dgbuak7M
- kogwTZq9TwtImoS1mKPV+3PBV2HdKFZ1E66HjucMUQkQdYhMvI35ezzUIkgfKtzra7tEscszcTJG
- r61K8YzodDqs5xoic4DSMPclQsciOzsSrZYuxsN2B6ogtzVJV+mSSeh2FnIxZyuWfoqjx5RWIr9q
- S34BIbIjMt/kmkRtWVtd9QCgHJvGeJeNkP+byKq0rxFROV7Z+2et1VsRnTKaG73VululycslaVNV
- J1zgyjbLiGH7HrfQy+4W+9OmTN6SpdTi3/UGVN4unUu0kzCqgc7dGtxRcw1PcOnlthYhGXmy5okL
- dWTK1au8CcEYof/UVKGFPP0UJAOyh9OktwIDAQABo0IwQDAOBgNVHQ8BAf8EBAMCAYYwDwYDVR0T
- AQH/BAUwAwEB/zAdBgNVHQ4EFgQUu//KjiOfT5nK2+JopqUVJxce2Q4wDQYJKoZIhvcNAQEMBQAD
- ggIBAB/Kzt3HvqGf2SdMC9wXmBFqiN495nFWcrKeGk6c1SuYJF2ba3uwM4IJvd8lRuqYnrYb/oM8
- 0mJhwQTtzuDFycgTE1XnqGOtjHsB/ncw4c5omwX4Eu55MaBBRTUoCnGkJE+M3DyCB19m3H0Q/gxh
- swWV7uGugQ+o+MePTagjAiZrHYNSVc61LwDKgEDg4XSsYPWHgJ2uNmSRXbBoGOqKYcl3qJfEycel
- /FVL8/B/uWU9J2jQzGv6U53hkRrJXRqWbTKH7QMgyALOWr7Z6v2yTcQvG99fevX4i8buMTolUVVn
- jWQye+mew4K6Ki3pHrTgSAai/GevHyICc/sgCq+dVEuhzf9gR7A/Xe8bVr2XIZYtCtFenTgCR2y5
- 9PYjJbigapordwj6xLEokCZYCDzifqrXPW+6MYgKBesntaFJ7qBFVHvmJ2WZICGoo7z7GJa7Um8M
- 7YNRTOlZ4iBgxcJlkoKM8xAfDoqXvneCbT+PHV28SSe9zE8P4c52hgQjxcCMElv924SgJPFI/2R8
- 0L5cFtHvma3AH/vLrrw4IgYmZNralw4/KBVEqE8AyvCazM90arQ+POuV7LXTWtiBmelDGDfrs7vR
- WGJB82bSj6p4lVQgw1oudCvV0b4YacCs1aTPObpRhANl6WLAYv7YTVWW4tAR+kg0Eeye7QUd5MjW
- HYbL
- -----END CERTIFICATE-----
- GTS Root R3
- ===========
- -----BEGIN CERTIFICATE-----
- MIICCTCCAY6gAwIBAgINAgPluILrIPglJ209ZjAKBggqhkjOPQQDAzBHMQswCQYDVQQGEwJVUzEi
- MCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjMw
- HhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAwMDAwWjBHMQswCQYDVQQGEwJVUzEiMCAGA1UEChMZ
- R29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjMwdjAQBgcqhkjO
- PQIBBgUrgQQAIgNiAAQfTzOHMymKoYTey8chWEGJ6ladK0uFxh1MJ7x/JlFyb+Kf1qPKzEUURout
- 736GjOyxfi//qXGdGIRFBEFVbivqJn+7kAHjSxm65FSWRQmx1WyRRK2EE46ajA2ADDL24CejQjBA
- MA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBTB8Sa6oC2uhYHP0/Eq
- Er24Cmf9vDAKBggqhkjOPQQDAwNpADBmAjEA9uEglRR7VKOQFhG/hMjqb2sXnh5GmCCbn9MN2azT
- L818+FsuVbu/3ZL3pAzcMeGiAjEA/JdmZuVDFhOD3cffL74UOO0BzrEXGhF16b0DjyZ+hOXJYKaV
- 11RZt+cRLInUue4X
- -----END CERTIFICATE-----
- GTS Root R4
- ===========
- -----BEGIN CERTIFICATE-----
- MIICCTCCAY6gAwIBAgINAgPlwGjvYxqccpBQUjAKBggqhkjOPQQDAzBHMQswCQYDVQQGEwJVUzEi
- MCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjQw
- HhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAwMDAwWjBHMQswCQYDVQQGEwJVUzEiMCAGA1UEChMZ
- R29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjQwdjAQBgcqhkjO
- PQIBBgUrgQQAIgNiAATzdHOnaItgrkO4NcWBMHtLSZ37wWHO5t5GvWvVYRg1rkDdc/eJkTBa6zzu
- hXyiQHY7qca4R9gq55KRanPpsXI5nymfopjTX15YhmUPoYRlBtHci8nHc8iMai/lxKvRHYqjQjBA
- MA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBSATNbrdP9JNqPV2Py1
- PsVq8JQdjDAKBggqhkjOPQQDAwNpADBmAjEA6ED/g94D9J+uHXqnLrmvT/aDHQ4thQEd0dlq7A/C
- r8deVl5c1RxYIigL9zC2L7F8AjEA8GE8p/SgguMh1YQdc4acLa/KNJvxn7kjNuK8YAOdgLOaVsjh
- 4rsUecrNIdSUtUlD
- -----END CERTIFICATE-----
- Telia Root CA v2
- ================
- -----BEGIN CERTIFICATE-----
- MIIFdDCCA1ygAwIBAgIPAWdfJ9b+euPkrL4JWwWeMA0GCSqGSIb3DQEBCwUAMEQxCzAJBgNVBAYT
- AkZJMRowGAYDVQQKDBFUZWxpYSBGaW5sYW5kIE95ajEZMBcGA1UEAwwQVGVsaWEgUm9vdCBDQSB2
- MjAeFw0xODExMjkxMTU1NTRaFw00MzExMjkxMTU1NTRaMEQxCzAJBgNVBAYTAkZJMRowGAYDVQQK
- DBFUZWxpYSBGaW5sYW5kIE95ajEZMBcGA1UEAwwQVGVsaWEgUm9vdCBDQSB2MjCCAiIwDQYJKoZI
- hvcNAQEBBQADggIPADCCAgoCggIBALLQPwe84nvQa5n44ndp586dpAO8gm2h/oFlH0wnrI4AuhZ7
- 6zBqAMCzdGh+sq/H1WKzej9Qyow2RCRj0jbpDIX2Q3bVTKFgcmfiKDOlyzG4OiIjNLh9vVYiQJ3q
- 9HsDrWj8soFPmNB06o3lfc1jw6P23pLCWBnglrvFxKk9pXSW/q/5iaq9lRdU2HhE8Qx3FZLgmEKn
- pNaqIJLNwaCzlrI6hEKNfdWV5Nbb6WLEWLN5xYzTNTODn3WhUidhOPFZPY5Q4L15POdslv5e2QJl
- tI5c0BE0312/UqeBAMN/mUWZFdUXyApT7GPzmX3MaRKGwhfwAZ6/hLzRUssbkmbOpFPlob/E2wnW
- 5olWK8jjfN7j/4nlNW4o6GwLI1GpJQXrSPjdscr6bAhR77cYbETKJuFzxokGgeWKrLDiKca5JLNr
- RBH0pUPCTEPlcDaMtjNXepUugqD0XBCzYYP2AgWGLnwtbNwDRm41k9V6lS/eINhbfpSQBGq6WT0E
- BXWdN6IOLj3rwaRSg/7Qa9RmjtzG6RJOHSpXqhC8fF6CfaamyfItufUXJ63RDolUK5X6wK0dmBR4
- M0KGCqlztft0DbcbMBnEWg4cJ7faGND/isgFuvGqHKI3t+ZIpEYslOqodmJHixBTB0hXbOKSTbau
- BcvcwUpej6w9GU7C7WB1K9vBykLVAgMBAAGjYzBhMB8GA1UdIwQYMBaAFHKs5DN5qkWH9v2sHZ7W
- xy+G2CQ5MB0GA1UdDgQWBBRyrOQzeapFh/b9rB2e1scvhtgkOTAOBgNVHQ8BAf8EBAMCAQYwDwYD
- VR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAgEAoDtZpwmUPjaE0n4vOaWWl/oRrfxn83EJ
- 8rKJhGdEr7nv7ZbsnGTbMjBvZ5qsfl+yqwE2foH65IRe0qw24GtixX1LDoJt0nZi0f6X+J8wfBj5
- tFJ3gh1229MdqfDBmgC9bXXYfef6xzijnHDoRnkDry5023X4blMMA8iZGok1GTzTyVR8qPAs5m4H
- eW9q4ebqkYJpCh3DflminmtGFZhb069GHWLIzoBSSRE/yQQSwxN8PzuKlts8oB4KtItUsiRnDe+C
- y748fdHif64W1lZYudogsYMVoe+KTTJvQS8TUoKU1xrBeKJR3Stwbbca+few4GeXVtt8YVMJAygC
- QMez2P2ccGrGKMOF6eLtGpOg3kuYooQ+BXcBlj37tCAPnHICehIv1aO6UXivKitEZU61/Qrowc15
- h2Er3oBXRb9n8ZuRXqWk7FlIEA04x7D6w0RtBPV4UBySllva9bguulvP5fBqnUsvWHMtTy3EHD70
- sz+rFQ47GUGKpMFXEmZxTPpT41frYpUJnlTd0cI8Vzy9OK2YZLe4A5pTVmBds9hCG1xLEooc6+t9
- xnppxyd/pPiL8uSUZodL6ZQHCRJ5irLrdATczvREWeAWysUsWNc8e89ihmpQfTU2Zqf7N+cox9jQ
- raVplI/owd8k+BsHMYeB2F326CjYSlKArBPuUBQemMc=
- -----END CERTIFICATE-----
- D-TRUST BR Root CA 1 2020
- =========================
- -----BEGIN CERTIFICATE-----
- MIIC2zCCAmCgAwIBAgIQfMmPK4TX3+oPyWWa00tNljAKBggqhkjOPQQDAzBIMQswCQYDVQQGEwJE
- RTEVMBMGA1UEChMMRC1UcnVzdCBHbWJIMSIwIAYDVQQDExlELVRSVVNUIEJSIFJvb3QgQ0EgMSAy
- MDIwMB4XDTIwMDIxMTA5NDUwMFoXDTM1MDIxMTA5NDQ1OVowSDELMAkGA1UEBhMCREUxFTATBgNV
- BAoTDEQtVHJ1c3QgR21iSDEiMCAGA1UEAxMZRC1UUlVTVCBCUiBSb290IENBIDEgMjAyMDB2MBAG
- ByqGSM49AgEGBSuBBAAiA2IABMbLxyjR+4T1mu9CFCDhQ2tuda38KwOE1HaTJddZO0Flax7mNCq7
- dPYSzuht56vkPE4/RAiLzRZxy7+SmfSk1zxQVFKQhYN4lGdnoxwJGT11NIXe7WB9xwy0QVK5buXu
- QqOCAQ0wggEJMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFHOREKv/VbNafAkl1bK6CKBrqx9t
- MA4GA1UdDwEB/wQEAwIBBjCBxgYDVR0fBIG+MIG7MD6gPKA6hjhodHRwOi8vY3JsLmQtdHJ1c3Qu
- bmV0L2NybC9kLXRydXN0X2JyX3Jvb3RfY2FfMV8yMDIwLmNybDB5oHegdYZzbGRhcDovL2RpcmVj
- dG9yeS5kLXRydXN0Lm5ldC9DTj1ELVRSVVNUJTIwQlIlMjBSb290JTIwQ0ElMjAxJTIwMjAyMCxP
- PUQtVHJ1c3QlMjBHbWJILEM9REU/Y2VydGlmaWNhdGVyZXZvY2F0aW9ubGlzdDAKBggqhkjOPQQD
- AwNpADBmAjEAlJAtE/rhY/hhY+ithXhUkZy4kzg+GkHaQBZTQgjKL47xPoFWwKrY7RjEsK70Pvom
- AjEA8yjixtsrmfu3Ubgko6SUeho/5jbiA1czijDLgsfWFBHVdWNbFJWcHwHP2NVypw87
- -----END CERTIFICATE-----
- D-TRUST EV Root CA 1 2020
- =========================
- -----BEGIN CERTIFICATE-----
- MIIC2zCCAmCgAwIBAgIQXwJB13qHfEwDo6yWjfv/0DAKBggqhkjOPQQDAzBIMQswCQYDVQQGEwJE
- RTEVMBMGA1UEChMMRC1UcnVzdCBHbWJIMSIwIAYDVQQDExlELVRSVVNUIEVWIFJvb3QgQ0EgMSAy
- MDIwMB4XDTIwMDIxMTEwMDAwMFoXDTM1MDIxMTA5NTk1OVowSDELMAkGA1UEBhMCREUxFTATBgNV
- BAoTDEQtVHJ1c3QgR21iSDEiMCAGA1UEAxMZRC1UUlVTVCBFViBSb290IENBIDEgMjAyMDB2MBAG
- ByqGSM49AgEGBSuBBAAiA2IABPEL3YZDIBnfl4XoIkqbz52Yv7QFJsnL46bSj8WeeHsxiamJrSc8
- ZRCC/N/DnU7wMyPE0jL1HLDfMxddxfCxivnvubcUyilKwg+pf3VlSSowZ/Rk99Yad9rDwpdhQntJ
- raOCAQ0wggEJMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFH8QARY3OqQo5FD4pPfsazK2/umL
- MA4GA1UdDwEB/wQEAwIBBjCBxgYDVR0fBIG+MIG7MD6gPKA6hjhodHRwOi8vY3JsLmQtdHJ1c3Qu
- bmV0L2NybC9kLXRydXN0X2V2X3Jvb3RfY2FfMV8yMDIwLmNybDB5oHegdYZzbGRhcDovL2RpcmVj
- dG9yeS5kLXRydXN0Lm5ldC9DTj1ELVRSVVNUJTIwRVYlMjBSb290JTIwQ0ElMjAxJTIwMjAyMCxP
- PUQtVHJ1c3QlMjBHbWJILEM9REU/Y2VydGlmaWNhdGVyZXZvY2F0aW9ubGlzdDAKBggqhkjOPQQD
- AwNpADBmAjEAyjzGKnXCXnViOTYAYFqLwZOZzNnbQTs7h5kXO9XMT8oi96CAy/m0sRtW9XLS/BnR
- AjEAkfcwkz8QRitxpNA7RJvAKQIFskF3UfN5Wp6OFKBOQtJbgfM0agPnIjhQW+0ZT0MW
- -----END CERTIFICATE-----
- DigiCert TLS ECC P384 Root G5
- =============================
- -----BEGIN CERTIFICATE-----
- MIICGTCCAZ+gAwIBAgIQCeCTZaz32ci5PhwLBCou8zAKBggqhkjOPQQDAzBOMQswCQYDVQQGEwJV
- UzEXMBUGA1UEChMORGlnaUNlcnQsIEluYy4xJjAkBgNVBAMTHURpZ2lDZXJ0IFRMUyBFQ0MgUDM4
- NCBSb290IEc1MB4XDTIxMDExNTAwMDAwMFoXDTQ2MDExNDIzNTk1OVowTjELMAkGA1UEBhMCVVMx
- FzAVBgNVBAoTDkRpZ2lDZXJ0LCBJbmMuMSYwJAYDVQQDEx1EaWdpQ2VydCBUTFMgRUNDIFAzODQg
- Um9vdCBHNTB2MBAGByqGSM49AgEGBSuBBAAiA2IABMFEoc8Rl1Ca3iOCNQfN0MsYndLxf3c1Tzvd
- lHJS7cI7+Oz6e2tYIOyZrsn8aLN1udsJ7MgT9U7GCh1mMEy7H0cKPGEQQil8pQgO4CLp0zVozptj
- n4S1mU1YoI71VOeVyaNCMEAwHQYDVR0OBBYEFMFRRVBZqz7nLFr6ICISB4CIfBFqMA4GA1UdDwEB
- /wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MAoGCCqGSM49BAMDA2gAMGUCMQCJao1H5+z8blUD2Wds
- Jk6Dxv3J+ysTvLd6jLRl0mlpYxNjOyZQLgGheQaRnUi/wr4CMEfDFXuxoJGZSZOoPHzoRgaLLPIx
- AJSdYsiJvRmEFOml+wG4DXZDjC5Ty3zfDBeWUA==
- -----END CERTIFICATE-----
- DigiCert TLS RSA4096 Root G5
- ============================
- -----BEGIN CERTIFICATE-----
- MIIFZjCCA06gAwIBAgIQCPm0eKj6ftpqMzeJ3nzPijANBgkqhkiG9w0BAQwFADBNMQswCQYDVQQG
- EwJVUzEXMBUGA1UEChMORGlnaUNlcnQsIEluYy4xJTAjBgNVBAMTHERpZ2lDZXJ0IFRMUyBSU0E0
- MDk2IFJvb3QgRzUwHhcNMjEwMTE1MDAwMDAwWhcNNDYwMTE0MjM1OTU5WjBNMQswCQYDVQQGEwJV
- UzEXMBUGA1UEChMORGlnaUNlcnQsIEluYy4xJTAjBgNVBAMTHERpZ2lDZXJ0IFRMUyBSU0E0MDk2
- IFJvb3QgRzUwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCz0PTJeRGd/fxmgefM1eS8
- 7IE+ajWOLrfn3q/5B03PMJ3qCQuZvWxX2hhKuHisOjmopkisLnLlvevxGs3npAOpPxG02C+JFvuU
- AT27L/gTBaF4HI4o4EXgg/RZG5Wzrn4DReW+wkL+7vI8toUTmDKdFqgpwgscONyfMXdcvyej/Ces
- tyu9dJsXLfKB2l2w4SMXPohKEiPQ6s+d3gMXsUJKoBZMpG2T6T867jp8nVid9E6P/DsjyG244gXa
- zOvswzH016cpVIDPRFtMbzCe88zdH5RDnU1/cHAN1DrRN/BsnZvAFJNY781BOHW8EwOVfH/jXOnV
- DdXifBBiqmvwPXbzP6PosMH976pXTayGpxi0KcEsDr9kvimM2AItzVwv8n/vFfQMFawKsPHTDU9q
- TXeXAaDxZre3zu/O7Oyldcqs4+Fj97ihBMi8ez9dLRYiVu1ISf6nL3kwJZu6ay0/nTvEF+cdLvvy
- z6b84xQslpghjLSR6Rlgg/IwKwZzUNWYOwbpx4oMYIwo+FKbbuH2TbsGJJvXKyY//SovcfXWJL5/
- MZ4PbeiPT02jP/816t9JXkGPhvnxd3lLG7SjXi/7RgLQZhNeXoVPzthwiHvOAbWWl9fNff2C+MIk
- wcoBOU+NosEUQB+cZtUMCUbW8tDRSHZWOkPLtgoRObqME2wGtZ7P6wIDAQABo0IwQDAdBgNVHQ4E
- FgQUUTMc7TZArxfTJc1paPKvTiM+s0EwDgYDVR0PAQH/BAQDAgGGMA8GA1UdEwEB/wQFMAMBAf8w
- DQYJKoZIhvcNAQEMBQADggIBAGCmr1tfV9qJ20tQqcQjNSH/0GEwhJG3PxDPJY7Jv0Y02cEhJhxw
- GXIeo8mH/qlDZJY6yFMECrZBu8RHANmfGBg7sg7zNOok992vIGCukihfNudd5N7HPNtQOa27PShN
- lnx2xlv0wdsUpasZYgcYQF+Xkdycx6u1UQ3maVNVzDl92sURVXLFO4uJ+DQtpBflF+aZfTCIITfN
- MBc9uPK8qHWgQ9w+iUuQrm0D4ByjoJYJu32jtyoQREtGBzRj7TG5BO6jm5qu5jF49OokYTurWGT/
- u4cnYiWB39yhL/btp/96j1EuMPikAdKFOV8BmZZvWltwGUb+hmA+rYAQCd05JS9Yf7vSdPD3Rh9G
- OUrYU9DzLjtxpdRv/PNn5AeP3SYZ4Y1b+qOTEZvpyDrDVWiakuFSdjjo4bq9+0/V77PnSIMx8IIh
- 47a+p6tv75/fTM8BuGJqIz3nCU2AG3swpMPdB380vqQmsvZB6Akd4yCYqjdP//fx4ilwMUc/dNAU
- FvohigLVigmUdy7yWSiLfFCSCmZ4OIN1xLVaqBHG5cGdZlXPU8Sv13WFqUITVuwhd4GTWgzqltlJ
- yqEI8pc7bZsEGCREjnwB8twl2F6GmrE52/WRMmrRpnCKovfepEWFJqgejF0pW8hL2JpqA15w8oVP
- bEtoL8pU9ozaMv7Da4M/OMZ+
- -----END CERTIFICATE-----
- Certainly Root R1
- =================
- -----BEGIN CERTIFICATE-----
- MIIFRzCCAy+gAwIBAgIRAI4P+UuQcWhlM1T01EQ5t+AwDQYJKoZIhvcNAQELBQAwPTELMAkGA1UE
- BhMCVVMxEjAQBgNVBAoTCUNlcnRhaW5seTEaMBgGA1UEAxMRQ2VydGFpbmx5IFJvb3QgUjEwHhcN
- MjEwNDAxMDAwMDAwWhcNNDYwNDAxMDAwMDAwWjA9MQswCQYDVQQGEwJVUzESMBAGA1UEChMJQ2Vy
- dGFpbmx5MRowGAYDVQQDExFDZXJ0YWlubHkgUm9vdCBSMTCCAiIwDQYJKoZIhvcNAQEBBQADggIP
- ADCCAgoCggIBANA21B/q3avk0bbm+yLA3RMNansiExyXPGhjZjKcA7WNpIGD2ngwEc/csiu+kr+O
- 5MQTvqRoTNoCaBZ0vrLdBORrKt03H2As2/X3oXyVtwxwhi7xOu9S98zTm/mLvg7fMbedaFySpvXl
- 8wo0tf97ouSHocavFwDvA5HtqRxOcT3Si2yJ9HiG5mpJoM610rCrm/b01C7jcvk2xusVtyWMOvwl
- DbMicyF0yEqWYZL1LwsYpfSt4u5BvQF5+paMjRcCMLT5r3gajLQ2EBAHBXDQ9DGQilHFhiZ5shGI
- XsXwClTNSaa/ApzSRKft43jvRl5tcdF5cBxGX1HpyTfcX35pe0HfNEXgO4T0oYoKNp43zGJS4YkN
- KPl6I7ENPT2a/Z2B7yyQwHtETrtJ4A5KVpK8y7XdeReJkd5hiXSSqOMyhb5OhaRLWcsrxXiOcVTQ
- AjeZjOVJ6uBUcqQRBi8LjMFbvrWhsFNunLhgkR9Za/kt9JQKl7XsxXYDVBtlUrpMklZRNaBA2Cnb
- rlJ2Oy0wQJuK0EJWtLeIAaSHO1OWzaMWj/Nmqhexx2DgwUMFDO6bW2BvBlyHWyf5QBGenDPBt+U1
- VwV/J84XIIwc/PH72jEpSe31C4SnT8H2TsIonPru4K8H+zMReiFPCyEQtkA6qyI6BJyLm4SGcprS
- p6XEtHWRqSsjAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1Ud
- DgQWBBTgqj8ljZ9EXME66C6ud0yEPmcM9DANBgkqhkiG9w0BAQsFAAOCAgEAuVevuBLaV4OPaAsz
- HQNTVfSVcOQrPbA56/qJYv331hgELyE03fFo8NWWWt7CgKPBjcZq91l3rhVkz1t5BXdm6ozTaw3d
- 8VkswTOlMIAVRQdFGjEitpIAq5lNOo93r6kiyi9jyhXWx8bwPWz8HA2YEGGeEaIi1wrykXprOQ4v
- MMM2SZ/g6Q8CRFA3lFV96p/2O7qUpUzpvD5RtOjKkjZUbVwlKNrdrRT90+7iIgXr0PK3aBLXWopB
- GsaSpVo7Y0VPv+E6dyIvXL9G+VoDhRNCX8reU9ditaY1BMJH/5n9hN9czulegChB8n3nHpDYT3Y+
- gjwN/KUD+nsa2UUeYNrEjvn8K8l7lcUq/6qJ34IxD3L/DCfXCh5WAFAeDJDBlrXYFIW7pw0WwfgH
- JBu6haEaBQmAupVjyTrsJZ9/nbqkRxWbRHDxakvWOF5D8xh+UG7pWijmZeZ3Gzr9Hb4DJqPb1OG7
- fpYnKx3upPvaJVQTA945xsMfTZDsjxtK0hzthZU4UHlG1sGQUDGpXJpuHfUzVounmdLyyCwzk5Iw
- x06MZTMQZBf9JBeW0Y3COmor6xOLRPIh80oat3df1+2IpHLlOR+Vnb5nwXARPbv0+Em34yaXOp/S
- X3z7wJl8OSngex2/DaeP0ik0biQVy96QXr8axGbqwua6OV+KmalBWQewLK8=
- -----END CERTIFICATE-----
- Certainly Root E1
- =================
- -----BEGIN CERTIFICATE-----
- MIIB9zCCAX2gAwIBAgIQBiUzsUcDMydc+Y2aub/M+DAKBggqhkjOPQQDAzA9MQswCQYDVQQGEwJV
- UzESMBAGA1UEChMJQ2VydGFpbmx5MRowGAYDVQQDExFDZXJ0YWlubHkgUm9vdCBFMTAeFw0yMTA0
- MDEwMDAwMDBaFw00NjA0MDEwMDAwMDBaMD0xCzAJBgNVBAYTAlVTMRIwEAYDVQQKEwlDZXJ0YWlu
- bHkxGjAYBgNVBAMTEUNlcnRhaW5seSBSb290IEUxMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAE3m/4
- fxzf7flHh4axpMCK+IKXgOqPyEpeKn2IaKcBYhSRJHpcnqMXfYqGITQYUBsQ3tA3SybHGWCA6TS9
- YBk2QNYphwk8kXr2vBMj3VlOBF7PyAIcGFPBMdjaIOlEjeR2o0IwQDAOBgNVHQ8BAf8EBAMCAQYw
- DwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU8ygYy2R17ikq6+2uI1g4hevIIgcwCgYIKoZIzj0E
- AwMDaAAwZQIxALGOWiDDshliTd6wT99u0nCK8Z9+aozmut6Dacpps6kFtZaSF4fC0urQe87YQVt8
- rgIwRt7qy12a7DLCZRawTDBcMPPaTnOGBtjOiQRINzf43TNRnXCve1XYAS59BWQOhriR
- -----END CERTIFICATE-----
- E-Tugra Global Root CA RSA v3
- =============================
- -----BEGIN CERTIFICATE-----
- MIIF8zCCA9ugAwIBAgIUDU3FzRYilZYIfrgLfxUGNPt5EDQwDQYJKoZIhvcNAQELBQAwgYAxCzAJ
- BgNVBAYTAlRSMQ8wDQYDVQQHEwZBbmthcmExGTAXBgNVBAoTEEUtVHVncmEgRUJHIEEuUy4xHTAb
- BgNVBAsTFEUtVHVncmEgVHJ1c3QgQ2VudGVyMSYwJAYDVQQDEx1FLVR1Z3JhIEdsb2JhbCBSb290
- IENBIFJTQSB2MzAeFw0yMDAzMTgwOTA3MTdaFw00NTAzMTIwOTA3MTdaMIGAMQswCQYDVQQGEwJU
- UjEPMA0GA1UEBxMGQW5rYXJhMRkwFwYDVQQKExBFLVR1Z3JhIEVCRyBBLlMuMR0wGwYDVQQLExRF
- LVR1Z3JhIFRydXN0IENlbnRlcjEmMCQGA1UEAxMdRS1UdWdyYSBHbG9iYWwgUm9vdCBDQSBSU0Eg
- djMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCiZvCJt3J77gnJY9LTQ91ew6aEOErx
- jYG7FL1H6EAX8z3DeEVypi6Q3po61CBxyryfHUuXCscxuj7X/iWpKo429NEvx7epXTPcMHD4QGxL
- sqYxYdE0PD0xesevxKenhOGXpOhL9hd87jwH7eKKV9y2+/hDJVDqJ4GohryPUkqWOmAalrv9c/SF
- /YP9f4RtNGx/ardLAQO/rWm31zLZ9Vdq6YaCPqVmMbMWPcLzJmAy01IesGykNz709a/r4d+ABs8q
- QedmCeFLl+d3vSFtKbZnwy1+7dZ5ZdHPOrbRsV5WYVB6Ws5OUDGAA5hH5+QYfERaxqSzO8bGwzrw
- bMOLyKSRBfP12baqBqG3q+Sx6iEUXIOk/P+2UNOMEiaZdnDpwA+mdPy70Bt4znKS4iicvObpCdg6
- 04nmvi533wEKb5b25Y08TVJ2Glbhc34XrD2tbKNSEhhw5oBOM/J+JjKsBY04pOZ2PJ8QaQ5tndLB
- eSBrW88zjdGUdjXnXVXHt6woq0bM5zshtQoK5EpZ3IE1S0SVEgpnpaH/WwAH0sDM+T/8nzPyAPiM
- bIedBi3x7+PmBvrFZhNb/FAHnnGGstpvdDDPk1Po3CLW3iAfYY2jLqN4MpBs3KwytQXk9TwzDdbg
- h3cXTJ2w2AmoDVf3RIXwyAS+XF1a4xeOVGNpf0l0ZAWMowIDAQABo2MwYTAPBgNVHRMBAf8EBTAD
- AQH/MB8GA1UdIwQYMBaAFLK0ruYt9ybVqnUtdkvAG1Mh0EjvMB0GA1UdDgQWBBSytK7mLfcm1ap1
- LXZLwBtTIdBI7zAOBgNVHQ8BAf8EBAMCAQYwDQYJKoZIhvcNAQELBQADggIBAImocn+M684uGMQQ
- gC0QDP/7FM0E4BQ8Tpr7nym/Ip5XuYJzEmMmtcyQ6dIqKe6cLcwsmb5FJ+Sxce3kOJUxQfJ9emN4
- 38o2Fi+CiJ+8EUdPdk3ILY7r3y18Tjvarvbj2l0Upq7ohUSdBm6O++96SmotKygY/r+QLHUWnw/q
- ln0F7psTpURs+APQ3SPh/QMSEgj0GDSz4DcLdxEBSL9htLX4GdnLTeqjjO/98Aa1bZL0SmFQhO3s
- SdPkvmjmLuMxC1QLGpLWgti2omU8ZgT5Vdps+9u1FGZNlIM7zR6mK7L+d0CGq+ffCsn99t2HVhjY
- sCxVYJb6CH5SkPVLpi6HfMsg2wY+oF0Dd32iPBMbKaITVaA9FCKvb7jQmhty3QUBjYZgv6Rn7rWl
- DdF/5horYmbDB7rnoEgcOMPpRfunf/ztAmgayncSd6YAVSgU7NbHEqIbZULpkejLPoeJVF3Zr52X
- nGnnCv8PWniLYypMfUeUP95L6VPQMPHF9p5J3zugkaOj/s1YzOrfr28oO6Bpm4/srK4rVJ2bBLFH
- IK+WEj5jlB0E5y67hscMmoi/dkfv97ALl2bSRM9gUgfh1SxKOidhd8rXj+eHDjD/DLsE4mHDosiX
- YY60MGo8bcIHX0pzLz/5FooBZu+6kcpSV3uu1OYP3Qt6f4ueJiDPO++BcYNZ
- -----END CERTIFICATE-----
- E-Tugra Global Root CA ECC v3
- =============================
- -----BEGIN CERTIFICATE-----
- MIICpTCCAiqgAwIBAgIUJkYZdzHhT28oNt45UYbm1JeIIsEwCgYIKoZIzj0EAwMwgYAxCzAJBgNV
- BAYTAlRSMQ8wDQYDVQQHEwZBbmthcmExGTAXBgNVBAoTEEUtVHVncmEgRUJHIEEuUy4xHTAbBgNV
- BAsTFEUtVHVncmEgVHJ1c3QgQ2VudGVyMSYwJAYDVQQDEx1FLVR1Z3JhIEdsb2JhbCBSb290IENB
- IEVDQyB2MzAeFw0yMDAzMTgwOTQ2NThaFw00NTAzMTIwOTQ2NThaMIGAMQswCQYDVQQGEwJUUjEP
- MA0GA1UEBxMGQW5rYXJhMRkwFwYDVQQKExBFLVR1Z3JhIEVCRyBBLlMuMR0wGwYDVQQLExRFLVR1
- Z3JhIFRydXN0IENlbnRlcjEmMCQGA1UEAxMdRS1UdWdyYSBHbG9iYWwgUm9vdCBDQSBFQ0MgdjMw
- djAQBgcqhkjOPQIBBgUrgQQAIgNiAASOmCm/xxAeJ9urA8woLNheSBkQKczLWYHMjLiSF4mDKpL2
- w6QdTGLVn9agRtwcvHbB40fQWxPa56WzZkjnIZpKT4YKfWzqTTKACrJ6CZtpS5iB4i7sAnCWH/31
- Rs7K3IKjYzBhMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAU/4Ixcj75xGZsrTie0bBRiKWQ
- zPUwHQYDVR0OBBYEFP+CMXI++cRmbK04ntGwUYilkMz1MA4GA1UdDwEB/wQEAwIBBjAKBggqhkjO
- PQQDAwNpADBmAjEA5gVYaWHlLcoNy/EZCL3W/VGSGn5jVASQkZo1kTmZ+gepZpO6yGjUij/67W4W
- Aie3AjEA3VoXK3YdZUKWpqxdinlW2Iob35reX8dQj7FbcQwm32pAAOwzkSFxvmjkI6TZraE3
- -----END CERTIFICATE-----
- <?php
- namespace Composer\CaBundle;
- use Psr\Log\LoggerInterface;
- use Symfony\Component\Process\PhpProcess;
- class CaBundle
- {
- private static $caPath;
- private static $caFileValidity = array();
- private static $useOpensslParse;
- public static function getSystemCaRootBundlePath(LoggerInterface $logger = null)
- {
- if (self::$caPath !== null) {
- return self::$caPath;
- }
- $caBundlePaths = array();
- $caBundlePaths[] = self::getEnvVariable('SSL_CERT_FILE');
- $caBundlePaths[] = self::getEnvVariable('SSL_CERT_DIR');
- $caBundlePaths[] = ini_get('openssl.cafile');
- $caBundlePaths[] = ini_get('openssl.capath');
- $otherLocations = array(
- '/etc/pki/tls/certs/ca-bundle.crt',
- '/etc/ssl/certs/ca-certificates.crt',
- '/etc/ssl/ca-bundle.pem',
- '/usr/local/share/certs/ca-root-nss.crt',
- '/usr/ssl/certs/ca-bundle.crt',
- '/opt/local/share/curl/curl-ca-bundle.crt',
- '/usr/local/share/curl/curl-ca-bundle.crt',
- '/usr/share/ssl/certs/ca-bundle.crt',
- '/etc/ssl/cert.pem',
- '/usr/local/etc/ssl/cert.pem',
- '/usr/local/etc/openssl/cert.pem',
- '/usr/local/etc/openssl@1.1/cert.pem',
- );
- foreach($otherLocations as $location) {
- $otherLocations[] = dirname($location);
- }
- $caBundlePaths = array_merge($caBundlePaths, $otherLocations);
- foreach ($caBundlePaths as $caBundle) {
- if ($caBundle && self::caFileUsable($caBundle, $logger)) {
- return self::$caPath = $caBundle;
- }
- if ($caBundle && self::caDirUsable($caBundle, $logger)) {
- return self::$caPath = $caBundle;
- }
- }
- return self::$caPath = static::getBundledCaBundlePath();
- }
- public static function getBundledCaBundlePath()
- {
- $caBundleFile = __DIR__.'/../res/cacert.pem';
- if (0 === strpos($caBundleFile, 'phar://')) {
- $tempCaBundleFile = tempnam(sys_get_temp_dir(), 'openssl-ca-bundle-');
- if (false === $tempCaBundleFile) {
- throw new \RuntimeException('Could not create a temporary file to store the bundled CA file');
- }
- file_put_contents(
- $tempCaBundleFile,
- file_get_contents($caBundleFile)
- );
- register_shutdown_function(function() use ($tempCaBundleFile) {
- @unlink($tempCaBundleFile);
- });
- $caBundleFile = $tempCaBundleFile;
- }
- return $caBundleFile;
- }
- public static function validateCaFile($filename, LoggerInterface $logger = null)
- {
- static $warned = false;
- if (isset(self::$caFileValidity[$filename])) {
- return self::$caFileValidity[$filename];
- }
- $contents = file_get_contents($filename);
- if (!static::isOpensslParseSafe()) {
- if (!$warned && $logger) {
- $logger->warning(sprintf(
- 'Your version of PHP, %s, is affected by CVE-2013-6420 and cannot safely perform certificate validation, we strongly suggest you upgrade.',
- PHP_VERSION
- ));
- $warned = true;
- }
- $isValid = !empty($contents);
- } elseif (is_string($contents) && strlen($contents) > 0) {
- $contents = preg_replace("/^(\\-+(?:BEGIN|END))\\s+TRUSTED\\s+(CERTIFICATE\\-+)\$/m", '$1 $2', $contents);
- if (null === $contents) {
- $isValid = false;
- } else {
- $isValid = (bool) openssl_x509_parse($contents);
- }
- } else {
- $isValid = false;
- }
- if ($logger) {
- $logger->debug('Checked CA file '.realpath($filename).': '.($isValid ? 'valid' : 'invalid'));
- }
- return self::$caFileValidity[$filename] = $isValid;
- }
- public static function isOpensslParseSafe()
- {
- if (null !== self::$useOpensslParse) {
- return self::$useOpensslParse;
- }
- if (PHP_VERSION_ID >= 50600) {
- return self::$useOpensslParse = true;
- }
- if (
- (PHP_VERSION_ID < 50400 && PHP_VERSION_ID >= 50328)
- || (PHP_VERSION_ID < 50500 && PHP_VERSION_ID >= 50423)
- || PHP_VERSION_ID >= 50507
- ) {
- return self::$useOpensslParse = true;
- }
- if (defined('PHP_WINDOWS_VERSION_BUILD')) {
- return self::$useOpensslParse = false;
- }
- $compareDistroVersionPrefix = function ($prefix, $fixedVersion) {
- $regex = '{^'.preg_quote($prefix).'([0-9]+)$}';
- if (preg_match($regex, PHP_VERSION, $m)) {
- return ((int) $m[1]) >= $fixedVersion;
- }
- return false;
- };
- if (
- $compareDistroVersionPrefix('5.3.3-7+squeeze', 18)
- || $compareDistroVersionPrefix('5.4.4-14+deb7u', 7)
- || $compareDistroVersionPrefix('5.3.10-1ubuntu3.', 9)
- ) {
- return self::$useOpensslParse = true;
- }
- if (!class_exists('Symfony\Component\Process\PhpProcess')) {
- return self::$useOpensslParse = false;
- }
- $cert = 'LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUVwRENDQTR5Z0F3SUJBZ0lKQUp6dThyNnU2ZUJjTUEwR0NTcUdTSWIzRFFFQkJRVUFNSUhETVFzd0NRWUQKVlFRR0V3SkVSVEVjTUJvR0ExVUVDQXdUVG05eVpISm9aV2x1TFZkbGMzUm1ZV3hsYmpFUU1BNEdBMVVFQnd3SApTOE9Ed3Jac2JqRVVNQklHQTFVRUNnd0xVMlZyZEdsdmJrVnBibk14SHpBZEJnTlZCQXNNRmsxaGJHbGphVzkxCmN5QkRaWEowSUZObFkzUnBiMjR4SVRBZkJnTlZCQU1NR0cxaGJHbGphVzkxY3k1elpXdDBhVzl1WldsdWN5NWsKWlRFcU1DZ0dDU3FHU0liM0RRRUpBUlliYzNSbFptRnVMbVZ6YzJWeVFITmxhM1JwYjI1bGFXNXpMbVJsTUhVWQpaREU1TnpBd01UQXhNREF3TURBd1dnQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBCkFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUEKQUFBQUFBQVhEVEUwTVRFeU9ERXhNemt6TlZvd2djTXhDekFKQmdOVkJBWVRBa1JGTVJ3d0dnWURWUVFJREJOTwpiM0prY21obGFXNHRWMlZ6ZEdaaGJHVnVNUkF3RGdZRFZRUUhEQWRMdzRQQ3RteHVNUlF3RWdZRFZRUUtEQXRUClpXdDBhVzl1UldsdWN6RWZNQjBHQTFVRUN3d1dUV0ZzYVdOcGIzVnpJRU5sY25RZ1UyVmpkR2x2YmpFaE1COEcKQTFVRUF3d1liV0ZzYVdOcGIzVnpMbk5sYTNScGIyNWxhVzV6TG1SbE1Tb3dLQVlKS29aSWh2Y05BUWtCRmh0egpkR1ZtWVc0dVpYTnpaWEpBYzJWcmRHbHZibVZwYm5NdVpHVXdnZ0VpTUEwR0NTcUdTSWIzRFFFQkFRVUFBNElCCkR3QXdnZ0VLQW9JQkFRRERBZjNobDdKWTBYY0ZuaXlFSnBTU0RxbjBPcUJyNlFQNjV1c0pQUnQvOFBhRG9xQnUKd0VZVC9OYSs2ZnNnUGpDMHVLOURaZ1dnMnRIV1dvYW5TYmxBTW96NVBINlorUzRTSFJaN2UyZERJalBqZGhqaAowbUxnMlVNTzV5cDBWNzk3R2dzOWxOdDZKUmZIODFNTjJvYlhXczROdHp0TE11RDZlZ3FwcjhkRGJyMzRhT3M4CnBrZHVpNVVhd1Raa3N5NXBMUEhxNWNNaEZHbTA2djY1Q0xvMFYyUGQ5K0tBb2tQclBjTjVLTEtlYno3bUxwazYKU01lRVhPS1A0aWRFcXh5UTdPN2ZCdUhNZWRzUWh1K3ByWTNzaTNCVXlLZlF0UDVDWm5YMmJwMHdLSHhYMTJEWAoxbmZGSXQ5RGJHdkhUY3lPdU4rblpMUEJtM3ZXeG50eUlJdlZBZ01CQUFHalFqQkFNQWtHQTFVZEV3UUNNQUF3CkVRWUpZSVpJQVliNFFnRUJCQVFEQWdlQU1Bc0dBMVVkRHdRRUF3SUZvREFUQmdOVkhTVUVEREFLQmdnckJnRUYKQlFjREFqQU5CZ2txaGtpRzl3MEJBUVVGQUFPQ0FRRUFHMGZaWVlDVGJkajFYWWMrMVNub2FQUit2SThDOENhRAo4KzBVWWhkbnlVNGdnYTBCQWNEclk5ZTk0ZUVBdTZacXljRjZGakxxWFhkQWJvcHBXb2NyNlQ2R0QxeDMzQ2tsClZBcnpHL0t4UW9oR0QySmVxa2hJTWxEb214SE83a2EzOStPYThpMnZXTFZ5alU4QVp2V01BcnVIYTRFRU55RzcKbFcyQWFnYUZLRkNyOVRuWFRmcmR4R1ZFYnY3S1ZRNmJkaGc1cDVTanBXSDErTXEwM3VSM1pYUEJZZHlWODMxOQpvMGxWajFLRkkyRENML2xpV2lzSlJvb2YrMWNSMzVDdGQwd1lCY3BCNlRac2xNY09QbDc2ZHdLd0pnZUpvMlFnClpzZm1jMnZDMS9xT2xOdU5xLzBUenprVkd2OEVUVDNDZ2FVK1VYZTRYT1Z2a2NjZWJKbjJkZz09Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K';
- $script = <<<'EOT'
- error_reporting(-1);
- $info = openssl_x509_parse(base64_decode('%s'));
- var_dump(PHP_VERSION, $info['issuer']['emailAddress'], $info['validFrom_time_t']);
- EOT;
- $script = '<'."?php\n".sprintf($script, $cert);
- try {
- $process = new PhpProcess($script);
- $process->mustRun();
- } catch (\Exception $e) {
- return self::$useOpensslParse = false;
- }
- $output = preg_split('{\r?\n}', trim($process->getOutput()));
- $errorOutput = trim($process->getErrorOutput());
- if (
- is_array($output)
- && count($output) === 3
- && $output[0] === sprintf('string(%d) "%s"', strlen(PHP_VERSION), PHP_VERSION)
- && $output[1] === 'string(27) "stefan.esser@sektioneins.de"'
- && $output[2] === 'int(-1)'
- && preg_match('{openssl_x509_parse\(\): illegal (?:ASN1 data type for|length in) timestamp in - on line \d+}', $errorOutput)
- ) {
- return self::$useOpensslParse = true;
- }
- return self::$useOpensslParse = false;
- }
- public static function reset()
- {
- self::$caFileValidity = array();
- self::$caPath = null;
- self::$useOpensslParse = null;
- }
- private static function getEnvVariable($name)
- {
- if (isset($_SERVER[$name])) {
- return (string) $_SERVER[$name];
- }
- if (PHP_SAPI === 'cli' && ($value = getenv($name)) !== false && $value !== null) {
- return (string) $value;
- }
- return false;
- }
- private static function caFileUsable($certFile, LoggerInterface $logger = null)
- {
- return $certFile
- && static::isFile($certFile, $logger)
- && static::isReadable($certFile, $logger)
- && static::validateCaFile($certFile, $logger);
- }
- private static function caDirUsable($certDir, LoggerInterface $logger = null)
- {
- return $certDir
- && static::isDir($certDir, $logger)
- && static::isReadable($certDir, $logger)
- && static::glob($certDir . '/*', $logger);
- }
- private static function isFile($certFile, LoggerInterface $logger = null)
- {
- $isFile = @is_file($certFile);
- if (!$isFile && $logger) {
- $logger->debug(sprintf('Checked CA file %s does not exist or it is not a file.', $certFile));
- }
- return $isFile;
- }
- private static function isDir($certDir, LoggerInterface $logger = null)
- {
- $isDir = @is_dir($certDir);
- if (!$isDir && $logger) {
- $logger->debug(sprintf('Checked directory %s does not exist or it is not a directory.', $certDir));
- }
- return $isDir;
- }
- private static function isReadable($certFileOrDir, LoggerInterface $logger = null)
- {
- $isReadable = @is_readable($certFileOrDir);
- if (!$isReadable && $logger) {
- $logger->debug(sprintf('Checked file or directory %s is not readable.', $certFileOrDir));
- }
- return $isReadable;
- }
- private static function glob($pattern, LoggerInterface $logger = null)
- {
- $certs = glob($pattern);
- if ($certs === false) {
- if ($logger) {
- $logger->debug(sprintf("An error occurred while trying to find certificates for pattern: %s", $pattern));
- }
- return false;
- }
- if (count($certs) === 0) {
- if ($logger) {
- $logger->debug(sprintf("No CA files found for pattern: %s", $pattern));
- }
- return false;
- }
- return true;
- }
- }
- Copyright (C) 2022 Composer
- Permission is hereby granted, free of charge, to any person obtaining a copy of
- this software and associated documentation files (the "Software"), to deal in
- the Software without restriction, including without limitation the rights to
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
- of the Software, and to permit persons to whom the Software is furnished to do
- so, subject to the following conditions:
- The above copyright notice and this permission notice shall be included in all
- copies or substantial portions of the Software.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- SOFTWARE.
- <?php declare(strict_types=1);
- namespace Composer\ClassMapGenerator;
- class ClassMap implements \Countable
- {
- public $map = [];
- private $ambiguousClasses = [];
- private $psrViolations = [];
- public function getMap(): array
- {
- return $this->map;
- }
- public function getPsrViolations(): array
- {
- return $this->psrViolations;
- }
- public function getAmbiguousClasses(): array
- {
- return $this->ambiguousClasses;
- }
- public function sort(): void
- {
- ksort($this->map);
- }
- public function addClass(string $className, string $path): void
- {
- $this->map[$className] = $path;
- }
- public function getClassPath(string $className): string
- {
- if (!isset($this->map[$className])) {
- throw new \OutOfBoundsException('Class '.$className.' is not present in the map');
- }
- return $this->map[$className];
- }
- public function hasClass(string $className): bool
- {
- return isset($this->map[$className]);
- }
- public function addPsrViolation(string $warning): void
- {
- $this->psrViolations[] = $warning;
- }
- public function addAmbiguousClass(string $className, string $path): void
- {
- $this->ambiguousClasses[$className][] = $path;
- }
- public function count(): int
- {
- return \count($this->map);
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\ClassMapGenerator;
- use Composer\Pcre\Preg;
- use Symfony\Component\Finder\Finder;
- use Composer\IO\IOInterface;
- class ClassMapGenerator
- {
- private $extensions;
- private $scannedFiles = null;
- private $classMap;
- public function __construct(array $extensions = ['php', 'inc'])
- {
- $this->extensions = $extensions;
- $this->classMap = new ClassMap;
- }
- public function avoidDuplicateScans(FileList $scannedFiles = null): self
- {
- $this->scannedFiles = $scannedFiles ?? new FileList;
- return $this;
- }
- public static function createMap($path): array
- {
- $generator = new self();
- $generator->scanPaths($path);
- return $generator->getClassMap()->getMap();
- }
- public function getClassMap(): ClassMap
- {
- return $this->classMap;
- }
- public function scanPaths($path, string $excluded = null, string $autoloadType = 'classmap', ?string $namespace = null): void
- {
- if (!in_array($autoloadType, ['psr-0', 'psr-4', 'classmap'], true)) {
- throw new \InvalidArgumentException('$autoloadType must be one of: "psr-0", "psr-4" or "classmap"');
- }
- if ('classmap' !== $autoloadType) {
- if (!is_string($path)) {
- throw new \InvalidArgumentException('$path must be a string when specifying a psr-0 or psr-4 autoload type');
- }
- if (!is_string($namespace)) {
- 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');
- }
- $basePath = $path;
- }
- if (is_string($path)) {
- if (is_file($path)) {
- $path = [new \SplFileInfo($path)];
- } elseif (is_dir($path) || strpos($path, '*') !== false) {
- $path = Finder::create()
- ->files()
- ->followLinks()
- ->name('/\.(?:'.implode('|', array_map('preg_quote', $this->extensions)).')$/')
- ->in($path);
- } else {
- throw new \RuntimeException(
- 'Could not scan for classes inside "'.$path.'" which does not appear to be a file nor a folder'
- );
- }
- }
- $cwd = realpath(self::getCwd());
- foreach ($path as $file) {
- $filePath = $file->getPathname();
- if (!in_array(pathinfo($filePath, PATHINFO_EXTENSION), $this->extensions, true)) {
- continue;
- }
- if (!self::isAbsolutePath($filePath)) {
- $filePath = $cwd . '/' . $filePath;
- $filePath = self::normalizePath($filePath);
- } else {
- $filePath = Preg::replace('{[\\\\/]{2,}}', '/', $filePath);
- }
- if ('' === $filePath) {
- throw new \LogicException('Got an empty $filePath for '.$file->getPathname());
- }
- $realPath = realpath($filePath);
- if (false === $realPath) {
- throw new \RuntimeException('realpath of '.$filePath.' failed to resolve, got false');
- }
- if ($this->scannedFiles !== null && $this->scannedFiles->contains($realPath)) {
- continue;
- }
- if (null !== $excluded && Preg::isMatch($excluded, strtr($realPath, '\\', '/'))) {
- continue;
- }
- if (null !== $excluded && Preg::isMatch($excluded, strtr($filePath, '\\', '/'))) {
- continue;
- }
- $classes = PhpFileParser::findClasses($filePath);
- if ('classmap' !== $autoloadType && isset($namespace, $basePath)) {
- $classes = $this->filterByNamespace($classes, $filePath, $namespace, $autoloadType, $basePath);
- if (\count($classes) > 0 && $this->scannedFiles !== null) {
- $this->scannedFiles->add($realPath);
- }
- } elseif ($this->scannedFiles !== null) {
- $this->scannedFiles->add($realPath);
- }
- foreach ($classes as $class) {
- if (!$this->classMap->hasClass($class)) {
- $this->classMap->addClass($class, $filePath);
- } elseif ($filePath !== $this->classMap->getClassPath($class) && !Preg::isMatch('{/(test|fixture|example|stub)s?/}i', strtr($this->classMap->getClassPath($class).' '.$filePath, '\\', '/'))) {
- $this->classMap->addAmbiguousClass($class, $filePath);
- }
- }
- }
- }
- private function filterByNamespace(array $classes, string $filePath, string $baseNamespace, string $namespaceType, string $basePath): array
- {
- $validClasses = [];
- $rejectedClasses = [];
- $realSubPath = substr($filePath, strlen($basePath) + 1);
- $dotPosition = strrpos($realSubPath, '.');
- $realSubPath = substr($realSubPath, 0, $dotPosition === false ? PHP_INT_MAX : $dotPosition);
- foreach ($classes as $class) {
- if ('' !== $baseNamespace && 0 !== strpos($class, $baseNamespace)) {
- continue;
- }
- if ('psr-0' === $namespaceType) {
- $namespaceLength = strrpos($class, '\\');
- if (false !== $namespaceLength) {
- $namespace = substr($class, 0, $namespaceLength + 1);
- $className = substr($class, $namespaceLength + 1);
- $subPath = str_replace('\\', DIRECTORY_SEPARATOR, $namespace)
- . str_replace('_', DIRECTORY_SEPARATOR, $className);
- } else {
- $subPath = str_replace('_', DIRECTORY_SEPARATOR, $class);
- }
- } elseif ('psr-4' === $namespaceType) {
- $subNamespace = ('' !== $baseNamespace) ? substr($class, strlen($baseNamespace)) : $class;
- $subPath = str_replace('\\', DIRECTORY_SEPARATOR, $subNamespace);
- } else {
- throw new \InvalidArgumentException('$namespaceType must be "psr-0" or "psr-4"');
- }
- if ($subPath === $realSubPath) {
- $validClasses[] = $class;
- } else {
- $rejectedClasses[] = $class;
- }
- }
- if (\count($validClasses) === 0) {
- foreach ($rejectedClasses as $class) {
- $this->classMap->addPsrViolation("Class $class located in ".Preg::replace('{^'.preg_quote(self::getCwd()).'}', '.', $filePath, 1)." does not comply with $namespaceType autoloading standard. Skipping.");
- }
- return [];
- }
- return $validClasses;
- }
- private static function isAbsolutePath(string $path)
- {
- return strpos($path, '/') === 0 || substr($path, 1, 1) === ':' || strpos($path, '\\\\') === 0;
- }
- private static function normalizePath(string $path)
- {
- $parts = [];
- $path = strtr($path, '\\', '/');
- $prefix = '';
- $absolute = '';
- if (strpos($path, '//') === 0 && \strlen($path) > 2) {
- $absolute = '//';
- $path = substr($path, 2);
- }
- if (Preg::isMatch('{^( [0-9a-z]{2,}+: (?: // (?: [a-z]: )? )? | [a-z]: )}ix', $path, $match)) {
- $prefix = $match[1];
- $path = substr($path, \strlen($prefix));
- }
- if (strpos($path, '/') === 0) {
- $absolute = '/';
- $path = substr($path, 1);
- }
- $up = false;
- foreach (explode('/', $path) as $chunk) {
- if ('..' === $chunk && (\strlen($absolute) > 0 || $up)) {
- array_pop($parts);
- $up = !(\count($parts) === 0 || '..' === end($parts));
- } elseif ('.' !== $chunk && '' !== $chunk) {
- $parts[] = $chunk;
- $up = '..' !== $chunk;
- }
- }
- $prefix = Preg::replaceCallback('{(^|://)[a-z]:$}i', function (array $m) { return strtoupper($m[0]); }, $prefix);
- return $prefix.$absolute.implode('/', $parts);
- }
- private static function getCwd(): string
- {
- $cwd = getcwd();
- if (false === $cwd) {
- throw new \RuntimeException('Could not determine the current working directory');
- }
- return $cwd;
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\ClassMapGenerator;
- class FileList
- {
- public $files = [];
- public function add(string $path): void
- {
- $this->files[$path] = true;
- }
- public function contains(string $path): bool
- {
- return isset($this->files[$path]);
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\ClassMapGenerator;
- use Composer\Pcre\Preg;
- class PhpFileCleaner
- {
- private static $typeConfig;
- private static $restPattern;
- private $contents;
- private $len;
- private $maxMatches;
- private $index = 0;
- public static function setTypeConfig(array $types): void
- {
- foreach ($types as $type) {
- self::$typeConfig[$type[0]] = array(
- 'name' => $type,
- 'length' => \strlen($type),
- 'pattern' => '{.\b(?<![\$:>])'.$type.'\s++[a-zA-Z_\x7f-\xff:][a-zA-Z0-9_\x7f-\xff:\-]*+}Ais',
- );
- }
- self::$restPattern = '{[^?"\'</'.implode('', array_keys(self::$typeConfig)).']+}A';
- }
- public function __construct(string $contents, int $maxMatches)
- {
- $this->contents = $contents;
- $this->len = \strlen($this->contents);
- $this->maxMatches = $maxMatches;
- }
- public function clean(): string
- {
- $clean = '';
- while ($this->index < $this->len) {
- $this->skipToPhp();
- $clean .= '<?';
- while ($this->index < $this->len) {
- $char = $this->contents[$this->index];
- if ($char === '?' && $this->peek('>')) {
- $clean .= '?>';
- $this->index += 2;
- continue 2;
- }
- if ($char === '"') {
- $this->skipString('"');
- $clean .= 'null';
- continue;
- }
- if ($char === "'") {
- $this->skipString("'");
- $clean .= 'null';
- continue;
- }
- 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)) {
- $this->index += \strlen($match[0]);
- $this->skipHeredoc($match[2]);
- $clean .= 'null';
- continue;
- }
- if ($char === '/') {
- if ($this->peek('/')) {
- $this->skipToNewline();
- continue;
- }
- if ($this->peek('*')) {
- $this->skipComment();
- continue;
- }
- }
- if ($this->maxMatches === 1 && isset(self::$typeConfig[$char])) {
- $type = self::$typeConfig[$char];
- if (
- \substr($this->contents, $this->index, $type['length']) === $type['name']
- && Preg::isMatch($type['pattern'], $this->contents, $match, 0, $this->index - 1)
- ) {
- $clean .= $match[0];
- return $clean;
- }
- }
- $this->index += 1;
- if ($this->match(self::$restPattern, $match)) {
- $clean .= $char . $match[0];
- $this->index += \strlen($match[0]);
- } else {
- $clean .= $char;
- }
- }
- }
- return $clean;
- }
- private function skipToPhp(): void
- {
- while ($this->index < $this->len) {
- if ($this->contents[$this->index] === '<' && $this->peek('?')) {
- $this->index += 2;
- break;
- }
- $this->index += 1;
- }
- }
- private function skipString(string $delimiter): void
- {
- $this->index += 1;
- while ($this->index < $this->len) {
- if ($this->contents[$this->index] === '\\' && ($this->peek('\\') || $this->peek($delimiter))) {
- $this->index += 2;
- continue;
- }
- if ($this->contents[$this->index] === $delimiter) {
- $this->index += 1;
- break;
- }
- $this->index += 1;
- }
- }
- private function skipComment(): void
- {
- $this->index += 2;
- while ($this->index < $this->len) {
- if ($this->contents[$this->index] === '*' && $this->peek('/')) {
- $this->index += 2;
- break;
- }
- $this->index += 1;
- }
- }
- private function skipToNewline(): void
- {
- while ($this->index < $this->len) {
- if ($this->contents[$this->index] === "\r" || $this->contents[$this->index] === "\n") {
- return;
- }
- $this->index += 1;
- }
- }
- private function skipHeredoc(string $delimiter): void
- {
- $firstDelimiterChar = $delimiter[0];
- $delimiterLength = \strlen($delimiter);
- $delimiterPattern = '{'.preg_quote($delimiter).'(?![a-zA-Z0-9_\x80-\xff])}A';
- while ($this->index < $this->len) {
- switch ($this->contents[$this->index]) {
- case "\t":
- case " ":
- $this->index += 1;
- continue 2;
- case $firstDelimiterChar:
- if (
- \substr($this->contents, $this->index, $delimiterLength) === $delimiter
- && $this->match($delimiterPattern)
- ) {
- $this->index += $delimiterLength;
- return;
- }
- break;
- }
- while ($this->index < $this->len) {
- $this->skipToNewline();
- while ($this->index < $this->len && ($this->contents[$this->index] === "\r" || $this->contents[$this->index] === "\n")) {
- $this->index += 1;
- }
- break;
- }
- }
- }
- private function peek(string $char): bool
- {
- return $this->index + 1 < $this->len && $this->contents[$this->index + 1] === $char;
- }
- private function match(string $regex, array &$match = null): bool
- {
- return Preg::isMatch($regex, $this->contents, $match, 0, $this->index);
- }
- }
- <?php declare(strict_types=1);
- namespace Composer\ClassMapGenerator;
- use Composer\Pcre\Preg;
- class PhpFileParser
- {
- public static function findClasses(string $path): array
- {
- $extraTypes = self::getExtraTypes();
- $contents = @php_strip_whitespace($path);
- if ('' === $contents) {
- if (!file_exists($path)) {
- $message = 'File at "%s" does not exist, check your classmap definitions';
- } elseif (!self::isReadable($path)) {
- $message = 'File at "%s" is not readable, check its permissions';
- } elseif ('' === trim((string) file_get_contents($path))) {
- return array();
- } else {
- $message = 'File at "%s" could not be parsed as PHP, it may be binary or corrupted';
- }
- $error = error_get_last();
- if (isset($error['message'])) {
- $message .= PHP_EOL . 'The following message may be helpful:' . PHP_EOL . $error['message'];
- }
- throw new \RuntimeException(sprintf($message, $path));
- }
- Preg::matchAll('{\b(?:class|interface|trait'.$extraTypes.')\s}i', $contents, $matches);
- if (!$matches) {
- return array();
- }
- $p = new PhpFileCleaner($contents, count($matches[0]));
- $contents = $p->clean();
- unset($p);
- Preg::matchAll('{
- (?:
- \b(?<![\$:>])(?P<type>class|interface|trait'.$extraTypes.') \s++ (?P<name>[a-zA-Z_\x7f-\xff:][a-zA-Z0-9_\x7f-\xff:\-]*+)
- | \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*+ [\{;]
- )
- }ix', $contents, $matches);
- $classes = array();
- $namespace = '';
- for ($i = 0, $len = count($matches['type']); $i < $len; $i++) {
- if (isset($matches['ns'][$i]) && $matches['ns'][$i] !== '') {
- $namespace = str_replace(array(' ', "\t", "\r", "\n"), '', (string) $matches['nsname'][$i]) . '\\';
- } else {
- $name = $matches['name'][$i];
- if ($name === 'extends' || $name === 'implements') {
- continue;
- }
- if ($name[0] === ':') {
- $name = 'xhp'.substr(str_replace(array('-', ':'), array('_', '__'), $name), 1);
- } elseif (strtolower($matches['type'][$i]) === 'enum') {
- $colonPos = strrpos($name, ':');
- if (false !== $colonPos) {
- $name = substr($name, 0, $colonPos);
- }
- }
- $classes[] = ltrim($namespace . $name, '\\');
- }
- }
- return $classes;
- }
- private static function getExtraTypes(): string
- {
- static $extraTypes = null;
- if (null === $extraTypes) {
- $extraTypes = '';
- if (PHP_VERSION_ID >= 80100 || (defined('HHVM_VERSION') && version_compare(HHVM_VERSION, '3.3', '>='))) {
- $extraTypes .= '|enum';
- }
- PhpFileCleaner::setTypeConfig(array_merge(['class', 'interface', 'trait'], array_filter(explode('|', $extraTypes))));
- }
- return $extraTypes;
- }
- private static function isReadable(string $path)
- {
- if (is_readable($path)) {
- return true;
- }
- if (is_file($path)) {
- return false !== @file_get_contents($path, false, null, 0, 1);
- }
- return false;
- }
- }
- <?php return array(
- 'root' => array(
- 'name' => 'composer/composer',
- 'pretty_version' => '2.4.1',
- 'version' => '2.4.1.0',
- 'reference' => '777d542e3af65f8e7a66a4d98ce7a697da339414',
- 'type' => 'library',
- 'install_path' => __DIR__ . '/../../',
- 'aliases' => array(),
- 'dev' => false,
- ),
- 'versions' => array(
- 'composer/ca-bundle' => array(
- 'pretty_version' => '1.3.3',
- 'version' => '1.3.3.0',
- 'reference' => '30897edbfb15e784fe55587b4f73ceefd3c4d98c',
- 'type' => 'library',
- 'install_path' => __DIR__ . '/./ca-bundle',
- 'aliases' => array(),
- 'dev_requirement' => false,
- ),
- 'composer/class-map-generator' => array(
- 'pretty_version' => '1.0.0',
- 'version' => '1.0.0.0',
- 'reference' => '1e1cb2b791facb2dfe32932a7718cf2571187513',
- 'type' => 'library',
- 'install_path' => __DIR__ . '/./class-map-generator',
- 'aliases' => array(),
- 'dev_requirement' => false,
- ),
- 'composer/composer' => array(
- 'pretty_version' => '2.4.1',
- 'version' => '2.4.1.0',
- 'reference' => '777d542e3af65f8e7a66a4d98ce7a697da339414',
- 'type' => 'library',
- 'install_path' => __DIR__ . '/../../',
- 'aliases' => array(),
- 'dev_requirement' => false,
- ),
- 'composer/metadata-minifier' => array(
- 'pretty_version' => '1.0.0',
- 'version' => '1.0.0.0',
- 'reference' => 'c549d23829536f0d0e984aaabbf02af91f443207',
- 'type' => 'library',
- 'install_path' => __DIR__ . '/./metadata-minifier',
- 'aliases' => array(),
- 'dev_requirement' => false,
- ),
- 'composer/pcre' => array(
- 'pretty_version' => '2.0.0',
- 'version' => '2.0.0.0',
- 'reference' => 'c8e9d27cfc5ed22643c19c160455b473ffd8aabe',
- 'type' => 'library',
- 'install_path' => __DIR__ . '/./pcre',
- 'aliases' => array(),
- 'dev_requirement' => false,
- ),
- 'composer/semver' => array(
- 'pretty_version' => '3.3.2',
- 'version' => '3.3.2.0',
- 'reference' => '3953f23262f2bff1919fc82183ad9acb13ff62c9',
- 'type' => 'library',
- 'install_path' => __DIR__ . '/./semver',
- 'aliases' => array(),
- 'dev_requirement' => false,
- ),
- 'composer/spdx-licenses' => array(
- 'pretty_version' => '1.5.7',
- 'version' => '1.5.7.0',
- 'reference' => 'c848241796da2abf65837d51dce1fae55a960149',
- 'type' => 'library',
- 'install_path' => __DIR__ . '/./spdx-licenses',
- 'aliases' => array(),
- 'dev_requirement' => false,
- ),
- 'composer/xdebug-handler' => array(
- 'pretty_version' => '3.0.3',
- 'version' => '3.0.3.0',
- 'reference' => 'ced299686f41dce890debac69273b47ffe98a40c',
- 'type' => 'library',
- 'install_path' => __DIR__ . '/./xdebug-handler',
- 'aliases' => array(),
- 'dev_requirement' => false,
- ),
- 'justinrainbow/json-schema' => array(
- 'pretty_version' => '5.2.12',
- 'version' => '5.2.12.0',
- 'reference' => 'ad87d5a5ca981228e0e205c2bc7dfb8e24559b60',
- 'type' => 'library',
- 'install_path' => __DIR__ . '/../justinrainbow/json-schema',
- 'aliases' => array(),
- 'dev_requirement' => false,
- ),
- 'psr/container' => array(
- 'pretty_version' => '1.1.1',
- 'version' => '1.1.1.0',
- 'reference' => '8622567409010282b7aeebe4bb841fe98b58dcaf',
- 'type' => 'library',
- 'install_path' => __DIR__ . '/../psr/container',
- 'aliases' => array(),
- 'dev_requirement' => false,
- ),
- 'psr/log' => array(
- 'pretty_version' => '1.1.4',
- 'version' => '1.1.4.0',
- 'reference' => 'd49695b909c3b7628b6289db5479a1c204601f11',
- 'type' => 'library',
- 'install_path' => __DIR__ . '/../psr/log',
- 'aliases' => array(),
- 'dev_requirement' => false,
- ),
- 'psr/log-implementation' => array(
- 'dev_requirement' => false,
- 'provided' => array(
- 0 => '1.0|2.0',
- ),
- ),
- 'react/promise' => array(
- 'pretty_version' => 'v2.9.0',
- 'version' => '2.9.0.0',
- 'reference' => '234f8fd1023c9158e2314fa9d7d0e6a83db42910',
- 'type' => 'library',
- 'install_path' => __DIR__ . '/../react/promise',
- 'aliases' => array(),
- 'dev_requirement' => false,
- ),
- 'seld/jsonlint' => array(
- 'pretty_version' => '1.9.0',
- 'version' => '1.9.0.0',
- 'reference' => '4211420d25eba80712bff236a98960ef68b866b7',
- 'type' => 'library',
- 'install_path' => __DIR__ . '/../seld/jsonlint',
- 'aliases' => array(),
- 'dev_requirement' => false,
- ),
- 'seld/phar-utils' => array(
- 'pretty_version' => '1.2.0',
- 'version' => '1.2.0.0',
- 'reference' => '9f3452c93ff423469c0d56450431562ca423dcee',
- 'type' => 'library',
- 'install_path' => __DIR__ . '/../seld/phar-utils',
- 'aliases' => array(),
- 'dev_requirement' => false,
- ),
- 'seld/signal-handler' => array(
- 'pretty_version' => '2.0.1',
- 'version' => '2.0.1.0',
- 'reference' => 'f69d119511dc0360440cdbdaa71829c149b7be75',
- 'type' => 'library',
- 'install_path' => __DIR__ . '/../seld/signal-handler',
- 'aliases' => array(),
- 'dev_requirement' => false,
- ),
- 'symfony/console' => array(
- 'pretty_version' => 'v5.4.11',
- 'version' => '5.4.11.0',
- 'reference' => '535846c7ee6bc4dd027ca0d93220601456734b10',
- 'type' => 'library',
- 'install_path' => __DIR__ . '/../symfony/console',
- 'aliases' => array(),
- 'dev_requirement' => false,
- ),
- 'symfony/deprecation-contracts' => array(
- 'pretty_version' => 'v2.5.2',
- 'version' => '2.5.2.0',
- 'reference' => 'e8b495ea28c1d97b5e0c121748d6f9b53d075c66',
- 'type' => 'library',
- 'install_path' => __DIR__ . '/../symfony/deprecation-contracts',
- 'aliases' => array(),
- 'dev_requirement' => false,
- ),
- 'symfony/filesystem' => array(
- 'pretty_version' => 'v5.4.11',
- 'version' => '5.4.11.0',
- 'reference' => '6699fb0228d1bc35b12aed6dd5e7455457609ddd',
- 'type' => 'library',
- 'install_path' => __DIR__ . '/../symfony/filesystem',
- 'aliases' => array(),
- 'dev_requirement' => false,
- ),
- 'symfony/finder' => array(
- 'pretty_version' => 'v5.4.11',
- 'version' => '5.4.11.0',
- 'reference' => '7872a66f57caffa2916a584db1aa7f12adc76f8c',
- 'type' => 'library',
- 'install_path' => __DIR__ . '/../symfony/finder',
- 'aliases' => array(),
- 'dev_requirement' => false,
- ),
- 'symfony/polyfill-ctype' => array(
- 'pretty_version' => 'v1.26.0',
- 'version' => '1.26.0.0',
- 'reference' => '6fd1b9a79f6e3cf65f9e679b23af304cd9e010d4',
- 'type' => 'library',
- 'install_path' => __DIR__ . '/../symfony/polyfill-ctype',
- 'aliases' => array(),
- 'dev_requirement' => false,
- ),
- 'symfony/polyfill-intl-grapheme' => array(
- 'pretty_version' => 'v1.26.0',
- 'version' => '1.26.0.0',
- 'reference' => '433d05519ce6990bf3530fba6957499d327395c2',
- 'type' => 'library',
- 'install_path' => __DIR__ . '/../symfony/polyfill-intl-grapheme',
- 'aliases' => array(),
- 'dev_requirement' => false,
- ),
- 'symfony/polyfill-intl-normalizer' => array(
- 'pretty_version' => 'v1.26.0',
- 'version' => '1.26.0.0',
- 'reference' => '219aa369ceff116e673852dce47c3a41794c14bd',
- 'type' => 'library',
- 'install_path' => __DIR__ . '/../symfony/polyfill-intl-normalizer',
- 'aliases' => array(),
- 'dev_requirement' => false,
- ),
- 'symfony/polyfill-mbstring' => array(
- 'pretty_version' => 'v1.26.0',
- 'version' => '1.26.0.0',
- 'reference' => '9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e',
- 'type' => 'library',
- 'install_path' => __DIR__ . '/../symfony/polyfill-mbstring',
- 'aliases' => array(),
- 'dev_requirement' => false,
- ),
- 'symfony/polyfill-php73' => array(
- 'pretty_version' => 'v1.26.0',
- 'version' => '1.26.0.0',
- 'reference' => 'e440d35fa0286f77fb45b79a03fedbeda9307e85',
- 'type' => 'library',
- 'install_path' => __DIR__ . '/../symfony/polyfill-php73',
- 'aliases' => array(),
- 'dev_requirement' => false,
- ),
- 'symfony/polyfill-php80' => array(
- 'pretty_version' => 'v1.26.0',
- 'version' => '1.26.0.0',
- 'reference' => 'cfa0ae98841b9e461207c13ab093d76b0fa7bace',
- 'type' => 'library',
- 'install_path' => __DIR__ . '/../symfony/polyfill-php80',
- 'aliases' => array(),
- 'dev_requirement' => false,
- ),
- 'symfony/process' => array(
- 'pretty_version' => 'v5.4.11',
- 'version' => '5.4.11.0',
- 'reference' => '6e75fe6874cbc7e4773d049616ab450eff537bf1',
- 'type' => 'library',
- 'install_path' => __DIR__ . '/../symfony/process',
- 'aliases' => array(),
- 'dev_requirement' => false,
- ),
- 'symfony/service-contracts' => array(
- 'pretty_version' => 'v2.5.2',
- 'version' => '2.5.2.0',
- 'reference' => '4b426aac47d6427cc1a1d0f7e2ac724627f5966c',
- 'type' => 'library',
- 'install_path' => __DIR__ . '/../symfony/service-contracts',
- 'aliases' => array(),
- 'dev_requirement' => false,
- ),
- 'symfony/string' => array(
- 'pretty_version' => 'v5.4.11',
- 'version' => '5.4.11.0',
- 'reference' => '5eb661e49ad389e4ae2b6e4df8d783a8a6548322',
- 'type' => 'library',
- 'install_path' => __DIR__ . '/../symfony/string',
- 'aliases' => array(),
- 'dev_requirement' => false,
- ),
- ),
- );
- Copyright (C) 2021 Composer
- Permission is hereby granted, free of charge, to any person obtaining a copy of
- this software and associated documentation files (the "Software"), to deal in
- the Software without restriction, including without limitation the rights to
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
- of the Software, and to permit persons to whom the Software is furnished to do
- so, subject to the following conditions:
- The above copyright notice and this permission notice shall be included in all
- copies or substantial portions of the Software.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- SOFTWARE.
- <?php
- namespace Composer\MetadataMinifier;
- class MetadataMinifier
- {
- public static function expand(array $versions)
- {
- $expanded = array();
- $expandedVersion = null;
- foreach ($versions as $versionData) {
- if (!$expandedVersion) {
- $expandedVersion = $versionData;
- $expanded[] = $expandedVersion;
- continue;
- }
- foreach ($versionData as $key => $val) {
- if ($val === '__unset') {
- unset($expandedVersion[$key]);
- } else {
- $expandedVersion[$key] = $val;
- }
- }
- $expanded[] = $expandedVersion;
- }
- return $expanded;
- }
- public static function minify(array $versions)
- {
- $minifiedVersions = array();
- $lastKnownVersionData = null;
- foreach ($versions as $version) {
- if (!$lastKnownVersionData) {
- $lastKnownVersionData = $version;
- $minifiedVersions[] = $version;
- continue;
- }
- $minifiedVersion = array();
- foreach ($version as $key => $val) {
- if (!isset($lastKnownVersionData[$key]) || $lastKnownVersionData[$key] !== $val) {
- $minifiedVersion[$key] = $val;
- $lastKnownVersionData[$key] = $val;
- }
- }
- foreach ($lastKnownVersionData as $key => $val) {
- if (!isset($version[$key])) {
- $minifiedVersion[$key] = "__unset";
- unset($lastKnownVersionData[$key]);
- }
- }
- $minifiedVersions[] = $minifiedVersion;
- }
- return $minifiedVersions;
- }
- }
- Copyright (C) 2021 Composer
- Permission is hereby granted, free of charge, to any person obtaining a copy of
- this software and associated documentation files (the "Software"), to deal in
- the Software without restriction, including without limitation the rights to
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
- of the Software, and to permit persons to whom the Software is furnished to do
- so, subject to the following conditions:
- The above copyright notice and this permission notice shall be included in all
- copies or substantial portions of the Software.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- SOFTWARE.
- <?php
- namespace Composer\Pcre;
- final class MatchAllResult
- {
- public $matches;
- public $count;
- public $matched;
- public function __construct($count, array $matches)
- {
- $this->matches = $matches;
- $this->matched = (bool) $count;
- $this->count = $count;
- }
- }
- <?php
- namespace Composer\Pcre;
- final class MatchAllWithOffsetsResult
- {
- public $matches;
- public $count;
- public $matched;
- public function __construct($count, array $matches)
- {
- $this->matches = $matches;
- $this->matched = (bool) $count;
- $this->count = $count;
- }
- }
- <?php
- namespace Composer\Pcre;
- final class MatchResult
- {
- public $matches;
- public $matched;
- public function __construct($count, array $matches)
- {
- $this->matches = $matches;
- $this->matched = (bool) $count;
- }
- }
- <?php
- namespace Composer\Pcre;
- final class MatchWithOffsetsResult
- {
- public $matches;
- public $matched;
- public function __construct($count, array $matches)
- {
- $this->matches = $matches;
- $this->matched = (bool) $count;
- }
- }
- <?php
- namespace Composer\Pcre;
- class PcreException extends \RuntimeException
- {
- public static function fromFunction($function, $pattern)
- {
- $code = preg_last_error();
- if (is_array($pattern)) {
- $pattern = implode(', ', $pattern);
- }
- return new PcreException($function.'(): failed executing "'.$pattern.'": '.self::pcreLastErrorMessage($code), $code);
- }
- private static function pcreLastErrorMessage($code)
- {
- if (function_exists('preg_last_error_msg')) {
- return preg_last_error_msg();
- }
- if (PHP_VERSION_ID < 70201 && $code === 0) {
- return 'UNDEFINED_ERROR';
- }
- $constants = get_defined_constants(true);
- if (!isset($constants['pcre'])) {
- return 'UNDEFINED_ERROR';
- }
- foreach ($constants['pcre'] as $const => $val) {
- if ($val === $code && substr($const, -6) === '_ERROR') {
- return $const;
- }
- }
- return 'UNDEFINED_ERROR';
- }
- }
- <?php
- namespace Composer\Pcre;
- class Preg
- {
- public const ARRAY_MSG = '$subject as an array is not supported. You can use \'foreach\' instead.';
- public const INVALID_TYPE_MSG = '$subject must be a string, %s given.';
- public static function match(string $pattern, string $subject, ?array &$matches = null, int $flags = 0, int $offset = 0): int
- {
- if (($flags & PREG_OFFSET_CAPTURE) !== 0) {
- throw new \InvalidArgumentException('PREG_OFFSET_CAPTURE is not supported as it changes the type of $matches, use matchWithOffsets() instead');
- }
- $result = preg_match($pattern, $subject, $matches, $flags | PREG_UNMATCHED_AS_NULL, $offset);
- if ($result === false) {
- throw PcreException::fromFunction('preg_match', $pattern);
- }
- return $result;
- }
- public static function matchWithOffsets(string $pattern, string $subject, ?array &$matches, int $flags = 0, int $offset = 0): int
- {
- $result = preg_match($pattern, $subject, $matches, $flags | PREG_UNMATCHED_AS_NULL | PREG_OFFSET_CAPTURE, $offset);
- if ($result === false) {
- throw PcreException::fromFunction('preg_match', $pattern);
- }
- return $result;
- }
- public static function matchAll(string $pattern, string $subject, ?array &$matches = null, int $flags = 0, int $offset = 0): int
- {
- if (($flags & PREG_OFFSET_CAPTURE) !== 0) {
- throw new \InvalidArgumentException('PREG_OFFSET_CAPTURE is not supported as it changes the type of $matches, use matchAllWithOffsets() instead');
- }
- if (($flags & PREG_SET_ORDER) !== 0) {
- throw new \InvalidArgumentException('PREG_SET_ORDER is not supported as it changes the type of $matches');
- }
- $result = preg_match_all($pattern, $subject, $matches, $flags | PREG_UNMATCHED_AS_NULL, $offset);
- if ($result === false || $result === null) {
- throw PcreException::fromFunction('preg_match_all', $pattern);
- }
- return $result;
- }
- public static function matchAllWithOffsets(string $pattern, string $subject, ?array &$matches, int $flags = 0, int $offset = 0): int
- {
- $result = preg_match_all($pattern, $subject, $matches, $flags | PREG_UNMATCHED_AS_NULL | PREG_OFFSET_CAPTURE, $offset);
- if ($result === false || $result === null) {
- throw PcreException::fromFunction('preg_match_all', $pattern);
- }
- return $result;
- }
- public static function replace($pattern, $replacement, $subject, int $limit = -1, int &$count = null): string
- {
- if (!is_scalar($subject)) {
- if (is_array($subject)) {
- throw new \InvalidArgumentException(static::ARRAY_MSG);
- }
- throw new \TypeError(sprintf(static::INVALID_TYPE_MSG, gettype($subject)));
- }
- $result = preg_replace($pattern, $replacement, $subject, $limit, $count);
- if ($result === null) {
- throw PcreException::fromFunction('preg_replace', $pattern);
- }
- return $result;
- }
- public static function replaceCallback($pattern, callable $replacement, $subject, int $limit = -1, int &$count = null, int $flags = 0): string
- {
- if (!is_scalar($subject)) {
- if (is_array($subject)) {
- throw new \InvalidArgumentException(static::ARRAY_MSG);
- }
- throw new \TypeError(sprintf(static::INVALID_TYPE_MSG, gettype($subject)));
- }
- if (PHP_VERSION_ID >= 70400) {
- $result = preg_replace_callback($pattern, $replacement, $subject, $limit, $count, $flags);
- } else {
- $result = preg_replace_callback($pattern, $replacement, $subject, $limit, $count);
- }
- if ($result === null) {
- throw PcreException::fromFunction('preg_replace_callback', $pattern);
- }
- return $result;
- }
- public static function replaceCallbackArray(array $pattern, $subject, int $limit = -1, int &$count = null, int $flags = 0): string
- {
- if (!is_scalar($subject)) {
- if (is_array($subject)) {
- throw new \InvalidArgumentException(static::ARRAY_MSG);
- }
- throw new \TypeError(sprintf(static::INVALID_TYPE_MSG, gettype($subject)));
- }
- if (PHP_VERSION_ID >= 70400) {
- $result = preg_replace_callback_array($pattern, $subject, $limit, $count, $flags);
- } else {
- $result = preg_replace_callback_array($pattern, $subject, $limit, $count);
- }
- if ($result === null) {
- $pattern = array_keys($pattern);
- throw PcreException::fromFunction('preg_replace_callback_array', $pattern);
- }
- return $result;
- }
- public static function split(string $pattern, string $subject, int $limit = -1, int $flags = 0): array
- {
- if (($flags & PREG_SPLIT_OFFSET_CAPTURE) !== 0) {
- throw new \InvalidArgumentException('PREG_SPLIT_OFFSET_CAPTURE is not supported as it changes the type of $matches, use splitWithOffsets() instead');
- }
- $result = preg_split($pattern, $subject, $limit, $flags);
- if ($result === false) {
- throw PcreException::fromFunction('preg_split', $pattern);
- }
- return $result;
- }
- public static function splitWithOffsets(string $pattern, string $subject, int $limit = -1, int $flags = 0): array
- {
- $result = preg_split($pattern, $subject, $limit, $flags | PREG_SPLIT_OFFSET_CAPTURE);
- if ($result === false) {
- throw PcreException::fromFunction('preg_split', $pattern);
- }
- return $result;
- }
- public static function grep(string $pattern, array $array, int $flags = 0): array
- {
- $result = preg_grep($pattern, $array, $flags);
- if ($result === false) {
- throw PcreException::fromFunction('preg_grep', $pattern);
- }
- return $result;
- }
- public static function isMatch(string $pattern, string $subject, ?array &$matches = null, int $flags = 0, int $offset = 0): bool
- {
- return (bool) static::match($pattern, $subject, $matches, $flags, $offset);
- }
- public static function isMatchAll(string $pattern, string $subject, ?array &$matches = null, int $flags = 0, int $offset = 0): bool
- {
- return (bool) static::matchAll($pattern, $subject, $matches, $flags, $offset);
- }
- public static function isMatchWithOffsets(string $pattern, string $subject, ?array &$matches, int $flags = 0, int $offset = 0): bool
- {
- return (bool) static::matchWithOffsets($pattern, $subject, $matches, $flags, $offset);
- }
- public static function isMatchAllWithOffsets(string $pattern, string $subject, ?array &$matches, int $flags = 0, int $offset = 0): bool
- {
- return (bool) static::matchAllWithOffsets($pattern, $subject, $matches, $flags, $offset);
- }
- }
- <?php
- namespace Composer\Pcre;
- class Regex
- {
- public static function isMatch(string $pattern, string $subject, int $offset = 0): bool
- {
- return (bool) Preg::match($pattern, $subject, $matches, 0, $offset);
- }
- public static function match(string $pattern, string $subject, int $flags = 0, int $offset = 0): MatchResult
- {
- if (($flags & PREG_OFFSET_CAPTURE) !== 0) {
- throw new \InvalidArgumentException('PREG_OFFSET_CAPTURE is not supported as it changes the return type, use matchWithOffsets() instead');
- }
- $count = Preg::match($pattern, $subject, $matches, $flags, $offset);
- return new MatchResult($count, $matches);
- }
- public static function matchWithOffsets(string $pattern, string $subject, int $flags = 0, int $offset = 0): MatchWithOffsetsResult
- {
- $count = Preg::matchWithOffsets($pattern, $subject, $matches, $flags, $offset);
- return new MatchWithOffsetsResult($count, $matches);
- }
- public static function matchAll(string $pattern, string $subject, int $flags = 0, int $offset = 0): MatchAllResult
- {
- if (($flags & PREG_OFFSET_CAPTURE) !== 0) {
- throw new \InvalidArgumentException('PREG_OFFSET_CAPTURE is not supported as it changes the return type, use matchAllWithOffsets() instead');
- }
- if (($flags & PREG_SET_ORDER) !== 0) {
- throw new \InvalidArgumentException('PREG_SET_ORDER is not supported as it changes the return type');
- }
- $count = Preg::matchAll($pattern, $subject, $matches, $flags, $offset);
- return new MatchAllResult($count, $matches);
- }
- public static function matchAllWithOffsets(string $pattern, string $subject, int $flags = 0, int $offset = 0): MatchAllWithOffsetsResult
- {
- $count = Preg::matchAllWithOffsets($pattern, $subject, $matches, $flags, $offset);
- return new MatchAllWithOffsetsResult($count, $matches);
- }
- public static function replace($pattern, $replacement, $subject, int $limit = -1): ReplaceResult
- {
- $result = Preg::replace($pattern, $replacement, $subject, $limit, $count);
- return new ReplaceResult($count, $result);
- }
- public static function replaceCallback($pattern, callable $replacement, $subject, int $limit = -1, int $flags = 0): ReplaceResult
- {
- $result = Preg::replaceCallback($pattern, $replacement, $subject, $limit, $count, $flags);
- return new ReplaceResult($count, $result);
- }
- public static function replaceCallbackArray(array $pattern, $subject, int $limit = -1, int $flags = 0): ReplaceResult
- {
- $result = Preg::replaceCallbackArray($pattern, $subject, $limit, $count, $flags);
- return new ReplaceResult($count, $result);
- }
- }
- <?php
- namespace Composer\Pcre;
- final class ReplaceResult
- {
- public $result;
- public $count;
- public $matched;
- public function __construct($count, $result)
- {
- $this->count = $count;
- $this->matched = (bool) $count;
- $this->result = $result;
- }
- }
- Copyright (C) 2015 Composer
- Permission is hereby granted, free of charge, to any person obtaining a copy of
- this software and associated documentation files (the "Software"), to deal in
- the Software without restriction, including without limitation the rights to
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
- of the Software, and to permit persons to whom the Software is furnished to do
- so, subject to the following conditions:
- The above copyright notice and this permission notice shall be included in all
- copies or substantial portions of the Software.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- SOFTWARE.
- <?php
- namespace Composer\Semver;
- use Composer\Semver\Constraint\Constraint;
- class Comparator
- {
- public static function greaterThan($version1, $version2)
- {
- return self::compare($version1, '>', $version2);
- }
- public static function greaterThanOrEqualTo($version1, $version2)
- {
- return self::compare($version1, '>=', $version2);
- }
- public static function lessThan($version1, $version2)
- {
- return self::compare($version1, '<', $version2);
- }
- public static function lessThanOrEqualTo($version1, $version2)
- {
- return self::compare($version1, '<=', $version2);
- }
- public static function equalTo($version1, $version2)
- {
- return self::compare($version1, '==', $version2);
- }
- public static function notEqualTo($version1, $version2)
- {
- return self::compare($version1, '!=', $version2);
- }
- public static function compare($version1, $operator, $version2)
- {
- $constraint = new Constraint($operator, $version2);
- return $constraint->matchSpecific(new Constraint('==', $version1), true);
- }
- }
- <?php
- namespace Composer\Semver;
- use Composer\Semver\Constraint\Constraint;
- use Composer\Semver\Constraint\ConstraintInterface;
- class CompilingMatcher
- {
- private static $compiledCheckerCache = array();
- private static $resultCache = array();
- private static $enabled;
- private static $transOpInt = array(
- Constraint::OP_EQ => Constraint::STR_OP_EQ,
- Constraint::OP_LT => Constraint::STR_OP_LT,
- Constraint::OP_LE => Constraint::STR_OP_LE,
- Constraint::OP_GT => Constraint::STR_OP_GT,
- Constraint::OP_GE => Constraint::STR_OP_GE,
- Constraint::OP_NE => Constraint::STR_OP_NE,
- );
- public static function clear()
- {
- self::$resultCache = array();
- self::$compiledCheckerCache = array();
- }
- public static function match(ConstraintInterface $constraint, $operator, $version)
- {
- $resultCacheKey = $operator.$constraint.';'.$version;
- if (isset(self::$resultCache[$resultCacheKey])) {
- return self::$resultCache[$resultCacheKey];
- }
- if (self::$enabled === null) {
- self::$enabled = !\in_array('eval', explode(',', (string) ini_get('disable_functions')), true);
- }
- if (!self::$enabled) {
- return self::$resultCache[$resultCacheKey] = $constraint->matches(new Constraint(self::$transOpInt[$operator], $version));
- }
- $cacheKey = $operator.$constraint;
- if (!isset(self::$compiledCheckerCache[$cacheKey])) {
- $code = $constraint->compile($operator);
- self::$compiledCheckerCache[$cacheKey] = $function = eval('return function($v, $b){return '.$code.';};');
- } else {
- $function = self::$compiledCheckerCache[$cacheKey];
- }
- return self::$resultCache[$resultCacheKey] = $function($version, strpos($version, 'dev-') === 0);
- }
- }
- <?php
- namespace Composer\Semver\Constraint;
- class Bound
- {
- private $version;
- private $isInclusive;
- public function __construct($version, $isInclusive)
- {
- $this->version = $version;
- $this->isInclusive = $isInclusive;
- }
- public function getVersion()
- {
- return $this->version;
- }
- public function isInclusive()
- {
- return $this->isInclusive;
- }
- public function isZero()
- {
- return $this->getVersion() === '0.0.0.0-dev' && $this->isInclusive();
- }
- public function isPositiveInfinity()
- {
- return $this->getVersion() === PHP_INT_MAX.'.0.0.0' && !$this->isInclusive();
- }
- public function compareTo(Bound $other, $operator)
- {
- if (!\in_array($operator, array('<', '>'), true)) {
- throw new \InvalidArgumentException('Does not support any other operator other than > or <.');
- }
- if ($this == $other) {
- return false;
- }
- $compareResult = version_compare($this->getVersion(), $other->getVersion());
- if (0 !== $compareResult) {
- return (('>' === $operator) ? 1 : -1) === $compareResult;
- }
- return '>' === $operator ? $other->isInclusive() : !$other->isInclusive();
- }
- public function __toString()
- {
- return sprintf(
- '%s [%s]',
- $this->getVersion(),
- $this->isInclusive() ? 'inclusive' : 'exclusive'
- );
- }
- public static function zero()
- {
- return new Bound('0.0.0.0-dev', true);
- }
- public static function positiveInfinity()
- {
- return new Bound(PHP_INT_MAX.'.0.0.0', false);
- }
- }
- <?php
- namespace Composer\Semver\Constraint;
- class Constraint implements ConstraintInterface
- {
- const OP_EQ = 0;
- const OP_LT = 1;
- const OP_LE = 2;
- const OP_GT = 3;
- const OP_GE = 4;
- const OP_NE = 5;
- const STR_OP_EQ = '==';
- const STR_OP_EQ_ALT = '=';
- const STR_OP_LT = '<';
- const STR_OP_LE = '<=';
- const STR_OP_GT = '>';
- const STR_OP_GE = '>=';
- const STR_OP_NE = '!=';
- const STR_OP_NE_ALT = '<>';
- private static $transOpStr = array(
- '=' => self::OP_EQ,
- '==' => self::OP_EQ,
- '<' => self::OP_LT,
- '<=' => self::OP_LE,
- '>' => self::OP_GT,
- '>=' => self::OP_GE,
- '<>' => self::OP_NE,
- '!=' => self::OP_NE,
- );
- private static $transOpInt = array(
- self::OP_EQ => '==',
- self::OP_LT => '<',
- self::OP_LE => '<=',
- self::OP_GT => '>',
- self::OP_GE => '>=',
- self::OP_NE => '!=',
- );
- protected $operator;
- protected $version;
- protected $prettyString;
- protected $lowerBound;
- protected $upperBound;
- public function __construct($operator, $version)
- {
- if (!isset(self::$transOpStr[$operator])) {
- throw new \InvalidArgumentException(sprintf(
- 'Invalid operator "%s" given, expected one of: %s',
- $operator,
- implode(', ', self::getSupportedOperators())
- ));
- }
- $this->operator = self::$transOpStr[$operator];
- $this->version = $version;
- }
- public function getVersion()
- {
- return $this->version;
- }
- public function getOperator()
- {
- return self::$transOpInt[$this->operator];
- }
- public function matches(ConstraintInterface $provider)
- {
- if ($provider instanceof self) {
- return $this->matchSpecific($provider);
- }
- return $provider->matches($this);
- }
- public function setPrettyString($prettyString)
- {
- $this->prettyString = $prettyString;
- }
- public function getPrettyString()
- {
- if ($this->prettyString) {
- return $this->prettyString;
- }
- return $this->__toString();
- }
- public static function getSupportedOperators()
- {
- return array_keys(self::$transOpStr);
- }
- public static function getOperatorConstant($operator)
- {
- return self::$transOpStr[$operator];
- }
- public function versionCompare($a, $b, $operator, $compareBranches = false)
- {
- if (!isset(self::$transOpStr[$operator])) {
- throw new \InvalidArgumentException(sprintf(
- 'Invalid operator "%s" given, expected one of: %s',
- $operator,
- implode(', ', self::getSupportedOperators())
- ));
- }
- $aIsBranch = strpos($a, 'dev-') === 0;
- $bIsBranch = strpos($b, 'dev-') === 0;
- if ($operator === '!=' && ($aIsBranch || $bIsBranch)) {
- return $a !== $b;
- }
- if ($aIsBranch && $bIsBranch) {
- return $operator === '==' && $a === $b;
- }
- if (!$compareBranches && ($aIsBranch || $bIsBranch)) {
- return false;
- }
- return \version_compare($a, $b, $operator);
- }
- public function compile($otherOperator)
- {
- if (strpos($this->version, 'dev-') === 0) {
- if (self::OP_EQ === $this->operator) {
- if (self::OP_EQ === $otherOperator) {
- return sprintf('$b && $v === %s', \var_export($this->version, true));
- }
- if (self::OP_NE === $otherOperator) {
- return sprintf('!$b || $v !== %s', \var_export($this->version, true));
- }
- return 'false';
- }
- if (self::OP_NE === $this->operator) {
- if (self::OP_EQ === $otherOperator) {
- return sprintf('!$b || $v !== %s', \var_export($this->version, true));
- }
- if (self::OP_NE === $otherOperator) {
- return 'true';
- }
- return '!$b';
- }
- return 'false';
- }
- if (self::OP_EQ === $this->operator) {
- if (self::OP_EQ === $otherOperator) {
- return sprintf('\version_compare($v, %s, \'==\')', \var_export($this->version, true));
- }
- if (self::OP_NE === $otherOperator) {
- return sprintf('$b || \version_compare($v, %s, \'!=\')', \var_export($this->version, true));
- }
- return sprintf('!$b && \version_compare(%s, $v, \'%s\')', \var_export($this->version, true), self::$transOpInt[$otherOperator]);
- }
- if (self::OP_NE === $this->operator) {
- if (self::OP_EQ === $otherOperator) {
- return sprintf('$b || (!$b && \version_compare($v, %s, \'!=\'))', \var_export($this->version, true));
- }
- if (self::OP_NE === $otherOperator) {
- return 'true';
- }
- return '!$b';
- }
- if (self::OP_LT === $this->operator || self::OP_LE === $this->operator) {
- if (self::OP_LT === $otherOperator || self::OP_LE === $otherOperator) {
- return '!$b';
- }
- } else {
- if (self::OP_GT === $otherOperator || self::OP_GE === $otherOperator) {
- return '!$b';
- }
- }
- if (self::OP_NE === $otherOperator) {
- return 'true';
- }
- $codeComparison = sprintf('\version_compare($v, %s, \'%s\')', \var_export($this->version, true), self::$transOpInt[$this->operator]);
- if ($this->operator === self::OP_LE) {
- if ($otherOperator === self::OP_GT) {
- return sprintf('!$b && \version_compare($v, %s, \'!=\') && ', \var_export($this->version, true)) . $codeComparison;
- }
- } elseif ($this->operator === self::OP_GE) {
- if ($otherOperator === self::OP_LT) {
- return sprintf('!$b && \version_compare($v, %s, \'!=\') && ', \var_export($this->version, true)) . $codeComparison;
- }
- }
- return sprintf('!$b && %s', $codeComparison);
- }
- public function matchSpecific(Constraint $provider, $compareBranches = false)
- {
- $noEqualOp = str_replace('=', '', self::$transOpInt[$this->operator]);
- $providerNoEqualOp = str_replace('=', '', self::$transOpInt[$provider->operator]);
- $isEqualOp = self::OP_EQ === $this->operator;
- $isNonEqualOp = self::OP_NE === $this->operator;
- $isProviderEqualOp = self::OP_EQ === $provider->operator;
- $isProviderNonEqualOp = self::OP_NE === $provider->operator;
- if ($isNonEqualOp || $isProviderNonEqualOp) {
- if ($isNonEqualOp && !$isProviderNonEqualOp && !$isProviderEqualOp && strpos($provider->version, 'dev-') === 0) {
- return false;
- }
- if ($isProviderNonEqualOp && !$isNonEqualOp && !$isEqualOp && strpos($this->version, 'dev-') === 0) {
- return false;
- }
- if (!$isEqualOp && !$isProviderEqualOp) {
- return true;
- }
- return $this->versionCompare($provider->version, $this->version, '!=', $compareBranches);
- }
- if ($this->operator !== self::OP_EQ && $noEqualOp === $providerNoEqualOp) {
- return !(strpos($this->version, 'dev-') === 0 || strpos($provider->version, 'dev-') === 0);
- }
- $version1 = $isEqualOp ? $this->version : $provider->version;
- $version2 = $isEqualOp ? $provider->version : $this->version;
- $operator = $isEqualOp ? $provider->operator : $this->operator;
- if ($this->versionCompare($version1, $version2, self::$transOpInt[$operator], $compareBranches)) {
- return !(self::$transOpInt[$provider->operator] === $providerNoEqualOp
- && self::$transOpInt[$this->operator] !== $noEqualOp
- && \version_compare($provider->version, $this->version, '=='));
- }
- return false;
- }
- public function __toString()
- {
- return self::$transOpInt[$this->operator] . ' ' . $this->version;
- }
- public function getLowerBound()
- {
- $this->extractBounds();
- return $this->lowerBound;
- }
- public function getUpperBound()
- {
- $this->extractBounds();
- return $this->upperBound;
- }
- private function extractBounds()
- {
- if (null !== $this->lowerBound) {
- return;
- }
- if (strpos($this->version, 'dev-') === 0) {
- $this->lowerBound = Bound::zero();
- $this->upperBound = Bound::positiveInfinity();
- return;
- }
- switch ($this->operator) {
- case self::OP_EQ:
- $this->lowerBound = new Bound($this->version, true);
- $this->upperBound = new Bound($this->version, true);
- break;
- case self::OP_LT:
- $this->lowerBound = Bound::zero();
- $this->upperBound = new Bound($this->version, false);
- break;
- case self::OP_LE:
- $this->lowerBound = Bound::zero();
- $this->upperBound = new Bound($this->version, true);
- break;
- case self::OP_GT:
- $this->lowerBound = new Bound($this->version, false);
- $this->upperBound = Bound::positiveInfinity();
- break;
- case self::OP_GE:
- $this->lowerBound = new Bound($this->version, true);
- $this->upperBound = Bound::positiveInfinity();
- break;
- case self::OP_NE:
- $this->lowerBound = Bound::zero();
- $this->upperBound = Bound::positiveInfinity();
- break;
- }
- }
- }
- <?php
- namespace Composer\Semver\Constraint;
- interface ConstraintInterface
- {
- public function matches(ConstraintInterface $provider);
- public function compile($otherOperator);
- public function getUpperBound();
- public function getLowerBound();
- public function getPrettyString();
- public function setPrettyString($prettyString);
- public function __toString();
- }
- <?php
- namespace Composer\Semver\Constraint;
- class MatchAllConstraint implements ConstraintInterface
- {
- protected $prettyString;
- public function matches(ConstraintInterface $provider)
- {
- return true;
- }
- public function compile($otherOperator)
- {
- return 'true';
- }
- public function setPrettyString($prettyString)
- {
- $this->prettyString = $prettyString;
- }
- public function getPrettyString()
- {
- if ($this->prettyString) {
- return $this->prettyString;
- }
- return (string) $this;
- }
- public function __toString()
- {
- return '*';
- }
- public function getUpperBound()
- {
- return Bound::positiveInfinity();
- }
- public function getLowerBound()
- {
- return Bound::zero();
- }
- }
- <?php
- namespace Composer\Semver\Constraint;
- class MatchNoneConstraint implements ConstraintInterface
- {
- protected $prettyString;
- public function matches(ConstraintInterface $provider)
- {
- return false;
- }
- public function compile($otherOperator)
- {
- return 'false';
- }
- public function setPrettyString($prettyString)
- {
- $this->prettyString = $prettyString;
- }
- public function getPrettyString()
- {
- if ($this->prettyString) {
- return $this->prettyString;
- }
- return (string) $this;
- }
- public function __toString()
- {
- return '[]';
- }
- public function getUpperBound()
- {
- return new Bound('0.0.0.0-dev', false);
- }
- public function getLowerBound()
- {
- return new Bound('0.0.0.0-dev', false);
- }
- }
- <?php
- namespace Composer\Semver\Constraint;
- class MultiConstraint implements ConstraintInterface
- {
- protected $constraints;
- protected $prettyString;
- protected $string;
- protected $conjunctive;
- protected $lowerBound;
- protected $upperBound;
- public function __construct(array $constraints, $conjunctive = true)
- {
- if (\count($constraints) < 2) {
- throw new \InvalidArgumentException(
- 'Must provide at least two constraints for a MultiConstraint. Use '.
- 'the regular Constraint class for one constraint only or MatchAllConstraint for none. You may use '.
- 'MultiConstraint::create() which optimizes and handles those cases automatically.'
- );
- }
- $this->constraints = $constraints;
- $this->conjunctive = $conjunctive;
- }
- public function getConstraints()
- {
- return $this->constraints;
- }
- public function isConjunctive()
- {
- return $this->conjunctive;
- }
- public function isDisjunctive()
- {
- return !$this->conjunctive;
- }
- public function compile($otherOperator)
- {
- $parts = array();
- foreach ($this->constraints as $constraint) {
- $code = $constraint->compile($otherOperator);
- if ($code === 'true') {
- if (!$this->conjunctive) {
- return 'true';
- }
- } elseif ($code === 'false') {
- if ($this->conjunctive) {
- return 'false';
- }
- } else {
- $parts[] = '('.$code.')';
- }
- }
- if (!$parts) {
- return $this->conjunctive ? 'true' : 'false';
- }
- return $this->conjunctive ? implode('&&', $parts) : implode('||', $parts);
- }
- public function matches(ConstraintInterface $provider)
- {
- if (false === $this->conjunctive) {
- foreach ($this->constraints as $constraint) {
- if ($provider->matches($constraint)) {
- return true;
- }
- }
- return false;
- }
- if ($provider instanceof MultiConstraint && $provider->isDisjunctive()) {
- return $provider->matches($this);
- }
- foreach ($this->constraints as $constraint) {
- if (!$provider->matches($constraint)) {
- return false;
- }
- }
- return true;
- }
- public function setPrettyString($prettyString)
- {
- $this->prettyString = $prettyString;
- }
- public function getPrettyString()
- {
- if ($this->prettyString) {
- return $this->prettyString;
- }
- return (string) $this;
- }
- public function __toString()
- {
- if ($this->string !== null) {
- return $this->string;
- }
- $constraints = array();
- foreach ($this->constraints as $constraint) {
- $constraints[] = (string) $constraint;
- }
- return $this->string = '[' . implode($this->conjunctive ? ' ' : ' || ', $constraints) . ']';
- }
- public function getLowerBound()
- {
- $this->extractBounds();
- if (null === $this->lowerBound) {
- throw new \LogicException('extractBounds should have populated the lowerBound property');
- }
- return $this->lowerBound;
- }
- public function getUpperBound()
- {
- $this->extractBounds();
- if (null === $this->upperBound) {
- throw new \LogicException('extractBounds should have populated the upperBound property');
- }
- return $this->upperBound;
- }
- public static function create(array $constraints, $conjunctive = true)
- {
- if (0 === \count($constraints)) {
- return new MatchAllConstraint();
- }
- if (1 === \count($constraints)) {
- return $constraints[0];
- }
- $optimized = self::optimizeConstraints($constraints, $conjunctive);
- if ($optimized !== null) {
- list($constraints, $conjunctive) = $optimized;
- if (\count($constraints) === 1) {
- return $constraints[0];
- }
- }
- return new self($constraints, $conjunctive);
- }
- private static function optimizeConstraints(array $constraints, $conjunctive)
- {
- if (!$conjunctive) {
- $left = $constraints[0];
- $mergedConstraints = array();
- $optimized = false;
- for ($i = 1, $l = \count($constraints); $i < $l; $i++) {
- $right = $constraints[$i];
- if (
- $left instanceof self
- && $left->conjunctive
- && $right instanceof self
- && $right->conjunctive
- && \count($left->constraints) === 2
- && \count($right->constraints) === 2
- && ($left0 = (string) $left->constraints[0])
- && $left0[0] === '>' && $left0[1] === '='
- && ($left1 = (string) $left->constraints[1])
- && $left1[0] === '<'
- && ($right0 = (string) $right->constraints[0])
- && $right0[0] === '>' && $right0[1] === '='
- && ($right1 = (string) $right->constraints[1])
- && $right1[0] === '<'
- && substr($left1, 2) === substr($right0, 3)
- ) {
- $optimized = true;
- $left = new MultiConstraint(
- array(
- $left->constraints[0],
- $right->constraints[1],
- ),
- true);
- } else {
- $mergedConstraints[] = $left;
- $left = $right;
- }
- }
- if ($optimized) {
- $mergedConstraints[] = $left;
- return array($mergedConstraints, false);
- }
- }
- return null;
- }
- private function extractBounds()
- {
- if (null !== $this->lowerBound) {
- return;
- }
- foreach ($this->constraints as $constraint) {
- if (null === $this->lowerBound || null === $this->upperBound) {
- $this->lowerBound = $constraint->getLowerBound();
- $this->upperBound = $constraint->getUpperBound();
- continue;
- }
- if ($constraint->getLowerBound()->compareTo($this->lowerBound, $this->isConjunctive() ? '>' : '<')) {
- $this->lowerBound = $constraint->getLowerBound();
- }
- if ($constraint->getUpperBound()->compareTo($this->upperBound, $this->isConjunctive() ? '<' : '>')) {
- $this->upperBound = $constraint->getUpperBound();
- }
- }
- }
- }
- <?php
- namespace Composer\Semver;
- use Composer\Semver\Constraint\Constraint;
- class Interval
- {
- private $start;
- private $end;
- public function __construct(Constraint $start, Constraint $end)
- {
- $this->start = $start;
- $this->end = $end;
- }
- public function getStart()
- {
- return $this->start;
- }
- public function getEnd()
- {
- return $this->end;
- }
- public static function fromZero()
- {
- static $zero;
- if (null === $zero) {
- $zero = new Constraint('>=', '0.0.0.0-dev');
- }
- return $zero;
- }
- public static function untilPositiveInfinity()
- {
- static $positiveInfinity;
- if (null === $positiveInfinity) {
- $positiveInfinity = new Constraint('<', PHP_INT_MAX.'.0.0.0');
- }
- return $positiveInfinity;
- }
- public static function any()
- {
- return new self(self::fromZero(), self::untilPositiveInfinity());
- }
- public static function anyDev()
- {
- return array('names' => array(), 'exclude' => true);
- }
- public static function noDev()
- {
- return array('names' => array(), 'exclude' => false);
- }
- }
- <?php
- namespace Composer\Semver;
- use Composer\Semver\Constraint\Constraint;
- use Composer\Semver\Constraint\ConstraintInterface;
- use Composer\Semver\Constraint\MatchAllConstraint;
- use Composer\Semver\Constraint\MatchNoneConstraint;
- use Composer\Semver\Constraint\MultiConstraint;
- class Intervals
- {
- private static $intervalsCache = array();
- private static $opSortOrder = array(
- '>=' => -3,
- '<' => -2,
- '>' => 2,
- '<=' => 3,
- );
- public static function clear()
- {
- self::$intervalsCache = array();
- }
- public static function isSubsetOf(ConstraintInterface $candidate, ConstraintInterface $constraint)
- {
- if ($constraint instanceof MatchAllConstraint) {
- return true;
- }
- if ($candidate instanceof MatchNoneConstraint || $constraint instanceof MatchNoneConstraint) {
- return false;
- }
- $intersectionIntervals = self::get(new MultiConstraint(array($candidate, $constraint), true));
- $candidateIntervals = self::get($candidate);
- if (\count($intersectionIntervals['numeric']) !== \count($candidateIntervals['numeric'])) {
- return false;
- }
- foreach ($intersectionIntervals['numeric'] as $index => $interval) {
- if (!isset($candidateIntervals['numeric'][$index])) {
- return false;
- }
- if ((string) $candidateIntervals['numeric'][$index]->getStart() !== (string) $interval->getStart()) {
- return false;
- }
- if ((string) $candidateIntervals['numeric'][$index]->getEnd() !== (string) $interval->getEnd()) {
- return false;
- }
- }
- if ($intersectionIntervals['branches']['exclude'] !== $candidateIntervals['branches']['exclude']) {
- return false;
- }
- if (\count($intersectionIntervals['branches']['names']) !== \count($candidateIntervals['branches']['names'])) {
- return false;
- }
- foreach ($intersectionIntervals['branches']['names'] as $index => $name) {
- if ($name !== $candidateIntervals['branches']['names'][$index]) {
- return false;
- }
- }
- return true;
- }
- public static function haveIntersections(ConstraintInterface $a, ConstraintInterface $b)
- {
- if ($a instanceof MatchAllConstraint || $b instanceof MatchAllConstraint) {
- return true;
- }
- if ($a instanceof MatchNoneConstraint || $b instanceof MatchNoneConstraint) {
- return false;
- }
- $intersectionIntervals = self::generateIntervals(new MultiConstraint(array($a, $b), true), true);
- return \count($intersectionIntervals['numeric']) > 0 || $intersectionIntervals['branches']['exclude'] || \count($intersectionIntervals['branches']['names']) > 0;
- }
- public static function compactConstraint(ConstraintInterface $constraint)
- {
- if (!$constraint instanceof MultiConstraint) {
- return $constraint;
- }
- $intervals = self::generateIntervals($constraint);
- $constraints = array();
- $hasNumericMatchAll = false;
- if (\count($intervals['numeric']) === 1 && (string) $intervals['numeric'][0]->getStart() === (string) Interval::fromZero() && (string) $intervals['numeric'][0]->getEnd() === (string) Interval::untilPositiveInfinity()) {
- $constraints[] = $intervals['numeric'][0]->getStart();
- $hasNumericMatchAll = true;
- } else {
- $unEqualConstraints = array();
- for ($i = 0, $count = \count($intervals['numeric']); $i < $count; $i++) {
- $interval = $intervals['numeric'][$i];
- if ($interval->getEnd()->getOperator() === '<' && $i+1 < $count) {
- $nextInterval = $intervals['numeric'][$i+1];
- if ($interval->getEnd()->getVersion() === $nextInterval->getStart()->getVersion() && $nextInterval->getStart()->getOperator() === '>') {
- if (\count($unEqualConstraints) === 0 && (string) $interval->getStart() !== (string) Interval::fromZero()) {
- $unEqualConstraints[] = $interval->getStart();
- }
- $unEqualConstraints[] = new Constraint('!=', $interval->getEnd()->getVersion());
- continue;
- }
- }
- if (\count($unEqualConstraints) > 0) {
- if ((string) $interval->getEnd() !== (string) Interval::untilPositiveInfinity()) {
- $unEqualConstraints[] = $interval->getEnd();
- }
- if (\count($unEqualConstraints) > 1) {
- $constraints[] = new MultiConstraint($unEqualConstraints, true);
- } else {
- $constraints[] = $unEqualConstraints[0];
- }
- $unEqualConstraints = array();
- continue;
- }
- if ($interval->getStart()->getVersion() === $interval->getEnd()->getVersion() && $interval->getStart()->getOperator() === '>=' && $interval->getEnd()->getOperator() === '<=') {
- $constraints[] = new Constraint('==', $interval->getStart()->getVersion());
- continue;
- }
- if ((string) $interval->getStart() === (string) Interval::fromZero()) {
- $constraints[] = $interval->getEnd();
- } elseif ((string) $interval->getEnd() === (string) Interval::untilPositiveInfinity()) {
- $constraints[] = $interval->getStart();
- } else {
- $constraints[] = new MultiConstraint(array($interval->getStart(), $interval->getEnd()), true);
- }
- }
- }
- $devConstraints = array();
- if (0 === \count($intervals['branches']['names'])) {
- if ($intervals['branches']['exclude']) {
- if ($hasNumericMatchAll) {
- return new MatchAllConstraint;
- }
- }
- } else {
- foreach ($intervals['branches']['names'] as $branchName) {
- if ($intervals['branches']['exclude']) {
- $devConstraints[] = new Constraint('!=', $branchName);
- } else {
- $devConstraints[] = new Constraint('==', $branchName);
- }
- }
- if ($intervals['branches']['exclude']) {
- if (\count($constraints) > 1) {
- return new MultiConstraint(array_merge(
- array(new MultiConstraint($constraints, false)),
- $devConstraints
- ), true);
- }
- if (\count($constraints) === 1 && (string)$constraints[0] === (string)Interval::fromZero()) {
- if (\count($devConstraints) > 1) {
- return new MultiConstraint($devConstraints, true);
- }
- return $devConstraints[0];
- }
- return new MultiConstraint(array_merge($constraints, $devConstraints), true);
- }
- $constraints = array_merge($constraints, $devConstraints);
- }
- if (\count($constraints) > 1) {
- return new MultiConstraint($constraints, false);
- }
- if (\count($constraints) === 1) {
- return $constraints[0];
- }
- return new MatchNoneConstraint;
- }
- public static function get(ConstraintInterface $constraint)
- {
- $key = (string) $constraint;
- if (!isset(self::$intervalsCache[$key])) {
- self::$intervalsCache[$key] = self::generateIntervals($constraint);
- }
- return self::$intervalsCache[$key];
- }
- private static function generateIntervals(ConstraintInterface $constraint, $stopOnFirstValidInterval = false)
- {
- if ($constraint instanceof MatchAllConstraint) {
- return array('numeric' => array(new Interval(Interval::fromZero(), Interval::untilPositiveInfinity())), 'branches' => Interval::anyDev());
- }
- if ($constraint instanceof MatchNoneConstraint) {
- return array('numeric' => array(), 'branches' => array('names' => array(), 'exclude' => false));
- }
- if ($constraint instanceof Constraint) {
- return self::generateSingleConstraintIntervals($constraint);
- }
- if (!$constraint instanceof MultiConstraint) {
- throw new \UnexpectedValueException('The constraint passed in should be an MatchAllConstraint, Constraint or MultiConstraint instance, got '.\get_class($constraint).'.');
- }
- $constraints = $constraint->getConstraints();
- $numericGroups = array();
- $constraintBranches = array();
- foreach ($constraints as $c) {
- $res = self::get($c);
- $numericGroups[] = $res['numeric'];
- $constraintBranches[] = $res['branches'];
- }
- if ($constraint->isDisjunctive()) {
- $branches = Interval::noDev();
- foreach ($constraintBranches as $b) {
- if ($b['exclude']) {
- if ($branches['exclude']) {
- $branches['names'] = array_intersect($branches['names'], $b['names']);
- } else {
- $branches['exclude'] = true;
- $branches['names'] = array_diff($b['names'], $branches['names']);
- }
- } else {
- if ($branches['exclude']) {
- $branches['names'] = array_diff($branches['names'], $b['names']);
- } else {
- $branches['names'] = array_merge($branches['names'], $b['names']);
- }
- }
- }
- } else {
- $branches = Interval::anyDev();
- foreach ($constraintBranches as $b) {
- if ($b['exclude']) {
- if ($branches['exclude']) {
- $branches['names'] = array_merge($branches['names'], $b['names']);
- } else {
- $branches['names'] = array_diff($branches['names'], $b['names']);
- }
- } else {
- if ($branches['exclude']) {
- $branches['names'] = array_diff($b['names'], $branches['names']);
- $branches['exclude'] = false;
- } else {
- $branches['names'] = array_intersect($branches['names'], $b['names']);
- }
- }
- }
- }
- $branches['names'] = array_unique($branches['names']);
- if (\count($numericGroups) === 1) {
- return array('numeric' => $numericGroups[0], 'branches' => $branches);
- }
- $borders = array();
- foreach ($numericGroups as $group) {
- foreach ($group as $interval) {
- $borders[] = array('version' => $interval->getStart()->getVersion(), 'operator' => $interval->getStart()->getOperator(), 'side' => 'start');
- $borders[] = array('version' => $interval->getEnd()->getVersion(), 'operator' => $interval->getEnd()->getOperator(), 'side' => 'end');
- }
- }
- $opSortOrder = self::$opSortOrder;
- usort($borders, function ($a, $b) use ($opSortOrder) {
- $order = version_compare($a['version'], $b['version']);
- if ($order === 0) {
- return $opSortOrder[$a['operator']] - $opSortOrder[$b['operator']];
- }
- return $order;
- });
- $activeIntervals = 0;
- $intervals = array();
- $index = 0;
- $activationThreshold = $constraint->isConjunctive() ? \count($numericGroups) : 1;
- $start = null;
- foreach ($borders as $border) {
- if ($border['side'] === 'start') {
- $activeIntervals++;
- } else {
- $activeIntervals--;
- }
- if (!$start && $activeIntervals >= $activationThreshold) {
- $start = new Constraint($border['operator'], $border['version']);
- } elseif ($start && $activeIntervals < $activationThreshold) {
- if (
- version_compare($start->getVersion(), $border['version'], '=')
- && (
- ($start->getOperator() === '>' && $border['operator'] === '<=')
- || ($start->getOperator() === '>=' && $border['operator'] === '<')
- )
- ) {
- unset($intervals[$index]);
- } else {
- $intervals[$index] = new Interval($start, new Constraint($border['operator'], $border['version']));
- $index++;
- if ($stopOnFirstValidInterval) {
- break;
- }
- }
- $start = null;
- }
- }
- return array('numeric' => $intervals, 'branches' => $branches);
- }
- private static function generateSingleConstraintIntervals(Constraint $constraint)
- {
- $op = $constraint->getOperator();
- if (strpos($constraint->getVersion(), 'dev-') === 0) {
- $intervals = array();
- $branches = array('names' => array(), 'exclude' => false);
- if ($op === '!=') {
- $intervals[] = new Interval(Interval::fromZero(), Interval::untilPositiveInfinity());
- $branches = array('names' => array($constraint->getVersion()), 'exclude' => true);
- } elseif ($op === '==') {
- $branches['names'][] = $constraint->getVersion();
- }
- return array(
- 'numeric' => $intervals,
- 'branches' => $branches,
- );
- }
- if ($op[0] === '>') {
- return array('numeric' => array(new Interval($constraint, Interval::untilPositiveInfinity())), 'branches' => Interval::noDev());
- }
- if ($op[0] === '<') {
- return array('numeric' => array(new Interval(Interval::fromZero(), $constraint)), 'branches' => Interval::noDev());
- }
- if ($op === '!=') {
- return array('numeric' => array(
- new Interval(Interval::fromZero(), new Constraint('<', $constraint->getVersion())),
- new Interval(new Constraint('>', $constraint->getVersion()), Interval::untilPositiveInfinity()),
- ), 'branches' => Interval::anyDev());
- }
- return array('numeric' => array(
- new Interval(new Constraint('>=', $constraint->getVersion()), new Constraint('<=', $constraint->getVersion())),
- ), 'branches' => Interval::noDev());
- }
- }
- <?php
- namespace Composer\Semver;
- use Composer\Semver\Constraint\Constraint;
- class Semver
- {
- const SORT_ASC = 1;
- const SORT_DESC = -1;
- private static $versionParser;
- public static function satisfies($version, $constraints)
- {
- if (null === self::$versionParser) {
- self::$versionParser = new VersionParser();
- }
- $versionParser = self::$versionParser;
- $provider = new Constraint('==', $versionParser->normalize($version));
- $parsedConstraints = $versionParser->parseConstraints($constraints);
- return $parsedConstraints->matches($provider);
- }
- public static function satisfiedBy(array $versions, $constraints)
- {
- $versions = array_filter($versions, function ($version) use ($constraints) {
- return Semver::satisfies($version, $constraints);
- });
- return array_values($versions);
- }
- public static function sort(array $versions)
- {
- return self::usort($versions, self::SORT_ASC);
- }
- public static function rsort(array $versions)
- {
- return self::usort($versions, self::SORT_DESC);
- }
- private static function usort(array $versions, $direction)
- {
- if (null === self::$versionParser) {
- self::$versionParser = new VersionParser();
- }
- $versionParser = self::$versionParser;
- $normalized = array();
- foreach ($versions as $key => $version) {
- $normalizedVersion = $versionParser->normalize($version);
- $normalizedVersion = $versionParser->normalizeDefaultBranch($normalizedVersion);
- $normalized[] = array($normalizedVersion, $key);
- }
- usort($normalized, function (array $left, array $right) use ($direction) {
- if ($left[0] === $right[0]) {
- return 0;
- }
- if (Comparator::lessThan($left[0], $right[0])) {
- return -$direction;
- }
- return $direction;
- });
- $sorted = array();
- foreach ($normalized as $item) {
- $sorted[] = $versions[$item[1]];
- }
- return $sorted;
- }
- }
- <?php
- namespace Composer\Semver;
- use Composer\Semver\Constraint\ConstraintInterface;
- use Composer\Semver\Constraint\MatchAllConstraint;
- use Composer\Semver\Constraint\MultiConstraint;
- use Composer\Semver\Constraint\Constraint;
- class VersionParser
- {
- private static $modifierRegex = '[._-]?(?:(stable|beta|b|RC|alpha|a|patch|pl|p)((?:[.-]?\d+)*+)?)?([.-]?dev)?';
- private static $stabilitiesRegex = 'stable|RC|beta|alpha|dev';
- public static function parseStability($version)
- {
- $version = (string) preg_replace('{#.+$}', '', (string) $version);
- if (strpos($version, 'dev-') === 0 || '-dev' === substr($version, -4)) {
- return 'dev';
- }
- preg_match('{' . self::$modifierRegex . '(?:\+.*)?$}i', strtolower($version), $match);
- if (!empty($match[3])) {
- return 'dev';
- }
- if (!empty($match[1])) {
- if ('beta' === $match[1] || 'b' === $match[1]) {
- return 'beta';
- }
- if ('alpha' === $match[1] || 'a' === $match[1]) {
- return 'alpha';
- }
- if ('rc' === $match[1]) {
- return 'RC';
- }
- }
- return 'stable';
- }
- public static function normalizeStability($stability)
- {
- $stability = strtolower((string) $stability);
- return $stability === 'rc' ? 'RC' : $stability;
- }
- public function normalize($version, $fullVersion = null)
- {
- $version = trim((string) $version);
- $origVersion = $version;
- if (null === $fullVersion) {
- $fullVersion = $version;
- }
- if (preg_match('{^([^,\s]++) ++as ++([^,\s]++)$}', $version, $match)) {
- $version = $match[1];
- }
- if (preg_match('{@(?:' . self::$stabilitiesRegex . ')$}i', $version, $match)) {
- $version = substr($version, 0, strlen($version) - strlen($match[0]));
- }
- if (\in_array($version, array('master', 'trunk', 'default'), true)) {
- $version = 'dev-' . $version;
- }
- if (stripos($version, 'dev-') === 0) {
- return 'dev-' . substr($version, 4);
- }
- if (preg_match('{^([^,\s+]++)\+[^\s]++$}', $version, $match)) {
- $version = $match[1];
- }
- if (preg_match('{^v?(\d{1,5})(\.\d++)?(\.\d++)?(\.\d++)?' . self::$modifierRegex . '$}i', $version, $matches)) {
- $version = $matches[1]
- . (!empty($matches[2]) ? $matches[2] : '.0')
- . (!empty($matches[3]) ? $matches[3] : '.0')
- . (!empty($matches[4]) ? $matches[4] : '.0');
- $index = 5;
- } elseif (preg_match('{^v?(\d{4}(?:[.:-]?\d{2}){1,6}(?:[.:-]?\d{1,3})?)' . self::$modifierRegex . '$}i', $version, $matches)) {
- $version = preg_replace('{\D}', '.', $matches[1]);
- $index = 2;
- }
- if (isset($index)) {
- if (!empty($matches[$index])) {
- if ('stable' === $matches[$index]) {
- return $version;
- }
- $version .= '-' . $this->expandStability($matches[$index]) . (isset($matches[$index + 1]) && '' !== $matches[$index + 1] ? ltrim($matches[$index + 1], '.-') : '');
- }
- if (!empty($matches[$index + 2])) {
- $version .= '-dev';
- }
- return $version;
- }
- if (preg_match('{(.*?)[.-]?dev$}i', $version, $match)) {
- try {
- $normalized = $this->normalizeBranch($match[1]);
- if (strpos($normalized, 'dev-') === false) {
- return $normalized;
- }
- } catch (\Exception $e) {
- }
- }
- $extraMessage = '';
- if (preg_match('{ +as +' . preg_quote($version) . '(?:@(?:'.self::$stabilitiesRegex.'))?$}', $fullVersion)) {
- $extraMessage = ' in "' . $fullVersion . '", the alias must be an exact version';
- } elseif (preg_match('{^' . preg_quote($version) . '(?:@(?:'.self::$stabilitiesRegex.'))? +as +}', $fullVersion)) {
- $extraMessage = ' in "' . $fullVersion . '", the alias source must be an exact version, if it is a branch name you should prefix it with dev-';
- }
- throw new \UnexpectedValueException('Invalid version string "' . $origVersion . '"' . $extraMessage);
- }
- public function parseNumericAliasPrefix($branch)
- {
- if (preg_match('{^(?P<version>(\d++\\.)*\d++)(?:\.x)?-dev$}i', (string) $branch, $matches)) {
- return $matches['version'] . '.';
- }
- return false;
- }
- public function normalizeBranch($name)
- {
- $name = trim((string) $name);
- if (preg_match('{^v?(\d++)(\.(?:\d++|[xX*]))?(\.(?:\d++|[xX*]))?(\.(?:\d++|[xX*]))?$}i', $name, $matches)) {
- $version = '';
- for ($i = 1; $i < 5; ++$i) {
- $version .= isset($matches[$i]) ? str_replace(array('*', 'X'), 'x', $matches[$i]) : '.x';
- }
- return str_replace('x', '9999999', $version) . '-dev';
- }
- return 'dev-' . $name;
- }
- public function normalizeDefaultBranch($name)
- {
- if ($name === 'dev-master' || $name === 'dev-default' || $name === 'dev-trunk') {
- return '9999999-dev';
- }
- return (string) $name;
- }
- public function parseConstraints($constraints)
- {
- $prettyConstraint = (string) $constraints;
- $orConstraints = preg_split('{\s*\|\|?\s*}', trim((string) $constraints));
- if (false === $orConstraints) {
- throw new \RuntimeException('Failed to preg_split string: '.$constraints);
- }
- $orGroups = array();
- foreach ($orConstraints as $constraints) {
- $andConstraints = preg_split('{(?<!^|as|[=>< ,]) *(?<!-)[, ](?!-) *(?!,|as|$)}', $constraints);
- if (false === $andConstraints) {
- throw new \RuntimeException('Failed to preg_split string: '.$constraints);
- }
- if (\count($andConstraints) > 1) {
- $constraintObjects = array();
- foreach ($andConstraints as $constraint) {
- foreach ($this->parseConstraint($constraint) as $parsedConstraint) {
- $constraintObjects[] = $parsedConstraint;
- }
- }
- } else {
- $constraintObjects = $this->parseConstraint($andConstraints[0]);
- }
- if (1 === \count($constraintObjects)) {
- $constraint = $constraintObjects[0];
- } else {
- $constraint = new MultiConstraint($constraintObjects);
- }
- $orGroups[] = $constraint;
- }
- $constraint = MultiConstraint::create($orGroups, false);
- $constraint->setPrettyString($prettyConstraint);
- return $constraint;
- }
- private function parseConstraint($constraint)
- {
- if (preg_match('{^([^,\s]++) ++as ++([^,\s]++)$}', $constraint, $match)) {
- $constraint = $match[1];
- }
- if (preg_match('{^([^,\s]*?)@(' . self::$stabilitiesRegex . ')$}i', $constraint, $match)) {
- $constraint = '' !== $match[1] ? $match[1] : '*';
- if ($match[2] !== 'stable') {
- $stabilityModifier = $match[2];
- }
- }
- if (preg_match('{^(dev-[^,\s@]+?|[^,\s@]+?\.x-dev)#.+$}i', $constraint, $match)) {
- $constraint = $match[1];
- }
- if (preg_match('{^(v)?[xX*](\.[xX*])*$}i', $constraint, $match)) {
- if (!empty($match[1]) || !empty($match[2])) {
- return array(new Constraint('>=', '0.0.0.0-dev'));
- }
- return array(new MatchAllConstraint());
- }
- $versionRegex = 'v?(\d++)(?:\.(\d++))?(?:\.(\d++))?(?:\.(\d++))?(?:' . self::$modifierRegex . '|\.([xX*][.-]?dev))(?:\+[^\s]+)?';
- if (preg_match('{^~>?' . $versionRegex . '$}i', $constraint, $matches)) {
- if (strpos($constraint, '~>') === 0) {
- throw new \UnexpectedValueException(
- 'Could not parse version constraint ' . $constraint . ': ' .
- 'Invalid operator "~>", you probably meant to use the "~" operator'
- );
- }
- if (isset($matches[4]) && '' !== $matches[4] && null !== $matches[4]) {
- $position = 4;
- } elseif (isset($matches[3]) && '' !== $matches[3] && null !== $matches[3]) {
- $position = 3;
- } elseif (isset($matches[2]) && '' !== $matches[2] && null !== $matches[2]) {
- $position = 2;
- } else {
- $position = 1;
- }
- if (!empty($matches[8])) {
- $position++;
- }
- $stabilitySuffix = '';
- if (empty($matches[5]) && empty($matches[7]) && empty($matches[8])) {
- $stabilitySuffix .= '-dev';
- }
- $lowVersion = $this->normalize(substr($constraint . $stabilitySuffix, 1));
- $lowerBound = new Constraint('>=', $lowVersion);
- $highPosition = max(1, $position - 1);
- $highVersion = $this->manipulateVersionString($matches, $highPosition, 1) . '-dev';
- $upperBound = new Constraint('<', $highVersion);
- return array(
- $lowerBound,
- $upperBound,
- );
- }
- if (preg_match('{^\^' . $versionRegex . '($)}i', $constraint, $matches)) {
- if ('0' !== $matches[1] || '' === $matches[2] || null === $matches[2]) {
- $position = 1;
- } elseif ('0' !== $matches[2] || '' === $matches[3] || null === $matches[3]) {
- $position = 2;
- } else {
- $position = 3;
- }
- $stabilitySuffix = '';
- if (empty($matches[5]) && empty($matches[7]) && empty($matches[8])) {
- $stabilitySuffix .= '-dev';
- }
- $lowVersion = $this->normalize(substr($constraint . $stabilitySuffix, 1));
- $lowerBound = new Constraint('>=', $lowVersion);
- $highVersion = $this->manipulateVersionString($matches, $position, 1) . '-dev';
- $upperBound = new Constraint('<', $highVersion);
- return array(
- $lowerBound,
- $upperBound,
- );
- }
- if (preg_match('{^v?(\d++)(?:\.(\d++))?(?:\.(\d++))?(?:\.[xX*])++$}', $constraint, $matches)) {
- if (isset($matches[3]) && '' !== $matches[3] && null !== $matches[3]) {
- $position = 3;
- } elseif (isset($matches[2]) && '' !== $matches[2] && null !== $matches[2]) {
- $position = 2;
- } else {
- $position = 1;
- }
- $lowVersion = $this->manipulateVersionString($matches, $position) . '-dev';
- $highVersion = $this->manipulateVersionString($matches, $position, 1) . '-dev';
- if ($lowVersion === '0.0.0.0-dev') {
- return array(new Constraint('<', $highVersion));
- }
- return array(
- new Constraint('>=', $lowVersion),
- new Constraint('<', $highVersion),
- );
- }
- if (preg_match('{^(?P<from>' . $versionRegex . ') +- +(?P<to>' . $versionRegex . ')($)}i', $constraint, $matches)) {
- $lowStabilitySuffix = '';
- if (empty($matches[6]) && empty($matches[8]) && empty($matches[9])) {
- $lowStabilitySuffix = '-dev';
- }
- $lowVersion = $this->normalize($matches['from']);
- $lowerBound = new Constraint('>=', $lowVersion . $lowStabilitySuffix);
- $empty = function ($x) {
- return ($x === 0 || $x === '0') ? false : empty($x);
- };
- if ((!$empty($matches[12]) && !$empty($matches[13])) || !empty($matches[15]) || !empty($matches[17]) || !empty($matches[18])) {
- $highVersion = $this->normalize($matches['to']);
- $upperBound = new Constraint('<=', $highVersion);
- } else {
- $highMatch = array('', $matches[11], $matches[12], $matches[13], $matches[14]);
- $this->normalize($matches['to']);
- $highVersion = $this->manipulateVersionString($highMatch, $empty($matches[12]) ? 1 : 2, 1) . '-dev';
- $upperBound = new Constraint('<', $highVersion);
- }
- return array(
- $lowerBound,
- $upperBound,
- );
- }
- if (preg_match('{^(<>|!=|>=?|<=?|==?)?\s*(.*)}', $constraint, $matches)) {
- try {
- try {
- $version = $this->normalize($matches[2]);
- } catch (\UnexpectedValueException $e) {
- if (substr($matches[2], -4) === '-dev' && preg_match('{^[0-9a-zA-Z-./]+$}', $matches[2])) {
- $version = $this->normalize('dev-'.substr($matches[2], 0, -4));
- } else {
- throw $e;
- }
- }
- $op = $matches[1] ?: '=';
- if ($op !== '==' && $op !== '=' && !empty($stabilityModifier) && self::parseStability($version) === 'stable') {
- $version .= '-' . $stabilityModifier;
- } elseif ('<' === $op || '>=' === $op) {
- if (!preg_match('/-' . self::$modifierRegex . '$/', strtolower($matches[2]))) {
- if (strpos($matches[2], 'dev-') !== 0) {
- $version .= '-dev';
- }
- }
- }
- return array(new Constraint($matches[1] ?: '=', $version));
- } catch (\Exception $e) {
- }
- }
- $message = 'Could not parse version constraint ' . $constraint;
- if (isset($e)) {
- $message .= ': ' . $e->getMessage();
- }
- throw new \UnexpectedValueException($message);
- }
- private function manipulateVersionString(array $matches, $position, $increment = 0, $pad = '0')
- {
- for ($i = 4; $i > 0; --$i) {
- if ($i > $position) {
- $matches[$i] = $pad;
- } elseif ($i === $position && $increment) {
- $matches[$i] += $increment;
- if ($matches[$i] < 0) {
- $matches[$i] = $pad;
- --$position;
- if ($i === 1) {
- return null;
- }
- }
- }
- }
- return $matches[1] . '.' . $matches[2] . '.' . $matches[3] . '.' . $matches[4];
- }
- private function expandStability($stability)
- {
- $stability = strtolower($stability);
- switch ($stability) {
- case 'a':
- return 'alpha';
- case 'b':
- return 'beta';
- case 'p':
- case 'pl':
- return 'patch';
- case 'rc':
- return 'RC';
- default:
- return $stability;
- }
- }
- }
- Copyright (C) 2015 Composer
- Permission is hereby granted, free of charge, to any person obtaining a copy of
- this software and associated documentation files (the "Software"), to deal in
- the Software without restriction, including without limitation the rights to
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
- of the Software, and to permit persons to whom the Software is furnished to do
- so, subject to the following conditions:
- The above copyright notice and this permission notice shall be included in all
- copies or substantial portions of the Software.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- SOFTWARE.
- {
- "389-exception": [
- "389 Directory Server Exception"
- ],
- "Autoconf-exception-2.0": [
- "Autoconf exception 2.0"
- ],
- "Autoconf-exception-3.0": [
- "Autoconf exception 3.0"
- ],
- "Bison-exception-2.2": [
- "Bison exception 2.2"
- ],
- "Bootloader-exception": [
- "Bootloader Distribution Exception"
- ],
- "Classpath-exception-2.0": [
- "Classpath exception 2.0"
- ],
- "CLISP-exception-2.0": [
- "CLISP exception 2.0"
- ],
- "DigiRule-FOSS-exception": [
- "DigiRule FOSS License Exception"
- ],
- "eCos-exception-2.0": [
- "eCos exception 2.0"
- ],
- "Fawkes-Runtime-exception": [
- "Fawkes Runtime Exception"
- ],
- "FLTK-exception": [
- "FLTK exception"
- ],
- "Font-exception-2.0": [
- "Font exception 2.0"
- ],
- "freertos-exception-2.0": [
- "FreeRTOS Exception 2.0"
- ],
- "GCC-exception-2.0": [
- "GCC Runtime Library exception 2.0"
- ],
- "GCC-exception-3.1": [
- "GCC Runtime Library exception 3.1"
- ],
- "gnu-javamail-exception": [
- "GNU JavaMail exception"
- ],
- "GPL-3.0-linking-exception": [
- "GPL-3.0 Linking Exception"
- ],
- "GPL-3.0-linking-source-exception": [
- "GPL-3.0 Linking Exception (with Corresponding Source)"
- ],
- "GPL-CC-1.0": [
- "GPL Cooperation Commitment 1.0"
- ],
- "i2p-gpl-java-exception": [
- "i2p GPL+Java Exception"
- ],
- "LGPL-3.0-linking-exception": [
- "LGPL-3.0 Linking Exception"
- ],
- "Libtool-exception": [
- "Libtool Exception"
- ],
- "Linux-syscall-note": [
- "Linux Syscall Note"
- ],
- "LLVM-exception": [
- "LLVM Exception"
- ],
- "LZMA-exception": [
- "LZMA exception"
- ],
- "mif-exception": [
- "Macros and Inline Functions Exception"
- ],
- "Nokia-Qt-exception-1.1": [
- "Nokia Qt LGPL exception 1.1"
- ],
- "OCaml-LGPL-linking-exception": [
- "OCaml LGPL Linking Exception"
- ],
- "OCCT-exception-1.0": [
- "Open CASCADE Exception 1.0"
- ],
- "OpenJDK-assembly-exception-1.0": [
- "OpenJDK Assembly exception 1.0"
- ],
- "openvpn-openssl-exception": [
- "OpenVPN OpenSSL Exception"
- ],
- "PS-or-PDF-font-exception-20170817": [
- "PS/PDF font exception (2017-08-17)"
- ],
- "Qt-GPL-exception-1.0": [
- "Qt GPL exception 1.0"
- ],
- "Qt-LGPL-exception-1.1": [
- "Qt LGPL exception 1.1"
- ],
- "Qwt-exception-1.0": [
- "Qwt exception 1.0"
- ],
- "SHL-2.0": [
- "Solderpad Hardware License v2.0"
- ],
- "SHL-2.1": [
- "Solderpad Hardware License v2.1"
- ],
- "Swift-exception": [
- "Swift Exception"
- ],
- "u-boot-exception-2.0": [
- "U-Boot exception 2.0"
- ],
- "Universal-FOSS-exception-1.0": [
- "Universal FOSS Exception, Version 1.0"
- ],
- "WxWindows-exception-3.1": [
- "WxWindows Library Exception 3.1"
- ]
- }{
- "0BSD": [
- "BSD Zero Clause License",
- true,
- false
- ],
- "AAL": [
- "Attribution Assurance License",
- true,
- false
- ],
- "Abstyles": [
- "Abstyles License",
- false,
- false
- ],
- "Adobe-2006": [
- "Adobe Systems Incorporated Source Code License Agreement",
- false,
- false
- ],
- "Adobe-Glyph": [
- "Adobe Glyph List License",
- false,
- false
- ],
- "ADSL": [
- "Amazon Digital Services License",
- false,
- false
- ],
- "AFL-1.1": [
- "Academic Free License v1.1",
- true,
- false
- ],
- "AFL-1.2": [
- "Academic Free License v1.2",
- true,
- false
- ],
- "AFL-2.0": [
- "Academic Free License v2.0",
- true,
- false
- ],
- "AFL-2.1": [
- "Academic Free License v2.1",
- true,
- false
- ],
- "AFL-3.0": [
- "Academic Free License v3.0",
- true,
- false
- ],
- "Afmparse": [
- "Afmparse License",
- false,
- false
- ],
- "AGPL-1.0": [
- "Affero General Public License v1.0",
- false,
- true
- ],
- "AGPL-1.0-only": [
- "Affero General Public License v1.0 only",
- false,
- false
- ],
- "AGPL-1.0-or-later": [
- "Affero General Public License v1.0 or later",
- false,
- false
- ],
- "AGPL-3.0": [
- "GNU Affero General Public License v3.0",
- true,
- true
- ],
- "AGPL-3.0-only": [
- "GNU Affero General Public License v3.0 only",
- true,
- false
- ],
- "AGPL-3.0-or-later": [
- "GNU Affero General Public License v3.0 or later",
- true,
- false
- ],
- "Aladdin": [
- "Aladdin Free Public License",
- false,
- false
- ],
- "AMDPLPA": [
- "AMD's plpa_map.c License",
- false,
- false
- ],
- "AML": [
- "Apple MIT License",
- false,
- false
- ],
- "AMPAS": [
- "Academy of Motion Picture Arts and Sciences BSD",
- false,
- false
- ],
- "ANTLR-PD": [
- "ANTLR Software Rights Notice",
- false,
- false
- ],
- "ANTLR-PD-fallback": [
- "ANTLR Software Rights Notice with license fallback",
- false,
- false
- ],
- "Apache-1.0": [
- "Apache License 1.0",
- false,
- false
- ],
- "Apache-1.1": [
- "Apache License 1.1",
- true,
- false
- ],
- "Apache-2.0": [
- "Apache License 2.0",
- true,
- false
- ],
- "APAFML": [
- "Adobe Postscript AFM License",
- false,
- false
- ],
- "APL-1.0": [
- "Adaptive Public License 1.0",
- true,
- false
- ],
- "App-s2p": [
- "App::s2p License",
- false,
- false
- ],
- "APSL-1.0": [
- "Apple Public Source License 1.0",
- true,
- false
- ],
- "APSL-1.1": [
- "Apple Public Source License 1.1",
- true,
- false
- ],
- "APSL-1.2": [
- "Apple Public Source License 1.2",
- true,
- false
- ],
- "APSL-2.0": [
- "Apple Public Source License 2.0",
- true,
- false
- ],
- "Arphic-1999": [
- "Arphic Public License",
- false,
- false
- ],
- "Artistic-1.0": [
- "Artistic License 1.0",
- true,
- false
- ],
- "Artistic-1.0-cl8": [
- "Artistic License 1.0 w/clause 8",
- true,
- false
- ],
- "Artistic-1.0-Perl": [
- "Artistic License 1.0 (Perl)",
- true,
- false
- ],
- "Artistic-2.0": [
- "Artistic License 2.0",
- true,
- false
- ],
- "Baekmuk": [
- "Baekmuk License",
- false,
- false
- ],
- "Bahyph": [
- "Bahyph License",
- false,
- false
- ],
- "Barr": [
- "Barr License",
- false,
- false
- ],
- "Beerware": [
- "Beerware License",
- false,
- false
- ],
- "Bitstream-Vera": [
- "Bitstream Vera Font License",
- false,
- false
- ],
- "BitTorrent-1.0": [
- "BitTorrent Open Source License v1.0",
- false,
- false
- ],
- "BitTorrent-1.1": [
- "BitTorrent Open Source License v1.1",
- false,
- false
- ],
- "blessing": [
- "SQLite Blessing",
- false,
- false
- ],
- "BlueOak-1.0.0": [
- "Blue Oak Model License 1.0.0",
- false,
- false
- ],
- "Borceux": [
- "Borceux license",
- false,
- false
- ],
- "BSD-1-Clause": [
- "BSD 1-Clause License",
- true,
- false
- ],
- "BSD-2-Clause": [
- "BSD 2-Clause \"Simplified\" License",
- true,
- false
- ],
- "BSD-2-Clause-FreeBSD": [
- "BSD 2-Clause FreeBSD License",
- false,
- true
- ],
- "BSD-2-Clause-NetBSD": [
- "BSD 2-Clause NetBSD License",
- false,
- true
- ],
- "BSD-2-Clause-Patent": [
- "BSD-2-Clause Plus Patent License",
- true,
- false
- ],
- "BSD-2-Clause-Views": [
- "BSD 2-Clause with views sentence",
- false,
- false
- ],
- "BSD-3-Clause": [
- "BSD 3-Clause \"New\" or \"Revised\" License",
- true,
- false
- ],
- "BSD-3-Clause-Attribution": [
- "BSD with attribution",
- false,
- false
- ],
- "BSD-3-Clause-Clear": [
- "BSD 3-Clause Clear License",
- false,
- false
- ],
- "BSD-3-Clause-LBNL": [
- "Lawrence Berkeley National Labs BSD variant license",
- true,
- false
- ],
- "BSD-3-Clause-Modification": [
- "BSD 3-Clause Modification",
- false,
- false
- ],
- "BSD-3-Clause-No-Military-License": [
- "BSD 3-Clause No Military License",
- false,
- false
- ],
- "BSD-3-Clause-No-Nuclear-License": [
- "BSD 3-Clause No Nuclear License",
- false,
- false
- ],
- "BSD-3-Clause-No-Nuclear-License-2014": [
- "BSD 3-Clause No Nuclear License 2014",
- false,
- false
- ],
- "BSD-3-Clause-No-Nuclear-Warranty": [
- "BSD 3-Clause No Nuclear Warranty",
- false,
- false
- ],
- "BSD-3-Clause-Open-MPI": [
- "BSD 3-Clause Open MPI variant",
- false,
- false
- ],
- "BSD-4-Clause": [
- "BSD 4-Clause \"Original\" or \"Old\" License",
- false,
- false
- ],
- "BSD-4-Clause-Shortened": [
- "BSD 4 Clause Shortened",
- false,
- false
- ],
- "BSD-4-Clause-UC": [
- "BSD-4-Clause (University of California-Specific)",
- false,
- false
- ],
- "BSD-Protection": [
- "BSD Protection License",
- false,
- false
- ],
- "BSD-Source-Code": [
- "BSD Source Code Attribution",
- false,
- false
- ],
- "BSL-1.0": [
- "Boost Software License 1.0",
- true,
- false
- ],
- "BUSL-1.1": [
- "Business Source License 1.1",
- false,
- false
- ],
- "bzip2-1.0.5": [
- "bzip2 and libbzip2 License v1.0.5",
- false,
- true
- ],
- "bzip2-1.0.6": [
- "bzip2 and libbzip2 License v1.0.6",
- false,
- false
- ],
- "C-UDA-1.0": [
- "Computational Use of Data Agreement v1.0",
- false,
- false
- ],
- "CAL-1.0": [
- "Cryptographic Autonomy License 1.0",
- true,
- false
- ],
- "CAL-1.0-Combined-Work-Exception": [
- "Cryptographic Autonomy License 1.0 (Combined Work Exception)",
- true,
- false
- ],
- "Caldera": [
- "Caldera License",
- false,
- false
- ],
- "CATOSL-1.1": [
- "Computer Associates Trusted Open Source License 1.1",
- true,
- false
- ],
- "CC-BY-1.0": [
- "Creative Commons Attribution 1.0 Generic",
- false,
- false
- ],
- "CC-BY-2.0": [
- "Creative Commons Attribution 2.0 Generic",
- false,
- false
- ],
- "CC-BY-2.5": [
- "Creative Commons Attribution 2.5 Generic",
- false,
- false
- ],
- "CC-BY-2.5-AU": [
- "Creative Commons Attribution 2.5 Australia",
- false,
- false
- ],
- "CC-BY-3.0": [
- "Creative Commons Attribution 3.0 Unported",
- false,
- false
- ],
- "CC-BY-3.0-AT": [
- "Creative Commons Attribution 3.0 Austria",
- false,
- false
- ],
- "CC-BY-3.0-DE": [
- "Creative Commons Attribution 3.0 Germany",
- false,
- false
- ],
- "CC-BY-3.0-NL": [
- "Creative Commons Attribution 3.0 Netherlands",
- false,
- false
- ],
- "CC-BY-3.0-US": [
- "Creative Commons Attribution 3.0 United States",
- false,
- false
- ],
- "CC-BY-4.0": [
- "Creative Commons Attribution 4.0 International",
- false,
- false
- ],
- "CC-BY-NC-1.0": [
- "Creative Commons Attribution Non Commercial 1.0 Generic",
- false,
- false
- ],
- "CC-BY-NC-2.0": [
- "Creative Commons Attribution Non Commercial 2.0 Generic",
- false,
- false
- ],
- "CC-BY-NC-2.5": [
- "Creative Commons Attribution Non Commercial 2.5 Generic",
- false,
- false
- ],
- "CC-BY-NC-3.0": [
- "Creative Commons Attribution Non Commercial 3.0 Unported",
- false,
- false
- ],
- "CC-BY-NC-3.0-DE": [
- "Creative Commons Attribution Non Commercial 3.0 Germany",
- false,
- false
- ],
- "CC-BY-NC-4.0": [
- "Creative Commons Attribution Non Commercial 4.0 International",
- false,
- false
- ],
- "CC-BY-NC-ND-1.0": [
- "Creative Commons Attribution Non Commercial No Derivatives 1.0 Generic",
- false,
- false
- ],
- "CC-BY-NC-ND-2.0": [
- "Creative Commons Attribution Non Commercial No Derivatives 2.0 Generic",
- false,
- false
- ],
- "CC-BY-NC-ND-2.5": [
- "Creative Commons Attribution Non Commercial No Derivatives 2.5 Generic",
- false,
- false
- ],
- "CC-BY-NC-ND-3.0": [
- "Creative Commons Attribution Non Commercial No Derivatives 3.0 Unported",
- false,
- false
- ],
- "CC-BY-NC-ND-3.0-DE": [
- "Creative Commons Attribution Non Commercial No Derivatives 3.0 Germany",
- false,
- false
- ],
- "CC-BY-NC-ND-3.0-IGO": [
- "Creative Commons Attribution Non Commercial No Derivatives 3.0 IGO",
- false,
- false
- ],
- "CC-BY-NC-ND-4.0": [
- "Creative Commons Attribution Non Commercial No Derivatives 4.0 International",
- false,
- false
- ],
- "CC-BY-NC-SA-1.0": [
- "Creative Commons Attribution Non Commercial Share Alike 1.0 Generic",
- false,
- false
- ],
- "CC-BY-NC-SA-2.0": [
- "Creative Commons Attribution Non Commercial Share Alike 2.0 Generic",
- false,
- false
- ],
- "CC-BY-NC-SA-2.0-FR": [
- "Creative Commons Attribution-NonCommercial-ShareAlike 2.0 France",
- false,
- false
- ],
- "CC-BY-NC-SA-2.0-UK": [
- "Creative Commons Attribution Non Commercial Share Alike 2.0 England and Wales",
- false,
- false
- ],
- "CC-BY-NC-SA-2.5": [
- "Creative Commons Attribution Non Commercial Share Alike 2.5 Generic",
- false,
- false
- ],
- "CC-BY-NC-SA-3.0": [
- "Creative Commons Attribution Non Commercial Share Alike 3.0 Unported",
- false,
- false
- ],
- "CC-BY-NC-SA-3.0-DE": [
- "Creative Commons Attribution Non Commercial Share Alike 3.0 Germany",
- false,
- false
- ],
- "CC-BY-NC-SA-3.0-IGO": [
- "Creative Commons Attribution Non Commercial Share Alike 3.0 IGO",
- false,
- false
- ],
- "CC-BY-NC-SA-4.0": [
- "Creative Commons Attribution Non Commercial Share Alike 4.0 International",
- false,
- false
- ],
- "CC-BY-ND-1.0": [
- "Creative Commons Attribution No Derivatives 1.0 Generic",
- false,
- false
- ],
- "CC-BY-ND-2.0": [
- "Creative Commons Attribution No Derivatives 2.0 Generic",
- false,
- false
- ],
- "CC-BY-ND-2.5": [
- "Creative Commons Attribution No Derivatives 2.5 Generic",
- false,
- false
- ],
- "CC-BY-ND-3.0": [
- "Creative Commons Attribution No Derivatives 3.0 Unported",
- false,
- false
- ],
- "CC-BY-ND-3.0-DE": [
- "Creative Commons Attribution No Derivatives 3.0 Germany",
- false,
- false
- ],
- "CC-BY-ND-4.0": [
- "Creative Commons Attribution No Derivatives 4.0 International",
- false,
- false
- ],
- "CC-BY-SA-1.0": [
- "Creative Commons Attribution Share Alike 1.0 Generic",
- false,
- false
- ],
- "CC-BY-SA-2.0": [
- "Creative Commons Attribution Share Alike 2.0 Generic",
- false,
- false
- ],
- "CC-BY-SA-2.0-UK": [
- "Creative Commons Attribution Share Alike 2.0 England and Wales",
- false,
- false
- ],
- "CC-BY-SA-2.1-JP": [
- "Creative Commons Attribution Share Alike 2.1 Japan",
- false,
- false
- ],
- "CC-BY-SA-2.5": [
- "Creative Commons Attribution Share Alike 2.5 Generic",
- false,
- false
- ],
- "CC-BY-SA-3.0": [
- "Creative Commons Attribution Share Alike 3.0 Unported",
- false,
- false
- ],
- "CC-BY-SA-3.0-AT": [
- "Creative Commons Attribution Share Alike 3.0 Austria",
- false,
- false
- ],
- "CC-BY-SA-3.0-DE": [
- "Creative Commons Attribution Share Alike 3.0 Germany",
- false,
- false
- ],
- "CC-BY-SA-4.0": [
- "Creative Commons Attribution Share Alike 4.0 International",
- false,
- false
- ],
- "CC-PDDC": [
- "Creative Commons Public Domain Dedication and Certification",
- false,
- false
- ],
- "CC0-1.0": [
- "Creative Commons Zero v1.0 Universal",
- false,
- false
- ],
- "CDDL-1.0": [
- "Common Development and Distribution License 1.0",
- true,
- false
- ],
- "CDDL-1.1": [
- "Common Development and Distribution License 1.1",
- false,
- false
- ],
- "CDL-1.0": [
- "Common Documentation License 1.0",
- false,
- false
- ],
- "CDLA-Permissive-1.0": [
- "Community Data License Agreement Permissive 1.0",
- false,
- false
- ],
- "CDLA-Permissive-2.0": [
- "Community Data License Agreement Permissive 2.0",
- false,
- false
- ],
- "CDLA-Sharing-1.0": [
- "Community Data License Agreement Sharing 1.0",
- false,
- false
- ],
- "CECILL-1.0": [
- "CeCILL Free Software License Agreement v1.0",
- false,
- false
- ],
- "CECILL-1.1": [
- "CeCILL Free Software License Agreement v1.1",
- false,
- false
- ],
- "CECILL-2.0": [
- "CeCILL Free Software License Agreement v2.0",
- false,
- false
- ],
- "CECILL-2.1": [
- "CeCILL Free Software License Agreement v2.1",
- true,
- false
- ],
- "CECILL-B": [
- "CeCILL-B Free Software License Agreement",
- false,
- false
- ],
- "CECILL-C": [
- "CeCILL-C Free Software License Agreement",
- false,
- false
- ],
- "CERN-OHL-1.1": [
- "CERN Open Hardware Licence v1.1",
- false,
- false
- ],
- "CERN-OHL-1.2": [
- "CERN Open Hardware Licence v1.2",
- false,
- false
- ],
- "CERN-OHL-P-2.0": [
- "CERN Open Hardware Licence Version 2 - Permissive",
- true,
- false
- ],
- "CERN-OHL-S-2.0": [
- "CERN Open Hardware Licence Version 2 - Strongly Reciprocal",
- true,
- false
- ],
- "CERN-OHL-W-2.0": [
- "CERN Open Hardware Licence Version 2 - Weakly Reciprocal",
- true,
- false
- ],
- "ClArtistic": [
- "Clarified Artistic License",
- false,
- false
- ],
- "CNRI-Jython": [
- "CNRI Jython License",
- false,
- false
- ],
- "CNRI-Python": [
- "CNRI Python License",
- true,
- false
- ],
- "CNRI-Python-GPL-Compatible": [
- "CNRI Python Open Source GPL Compatible License Agreement",
- false,
- false
- ],
- "COIL-1.0": [
- "Copyfree Open Innovation License",
- false,
- false
- ],
- "Community-Spec-1.0": [
- "Community Specification License 1.0",
- false,
- false
- ],
- "Condor-1.1": [
- "Condor Public License v1.1",
- false,
- false
- ],
- "copyleft-next-0.3.0": [
- "copyleft-next 0.3.0",
- false,
- false
- ],
- "copyleft-next-0.3.1": [
- "copyleft-next 0.3.1",
- false,
- false
- ],
- "CPAL-1.0": [
- "Common Public Attribution License 1.0",
- true,
- false
- ],
- "CPL-1.0": [
- "Common Public License 1.0",
- true,
- false
- ],
- "CPOL-1.02": [
- "Code Project Open License 1.02",
- false,
- false
- ],
- "Crossword": [
- "Crossword License",
- false,
- false
- ],
- "CrystalStacker": [
- "CrystalStacker License",
- false,
- false
- ],
- "CUA-OPL-1.0": [
- "CUA Office Public License v1.0",
- true,
- false
- ],
- "Cube": [
- "Cube License",
- false,
- false
- ],
- "curl": [
- "curl License",
- false,
- false
- ],
- "D-FSL-1.0": [
- "Deutsche Freie Software Lizenz",
- false,
- false
- ],
- "diffmark": [
- "diffmark license",
- false,
- false
- ],
- "DL-DE-BY-2.0": [
- "Data licence Germany \u2013 attribution \u2013 version 2.0",
- false,
- false
- ],
- "DOC": [
- "DOC License",
- false,
- false
- ],
- "Dotseqn": [
- "Dotseqn License",
- false,
- false
- ],
- "DRL-1.0": [
- "Detection Rule License 1.0",
- false,
- false
- ],
- "DSDP": [
- "DSDP License",
- false,
- false
- ],
- "dvipdfm": [
- "dvipdfm License",
- false,
- false
- ],
- "ECL-1.0": [
- "Educational Community License v1.0",
- true,
- false
- ],
- "ECL-2.0": [
- "Educational Community License v2.0",
- true,
- false
- ],
- "eCos-2.0": [
- "eCos license version 2.0",
- false,
- true
- ],
- "EFL-1.0": [
- "Eiffel Forum License v1.0",
- true,
- false
- ],
- "EFL-2.0": [
- "Eiffel Forum License v2.0",
- true,
- false
- ],
- "eGenix": [
- "eGenix.com Public License 1.1.0",
- false,
- false
- ],
- "Elastic-2.0": [
- "Elastic License 2.0",
- false,
- false
- ],
- "Entessa": [
- "Entessa Public License v1.0",
- true,
- false
- ],
- "EPICS": [
- "EPICS Open License",
- false,
- false
- ],
- "EPL-1.0": [
- "Eclipse Public License 1.0",
- true,
- false
- ],
- "EPL-2.0": [
- "Eclipse Public License 2.0",
- true,
- false
- ],
- "ErlPL-1.1": [
- "Erlang Public License v1.1",
- false,
- false
- ],
- "etalab-2.0": [
- "Etalab Open License 2.0",
- false,
- false
- ],
- "EUDatagrid": [
- "EU DataGrid Software License",
- true,
- false
- ],
- "EUPL-1.0": [
- "European Union Public License 1.0",
- false,
- false
- ],
- "EUPL-1.1": [
- "European Union Public License 1.1",
- true,
- false
- ],
- "EUPL-1.2": [
- "European Union Public License 1.2",
- true,
- false
- ],
- "Eurosym": [
- "Eurosym License",
- false,
- false
- ],
- "Fair": [
- "Fair License",
- true,
- false
- ],
- "FDK-AAC": [
- "Fraunhofer FDK AAC Codec Library",
- false,
- false
- ],
- "Frameworx-1.0": [
- "Frameworx Open License 1.0",
- true,
- false
- ],
- "FreeBSD-DOC": [
- "FreeBSD Documentation License",
- false,
- false
- ],
- "FreeImage": [
- "FreeImage Public License v1.0",
- false,
- false
- ],
- "FSFAP": [
- "FSF All Permissive License",
- false,
- false
- ],
- "FSFUL": [
- "FSF Unlimited License",
- false,
- false
- ],
- "FSFULLR": [
- "FSF Unlimited License (with License Retention)",
- false,
- false
- ],
- "FTL": [
- "Freetype Project License",
- false,
- false
- ],
- "GD": [
- "GD License",
- false,
- false
- ],
- "GFDL-1.1": [
- "GNU Free Documentation License v1.1",
- false,
- true
- ],
- "GFDL-1.1-invariants-only": [
- "GNU Free Documentation License v1.1 only - invariants",
- false,
- false
- ],
- "GFDL-1.1-invariants-or-later": [
- "GNU Free Documentation License v1.1 or later - invariants",
- false,
- false
- ],
- "GFDL-1.1-no-invariants-only": [
- "GNU Free Documentation License v1.1 only - no invariants",
- false,
- false
- ],
- "GFDL-1.1-no-invariants-or-later": [
- "GNU Free Documentation License v1.1 or later - no invariants",
- false,
- false
- ],
- "GFDL-1.1-only": [
- "GNU Free Documentation License v1.1 only",
- false,
- false
- ],
- "GFDL-1.1-or-later": [
- "GNU Free Documentation License v1.1 or later",
- false,
- false
- ],
- "GFDL-1.2": [
- "GNU Free Documentation License v1.2",
- false,
- true
- ],
- "GFDL-1.2-invariants-only": [
- "GNU Free Documentation License v1.2 only - invariants",
- false,
- false
- ],
- "GFDL-1.2-invariants-or-later": [
- "GNU Free Documentation License v1.2 or later - invariants",
- false,
- false
- ],
- "GFDL-1.2-no-invariants-only": [
- "GNU Free Documentation License v1.2 only - no invariants",
- false,
- false
- ],
- "GFDL-1.2-no-invariants-or-later": [
- "GNU Free Documentation License v1.2 or later - no invariants",
- false,
- false
- ],
- "GFDL-1.2-only": [
- "GNU Free Documentation License v1.2 only",
- false,
- false
- ],
- "GFDL-1.2-or-later": [
- "GNU Free Documentation License v1.2 or later",
- false,
- false
- ],
- "GFDL-1.3": [
- "GNU Free Documentation License v1.3",
- false,
- true
- ],
- "GFDL-1.3-invariants-only": [
- "GNU Free Documentation License v1.3 only - invariants",
- false,
- false
- ],
- "GFDL-1.3-invariants-or-later": [
- "GNU Free Documentation License v1.3 or later - invariants",
- false,
- false
- ],
- "GFDL-1.3-no-invariants-only": [
- "GNU Free Documentation License v1.3 only - no invariants",
- false,
- false
- ],
- "GFDL-1.3-no-invariants-or-later": [
- "GNU Free Documentation License v1.3 or later - no invariants",
- false,
- false
- ],
- "GFDL-1.3-only": [
- "GNU Free Documentation License v1.3 only",
- false,
- false
- ],
- "GFDL-1.3-or-later": [
- "GNU Free Documentation License v1.3 or later",
- false,
- false
- ],
- "Giftware": [
- "Giftware License",
- false,
- false
- ],
- "GL2PS": [
- "GL2PS License",
- false,
- false
- ],
- "Glide": [
- "3dfx Glide License",
- false,
- false
- ],
- "Glulxe": [
- "Glulxe License",
- false,
- false
- ],
- "GLWTPL": [
- "Good Luck With That Public License",
- false,
- false
- ],
- "gnuplot": [
- "gnuplot License",
- false,
- false
- ],
- "GPL-1.0": [
- "GNU General Public License v1.0 only",
- false,
- true
- ],
- "GPL-1.0+": [
- "GNU General Public License v1.0 or later",
- false,
- true
- ],
- "GPL-1.0-only": [
- "GNU General Public License v1.0 only",
- false,
- false
- ],
- "GPL-1.0-or-later": [
- "GNU General Public License v1.0 or later",
- false,
- false
- ],
- "GPL-2.0": [
- "GNU General Public License v2.0 only",
- true,
- true
- ],
- "GPL-2.0+": [
- "GNU General Public License v2.0 or later",
- true,
- true
- ],
- "GPL-2.0-only": [
- "GNU General Public License v2.0 only",
- true,
- false
- ],
- "GPL-2.0-or-later": [
- "GNU General Public License v2.0 or later",
- true,
- false
- ],
- "GPL-2.0-with-autoconf-exception": [
- "GNU General Public License v2.0 w/Autoconf exception",
- false,
- true
- ],
- "GPL-2.0-with-bison-exception": [
- "GNU General Public License v2.0 w/Bison exception",
- false,
- true
- ],
- "GPL-2.0-with-classpath-exception": [
- "GNU General Public License v2.0 w/Classpath exception",
- false,
- true
- ],
- "GPL-2.0-with-font-exception": [
- "GNU General Public License v2.0 w/Font exception",
- false,
- true
- ],
- "GPL-2.0-with-GCC-exception": [
- "GNU General Public License v2.0 w/GCC Runtime Library exception",
- false,
- true
- ],
- "GPL-3.0": [
- "GNU General Public License v3.0 only",
- true,
- true
- ],
- "GPL-3.0+": [
- "GNU General Public License v3.0 or later",
- true,
- true
- ],
- "GPL-3.0-only": [
- "GNU General Public License v3.0 only",
- true,
- false
- ],
- "GPL-3.0-or-later": [
- "GNU General Public License v3.0 or later",
- true,
- false
- ],
- "GPL-3.0-with-autoconf-exception": [
- "GNU General Public License v3.0 w/Autoconf exception",
- false,
- true
- ],
- "GPL-3.0-with-GCC-exception": [
- "GNU General Public License v3.0 w/GCC Runtime Library exception",
- true,
- true
- ],
- "gSOAP-1.3b": [
- "gSOAP Public License v1.3b",
- false,
- false
- ],
- "HaskellReport": [
- "Haskell Language Report License",
- false,
- false
- ],
- "Hippocratic-2.1": [
- "Hippocratic License 2.1",
- false,
- false
- ],
- "HPND": [
- "Historical Permission Notice and Disclaimer",
- true,
- false
- ],
- "HPND-sell-variant": [
- "Historical Permission Notice and Disclaimer - sell variant",
- false,
- false
- ],
- "HTMLTIDY": [
- "HTML Tidy License",
- false,
- false
- ],
- "IBM-pibs": [
- "IBM PowerPC Initialization and Boot Software",
- false,
- false
- ],
- "ICU": [
- "ICU License",
- false,
- false
- ],
- "IJG": [
- "Independent JPEG Group License",
- false,
- false
- ],
- "ImageMagick": [
- "ImageMagick License",
- false,
- false
- ],
- "iMatix": [
- "iMatix Standard Function Library Agreement",
- false,
- false
- ],
- "Imlib2": [
- "Imlib2 License",
- false,
- false
- ],
- "Info-ZIP": [
- "Info-ZIP License",
- false,
- false
- ],
- "Intel": [
- "Intel Open Source License",
- true,
- false
- ],
- "Intel-ACPI": [
- "Intel ACPI Software License Agreement",
- false,
- false
- ],
- "Interbase-1.0": [
- "Interbase Public License v1.0",
- false,
- false
- ],
- "IPA": [
- "IPA Font License",
- true,
- false
- ],
- "IPL-1.0": [
- "IBM Public License v1.0",
- true,
- false
- ],
- "ISC": [
- "ISC License",
- true,
- false
- ],
- "Jam": [
- "Jam License",
- true,
- false
- ],
- "JasPer-2.0": [
- "JasPer License",
- false,
- false
- ],
- "JPNIC": [
- "Japan Network Information Center License",
- false,
- false
- ],
- "JSON": [
- "JSON License",
- false,
- false
- ],
- "KiCad-libraries-exception": [
- "KiCad Libraries Exception",
- false,
- false
- ],
- "LAL-1.2": [
- "Licence Art Libre 1.2",
- false,
- false
- ],
- "LAL-1.3": [
- "Licence Art Libre 1.3",
- false,
- false
- ],
- "Latex2e": [
- "Latex2e License",
- false,
- false
- ],
- "Leptonica": [
- "Leptonica License",
- false,
- false
- ],
- "LGPL-2.0": [
- "GNU Library General Public License v2 only",
- true,
- true
- ],
- "LGPL-2.0+": [
- "GNU Library General Public License v2 or later",
- true,
- true
- ],
- "LGPL-2.0-only": [
- "GNU Library General Public License v2 only",
- true,
- false
- ],
- "LGPL-2.0-or-later": [
- "GNU Library General Public License v2 or later",
- true,
- false
- ],
- "LGPL-2.1": [
- "GNU Lesser General Public License v2.1 only",
- true,
- true
- ],
- "LGPL-2.1+": [
- "GNU Library General Public License v2.1 or later",
- true,
- true
- ],
- "LGPL-2.1-only": [
- "GNU Lesser General Public License v2.1 only",
- true,
- false
- ],
- "LGPL-2.1-or-later": [
- "GNU Lesser General Public License v2.1 or later",
- true,
- false
- ],
- "LGPL-3.0": [
- "GNU Lesser General Public License v3.0 only",
- true,
- true
- ],
- "LGPL-3.0+": [
- "GNU Lesser General Public License v3.0 or later",
- true,
- true
- ],
- "LGPL-3.0-only": [
- "GNU Lesser General Public License v3.0 only",
- true,
- false
- ],
- "LGPL-3.0-or-later": [
- "GNU Lesser General Public License v3.0 or later",
- true,
- false
- ],
- "LGPLLR": [
- "Lesser General Public License For Linguistic Resources",
- false,
- false
- ],
- "Libpng": [
- "libpng License",
- false,
- false
- ],
- "libpng-2.0": [
- "PNG Reference Library version 2",
- false,
- false
- ],
- "libselinux-1.0": [
- "libselinux public domain notice",
- false,
- false
- ],
- "libtiff": [
- "libtiff License",
- false,
- false
- ],
- "LiLiQ-P-1.1": [
- "Licence Libre du Qu\u00e9bec \u2013 Permissive version 1.1",
- true,
- false
- ],
- "LiLiQ-R-1.1": [
- "Licence Libre du Qu\u00e9bec \u2013 R\u00e9ciprocit\u00e9 version 1.1",
- true,
- false
- ],
- "LiLiQ-Rplus-1.1": [
- "Licence Libre du Qu\u00e9bec \u2013 R\u00e9ciprocit\u00e9 forte version 1.1",
- true,
- false
- ],
- "Linux-man-pages-copyleft": [
- "Linux man-pages Copyleft",
- false,
- false
- ],
- "Linux-OpenIB": [
- "Linux Kernel Variant of OpenIB.org license",
- false,
- false
- ],
- "LPL-1.0": [
- "Lucent Public License Version 1.0",
- true,
- false
- ],
- "LPL-1.02": [
- "Lucent Public License v1.02",
- true,
- false
- ],
- "LPPL-1.0": [
- "LaTeX Project Public License v1.0",
- false,
- false
- ],
- "LPPL-1.1": [
- "LaTeX Project Public License v1.1",
- false,
- false
- ],
- "LPPL-1.2": [
- "LaTeX Project Public License v1.2",
- false,
- false
- ],
- "LPPL-1.3a": [
- "LaTeX Project Public License v1.3a",
- false,
- false
- ],
- "LPPL-1.3c": [
- "LaTeX Project Public License v1.3c",
- true,
- false
- ],
- "MakeIndex": [
- "MakeIndex License",
- false,
- false
- ],
- "MirOS": [
- "The MirOS Licence",
- true,
- false
- ],
- "MIT": [
- "MIT License",
- true,
- false
- ],
- "MIT-0": [
- "MIT No Attribution",
- true,
- false
- ],
- "MIT-advertising": [
- "Enlightenment License (e16)",
- false,
- false
- ],
- "MIT-CMU": [
- "CMU License",
- false,
- false
- ],
- "MIT-enna": [
- "enna License",
- false,
- false
- ],
- "MIT-feh": [
- "feh License",
- false,
- false
- ],
- "MIT-Modern-Variant": [
- "MIT License Modern Variant",
- true,
- false
- ],
- "MIT-open-group": [
- "MIT Open Group variant",
- false,
- false
- ],
- "MITNFA": [
- "MIT +no-false-attribs license",
- false,
- false
- ],
- "Motosoto": [
- "Motosoto License",
- true,
- false
- ],
- "mpich2": [
- "mpich2 License",
- false,
- false
- ],
- "MPL-1.0": [
- "Mozilla Public License 1.0",
- true,
- false
- ],
- "MPL-1.1": [
- "Mozilla Public License 1.1",
- true,
- false
- ],
- "MPL-2.0": [
- "Mozilla Public License 2.0",
- true,
- false
- ],
- "MPL-2.0-no-copyleft-exception": [
- "Mozilla Public License 2.0 (no copyleft exception)",
- true,
- false
- ],
- "mplus": [
- "mplus Font License",
- false,
- false
- ],
- "MS-PL": [
- "Microsoft Public License",
- true,
- false
- ],
- "MS-RL": [
- "Microsoft Reciprocal License",
- true,
- false
- ],
- "MTLL": [
- "Matrix Template Library License",
- false,
- false
- ],
- "MulanPSL-1.0": [
- "Mulan Permissive Software License, Version 1",
- false,
- false
- ],
- "MulanPSL-2.0": [
- "Mulan Permissive Software License, Version 2",
- true,
- false
- ],
- "Multics": [
- "Multics License",
- true,
- false
- ],
- "Mup": [
- "Mup License",
- false,
- false
- ],
- "NAIST-2003": [
- "Nara Institute of Science and Technology License (2003)",
- false,
- false
- ],
- "NASA-1.3": [
- "NASA Open Source Agreement 1.3",
- true,
- false
- ],
- "Naumen": [
- "Naumen Public License",
- true,
- false
- ],
- "NBPL-1.0": [
- "Net Boolean Public License v1",
- false,
- false
- ],
- "NCGL-UK-2.0": [
- "Non-Commercial Government Licence",
- false,
- false
- ],
- "NCSA": [
- "University of Illinois/NCSA Open Source License",
- true,
- false
- ],
- "Net-SNMP": [
- "Net-SNMP License",
- false,
- false
- ],
- "NetCDF": [
- "NetCDF license",
- false,
- false
- ],
- "Newsletr": [
- "Newsletr License",
- false,
- false
- ],
- "NGPL": [
- "Nethack General Public License",
- true,
- false
- ],
- "NIST-PD": [
- "NIST Public Domain Notice",
- false,
- false
- ],
- "NIST-PD-fallback": [
- "NIST Public Domain Notice with license fallback",
- false,
- false
- ],
- "NLOD-1.0": [
- "Norwegian Licence for Open Government Data (NLOD) 1.0",
- false,
- false
- ],
- "NLOD-2.0": [
- "Norwegian Licence for Open Government Data (NLOD) 2.0",
- false,
- false
- ],
- "NLPL": [
- "No Limit Public License",
- false,
- false
- ],
- "Nokia": [
- "Nokia Open Source License",
- true,
- false
- ],
- "NOSL": [
- "Netizen Open Source License",
- false,
- false
- ],
- "Noweb": [
- "Noweb License",
- false,
- false
- ],
- "NPL-1.0": [
- "Netscape Public License v1.0",
- false,
- false
- ],
- "NPL-1.1": [
- "Netscape Public License v1.1",
- false,
- false
- ],
- "NPOSL-3.0": [
- "Non-Profit Open Software License 3.0",
- true,
- false
- ],
- "NRL": [
- "NRL License",
- false,
- false
- ],
- "NTP": [
- "NTP License",
- true,
- false
- ],
- "NTP-0": [
- "NTP No Attribution",
- false,
- false
- ],
- "Nunit": [
- "Nunit License",
- false,
- true
- ],
- "O-UDA-1.0": [
- "Open Use of Data Agreement v1.0",
- false,
- false
- ],
- "OCCT-PL": [
- "Open CASCADE Technology Public License",
- false,
- false
- ],
- "OCLC-2.0": [
- "OCLC Research Public License 2.0",
- true,
- false
- ],
- "ODbL-1.0": [
- "Open Data Commons Open Database License v1.0",
- false,
- false
- ],
- "ODC-By-1.0": [
- "Open Data Commons Attribution License v1.0",
- false,
- false
- ],
- "OFL-1.0": [
- "SIL Open Font License 1.0",
- false,
- false
- ],
- "OFL-1.0-no-RFN": [
- "SIL Open Font License 1.0 with no Reserved Font Name",
- false,
- false
- ],
- "OFL-1.0-RFN": [
- "SIL Open Font License 1.0 with Reserved Font Name",
- false,
- false
- ],
- "OFL-1.1": [
- "SIL Open Font License 1.1",
- true,
- false
- ],
- "OFL-1.1-no-RFN": [
- "SIL Open Font License 1.1 with no Reserved Font Name",
- true,
- false
- ],
- "OFL-1.1-RFN": [
- "SIL Open Font License 1.1 with Reserved Font Name",
- true,
- false
- ],
- "OGC-1.0": [
- "OGC Software License, Version 1.0",
- false,
- false
- ],
- "OGDL-Taiwan-1.0": [
- "Taiwan Open Government Data License, version 1.0",
- false,
- false
- ],
- "OGL-Canada-2.0": [
- "Open Government Licence - Canada",
- false,
- false
- ],
- "OGL-UK-1.0": [
- "Open Government Licence v1.0",
- false,
- false
- ],
- "OGL-UK-2.0": [
- "Open Government Licence v2.0",
- false,
- false
- ],
- "OGL-UK-3.0": [
- "Open Government Licence v3.0",
- false,
- false
- ],
- "OGTSL": [
- "Open Group Test Suite License",
- true,
- false
- ],
- "OLDAP-1.1": [
- "Open LDAP Public License v1.1",
- false,
- false
- ],
- "OLDAP-1.2": [
- "Open LDAP Public License v1.2",
- false,
- false
- ],
- "OLDAP-1.3": [
- "Open LDAP Public License v1.3",
- false,
- false
- ],
- "OLDAP-1.4": [
- "Open LDAP Public License v1.4",
- false,
- false
- ],
- "OLDAP-2.0": [
- "Open LDAP Public License v2.0 (or possibly 2.0A and 2.0B)",
- false,
- false
- ],
- "OLDAP-2.0.1": [
- "Open LDAP Public License v2.0.1",
- false,
- false
- ],
- "OLDAP-2.1": [
- "Open LDAP Public License v2.1",
- false,
- false
- ],
- "OLDAP-2.2": [
- "Open LDAP Public License v2.2",
- false,
- false
- ],
- "OLDAP-2.2.1": [
- "Open LDAP Public License v2.2.1",
- false,
- false
- ],
- "OLDAP-2.2.2": [
- "Open LDAP Public License 2.2.2",
- false,
- false
- ],
- "OLDAP-2.3": [
- "Open LDAP Public License v2.3",
- false,
- false
- ],
- "OLDAP-2.4": [
- "Open LDAP Public License v2.4",
- false,
- false
- ],
- "OLDAP-2.5": [
- "Open LDAP Public License v2.5",
- false,
- false
- ],
- "OLDAP-2.6": [
- "Open LDAP Public License v2.6",
- false,
- false
- ],
- "OLDAP-2.7": [
- "Open LDAP Public License v2.7",
- false,
- false
- ],
- "OLDAP-2.8": [
- "Open LDAP Public License v2.8",
- true,
- false
- ],
- "OML": [
- "Open Market License",
- false,
- false
- ],
- "OpenSSL": [
- "OpenSSL License",
- false,
- false
- ],
- "OPL-1.0": [
- "Open Public License v1.0",
- false,
- false
- ],
- "OPUBL-1.0": [
- "Open Publication License v1.0",
- false,
- false
- ],
- "OSET-PL-2.1": [
- "OSET Public License version 2.1",
- true,
- false
- ],
- "OSL-1.0": [
- "Open Software License 1.0",
- true,
- false
- ],
- "OSL-1.1": [
- "Open Software License 1.1",
- false,
- false
- ],
- "OSL-2.0": [
- "Open Software License 2.0",
- true,
- false
- ],
- "OSL-2.1": [
- "Open Software License 2.1",
- true,
- false
- ],
- "OSL-3.0": [
- "Open Software License 3.0",
- true,
- false
- ],
- "Parity-6.0.0": [
- "The Parity Public License 6.0.0",
- false,
- false
- ],
- "Parity-7.0.0": [
- "The Parity Public License 7.0.0",
- false,
- false
- ],
- "PDDL-1.0": [
- "Open Data Commons Public Domain Dedication & License 1.0",
- false,
- false
- ],
- "PHP-3.0": [
- "PHP License v3.0",
- true,
- false
- ],
- "PHP-3.01": [
- "PHP License v3.01",
- true,
- false
- ],
- "Plexus": [
- "Plexus Classworlds License",
- false,
- false
- ],
- "PolyForm-Noncommercial-1.0.0": [
- "PolyForm Noncommercial License 1.0.0",
- false,
- false
- ],
- "PolyForm-Small-Business-1.0.0": [
- "PolyForm Small Business License 1.0.0",
- false,
- false
- ],
- "PostgreSQL": [
- "PostgreSQL License",
- true,
- false
- ],
- "PSF-2.0": [
- "Python Software Foundation License 2.0",
- false,
- false
- ],
- "psfrag": [
- "psfrag License",
- false,
- false
- ],
- "psutils": [
- "psutils License",
- false,
- false
- ],
- "Python-2.0": [
- "Python License 2.0",
- true,
- false
- ],
- "Qhull": [
- "Qhull License",
- false,
- false
- ],
- "QPL-1.0": [
- "Q Public License 1.0",
- true,
- false
- ],
- "Rdisc": [
- "Rdisc License",
- false,
- false
- ],
- "RHeCos-1.1": [
- "Red Hat eCos Public License v1.1",
- false,
- false
- ],
- "RPL-1.1": [
- "Reciprocal Public License 1.1",
- true,
- false
- ],
- "RPL-1.5": [
- "Reciprocal Public License 1.5",
- true,
- false
- ],
- "RPSL-1.0": [
- "RealNetworks Public Source License v1.0",
- true,
- false
- ],
- "RSA-MD": [
- "RSA Message-Digest License",
- false,
- false
- ],
- "RSCPL": [
- "Ricoh Source Code Public License",
- true,
- false
- ],
- "Ruby": [
- "Ruby License",
- false,
- false
- ],
- "SAX-PD": [
- "Sax Public Domain Notice",
- false,
- false
- ],
- "Saxpath": [
- "Saxpath License",
- false,
- false
- ],
- "SCEA": [
- "SCEA Shared Source License",
- false,
- false
- ],
- "SchemeReport": [
- "Scheme Language Report License",
- false,
- false
- ],
- "Sendmail": [
- "Sendmail License",
- false,
- false
- ],
- "Sendmail-8.23": [
- "Sendmail License 8.23",
- false,
- false
- ],
- "SGI-B-1.0": [
- "SGI Free Software License B v1.0",
- false,
- false
- ],
- "SGI-B-1.1": [
- "SGI Free Software License B v1.1",
- false,
- false
- ],
- "SGI-B-2.0": [
- "SGI Free Software License B v2.0",
- false,
- false
- ],
- "SHL-0.5": [
- "Solderpad Hardware License v0.5",
- false,
- false
- ],
- "SHL-0.51": [
- "Solderpad Hardware License, Version 0.51",
- false,
- false
- ],
- "SimPL-2.0": [
- "Simple Public License 2.0",
- true,
- false
- ],
- "SISSL": [
- "Sun Industry Standards Source License v1.1",
- true,
- false
- ],
- "SISSL-1.2": [
- "Sun Industry Standards Source License v1.2",
- false,
- false
- ],
- "Sleepycat": [
- "Sleepycat License",
- true,
- false
- ],
- "SMLNJ": [
- "Standard ML of New Jersey License",
- false,
- false
- ],
- "SMPPL": [
- "Secure Messaging Protocol Public License",
- false,
- false
- ],
- "SNIA": [
- "SNIA Public License 1.1",
- false,
- false
- ],
- "Spencer-86": [
- "Spencer License 86",
- false,
- false
- ],
- "Spencer-94": [
- "Spencer License 94",
- false,
- false
- ],
- "Spencer-99": [
- "Spencer License 99",
- false,
- false
- ],
- "SPL-1.0": [
- "Sun Public License v1.0",
- true,
- false
- ],
- "SSH-OpenSSH": [
- "SSH OpenSSH license",
- false,
- false
- ],
- "SSH-short": [
- "SSH short notice",
- false,
- false
- ],
- "SSPL-1.0": [
- "Server Side Public License, v 1",
- false,
- false
- ],
- "StandardML-NJ": [
- "Standard ML of New Jersey License",
- false,
- true
- ],
- "SugarCRM-1.1.3": [
- "SugarCRM Public License v1.1.3",
- false,
- false
- ],
- "SWL": [
- "Scheme Widget Library (SWL) Software License Agreement",
- false,
- false
- ],
- "TAPR-OHL-1.0": [
- "TAPR Open Hardware License v1.0",
- false,
- false
- ],
- "TCL": [
- "TCL/TK License",
- false,
- false
- ],
- "TCP-wrappers": [
- "TCP Wrappers License",
- false,
- false
- ],
- "TMate": [
- "TMate Open Source License",
- false,
- false
- ],
- "TORQUE-1.1": [
- "TORQUE v2.5+ Software License v1.1",
- false,
- false
- ],
- "TOSL": [
- "Trusster Open Source License",
- false,
- false
- ],
- "TU-Berlin-1.0": [
- "Technische Universitaet Berlin License 1.0",
- false,
- false
- ],
- "TU-Berlin-2.0": [
- "Technische Universitaet Berlin License 2.0",
- false,
- false
- ],
- "UCL-1.0": [
- "Upstream Compatibility License v1.0",
- true,
- false
- ],
- "Unicode-DFS-2015": [
- "Unicode License Agreement - Data Files and Software (2015)",
- false,
- false
- ],
- "Unicode-DFS-2016": [
- "Unicode License Agreement - Data Files and Software (2016)",
- true,
- false
- ],
- "Unicode-TOU": [
- "Unicode Terms of Use",
- false,
- false
- ],
- "Unlicense": [
- "The Unlicense",
- true,
- false
- ],
- "UPL-1.0": [
- "Universal Permissive License v1.0",
- true,
- false
- ],
- "Vim": [
- "Vim License",
- false,
- false
- ],
- "VOSTROM": [
- "VOSTROM Public License for Open Source",
- false,
- false
- ],
- "VSL-1.0": [
- "Vovida Software License v1.0",
- true,
- false
- ],
- "W3C": [
- "W3C Software Notice and License (2002-12-31)",
- true,
- false
- ],
- "W3C-19980720": [
- "W3C Software Notice and License (1998-07-20)",
- false,
- false
- ],
- "W3C-20150513": [
- "W3C Software Notice and Document License (2015-05-13)",
- false,
- false
- ],
- "Watcom-1.0": [
- "Sybase Open Watcom Public License 1.0",
- true,
- false
- ],
- "Wsuipa": [
- "Wsuipa License",
- false,
- false
- ],
- "WTFPL": [
- "Do What The F*ck You Want To Public License",
- false,
- false
- ],
- "wxWindows": [
- "wxWindows Library License",
- true,
- true
- ],
- "X11": [
- "X11 License",
- false,
- false
- ],
- "X11-distribute-modifications-variant": [
- "X11 License Distribution Modification Variant",
- false,
- false
- ],
- "Xerox": [
- "Xerox License",
- false,
- false
- ],
- "XFree86-1.1": [
- "XFree86 License 1.1",
- false,
- false
- ],
- "xinetd": [
- "xinetd License",
- false,
- false
- ],
- "Xnet": [
- "X.Net License",
- true,
- false
- ],
- "xpp": [
- "XPP License",
- false,
- false
- ],
- "XSkat": [
- "XSkat License",
- false,
- false
- ],
- "YPL-1.0": [
- "Yahoo! Public License v1.0",
- false,
- false
- ],
- "YPL-1.1": [
- "Yahoo! Public License v1.1",
- false,
- false
- ],
- "Zed": [
- "Zed License",
- false,
- false
- ],
- "Zend-2.0": [
- "Zend License v2.0",
- false,
- false
- ],
- "Zimbra-1.3": [
- "Zimbra Public License v1.3",
- false,
- false
- ],
- "Zimbra-1.4": [
- "Zimbra Public License v1.4",
- false,
- false
- ],
- "Zlib": [
- "zlib License",
- true,
- false
- ],
- "zlib-acknowledgement": [
- "zlib/libpng License with Acknowledgement",
- false,
- false
- ],
- "ZPL-1.1": [
- "Zope Public License 1.1",
- false,
- false
- ],
- "ZPL-2.0": [
- "Zope Public License 2.0",
- true,
- false
- ],
- "ZPL-2.1": [
- "Zope Public License 2.1",
- true,
- false
- ]
- }<?php
- namespace Composer\Spdx;
- class SpdxLicenses
- {
- const LICENSES_FILE = 'spdx-licenses.json';
- const EXCEPTIONS_FILE = 'spdx-exceptions.json';
- private $licenses;
- private $licensesExpression;
- private $exceptions;
- private $exceptionsExpression;
- public function __construct()
- {
- $this->loadLicenses();
- $this->loadExceptions();
- }
- public function getLicenseByIdentifier($identifier)
- {
- $key = strtolower($identifier);
- if (!isset($this->licenses[$key])) {
- return null;
- }
- list($identifier, $name, $isOsiApproved, $isDeprecatedLicenseId) = $this->licenses[$key];
- return array(
- $name,
- $isOsiApproved,
- 'https://spdx.org/licenses/' . $identifier . '.html#licenseText',
- $isDeprecatedLicenseId,
- );
- }
- public function getLicenses()
- {
- return $this->licenses;
- }
- public function getExceptionByIdentifier($identifier)
- {
- $key = strtolower($identifier);
- if (!isset($this->exceptions[$key])) {
- return null;
- }
- list($identifier, $name) = $this->exceptions[$key];
- return array(
- $name,
- 'https://spdx.org/licenses/' . $identifier . '.html#licenseExceptionText',
- );
- }
- public function getIdentifierByName($name)
- {
- foreach ($this->licenses as $licenseData) {
- if ($licenseData[1] === $name) {
- return $licenseData[0];
- }
- }
- foreach ($this->exceptions as $licenseData) {
- if ($licenseData[1] === $name) {
- return $licenseData[0];
- }
- }
- return null;
- }
- public function isOsiApprovedByIdentifier($identifier)
- {
- return $this->licenses[strtolower($identifier)][2];
- }
- public function isDeprecatedByIdentifier($identifier)
- {
- return $this->licenses[strtolower($identifier)][3];
- }
- public function validate($license)
- {
- if (is_array($license)) {
- $count = count($license);
- if ($count !== count(array_filter($license, 'is_string'))) {
- throw new \InvalidArgumentException('Array of strings expected.');
- }
- $license = $count > 1 ? '(' . implode(' OR ', $license) . ')' : (string) reset($license);
- }
- if (!is_string($license)) {
- throw new \InvalidArgumentException(sprintf(
- 'Array or String expected, %s given.',
- gettype($license)
- ));
- }
- return $this->isValidLicenseString($license);
- }
- public static function getResourcesDir()
- {
- return dirname(__DIR__) . '/res';
- }
- private function loadLicenses()
- {
- if (null !== $this->licenses) {
- return;
- }
- $json = file_get_contents(self::getResourcesDir() . '/' . self::LICENSES_FILE);
- if (false === $json) {
- throw new \RuntimeException('Missing license file in ' . self::getResourcesDir() . '/' . self::LICENSES_FILE);
- }
- $this->licenses = array();
- foreach (json_decode($json, true) as $identifier => $license) {
- $this->licenses[strtolower($identifier)] = array($identifier, $license[0], $license[1], $license[2]);
- }
- }
- private function loadExceptions()
- {
- if (null !== $this->exceptions) {
- return;
- }
- $json = file_get_contents(self::getResourcesDir() . '/' . self::EXCEPTIONS_FILE);
- if (false === $json) {
- throw new \RuntimeException('Missing exceptions file in ' . self::getResourcesDir() . '/' . self::EXCEPTIONS_FILE);
- }
- $this->exceptions = array();
- foreach (json_decode($json, true) as $identifier => $exception) {
- $this->exceptions[strtolower($identifier)] = array($identifier, $exception[0]);
- }
- }
- private function getLicensesExpression()
- {
- if (null === $this->licensesExpression) {
- $licenses = array_map('preg_quote', array_keys($this->licenses));
- rsort($licenses);
- $licenses = implode('|', $licenses);
- $this->licensesExpression = $licenses;
- }
- return $this->licensesExpression;
- }
- private function getExceptionsExpression()
- {
- if (null === $this->exceptionsExpression) {
- $exceptions = array_map('preg_quote', array_keys($this->exceptions));
- rsort($exceptions);
- $exceptions = implode('|', $exceptions);
- $this->exceptionsExpression = $exceptions;
- }
- return $this->exceptionsExpression;
- }
- private function isValidLicenseString($license)
- {
- if (isset($this->licenses[strtolower($license)])) {
- return true;
- }
- $licenses = $this->getLicensesExpression();
- $exceptions = $this->getExceptionsExpression();
- $regex = <<<REGEX
- {
- (?(DEFINE)
- # idstring: 1*( ALPHA / DIGIT / - / . )
- (?<idstring>[\pL\pN.-]{1,})
- # license-id: taken from list
- (?<licenseid>{$licenses})
- # license-exception-id: taken from list
- (?<licenseexceptionid>{$exceptions})
- # license-ref: [DocumentRef-1*(idstring):]LicenseRef-1*(idstring)
- (?<licenseref>(?:DocumentRef-(?&idstring):)?LicenseRef-(?&idstring))
- # simple-expresssion: license-id / license-id+ / license-ref
- (?<simple_expression>(?&licenseid)\+? | (?&licenseid) | (?&licenseref))
- # compound-expression: 1*(
- # simple-expression /
- # simple-expression WITH license-exception-id /
- # compound-expression AND compound-expression /
- # compound-expression OR compound-expression
- # ) / ( compound-expression ) )
- (?<compound_head>
- (?&simple_expression) ( \s+ WITH \s+ (?&licenseexceptionid))?
- | \( \s* (?&compound_expression) \s* \)
- )
- (?<compound_expression>
- (?&compound_head) (?: \s+ (?:AND|OR) \s+ (?&compound_expression))?
- )
- # license-expression: 1*1(simple-expression / compound-expression)
- (?<license_expression>(?&compound_expression) | (?&simple_expression))
- ) # end of define
- ^(NONE | NOASSERTION | (?&license_expression))$
- }xi
- REGEX;
- $match = preg_match($regex, $license);
- if (0 === $match) {
- return false;
- }
- if (false === $match) {
- throw new \RuntimeException('Regex failed to compile/run.');
- }
- return true;
- }
- }
- MIT License
- Copyright (c) 2017 Composer
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
- The above copyright notice and this permission notice shall be included in all
- copies or substantial portions of the Software.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- SOFTWARE.
- <?php
- declare(strict_types=1);
- namespace Composer\XdebugHandler;
- class PhpConfig
- {
- public function useOriginal(): array
- {
- $this->getDataAndReset();
- return [];
- }
- public function useStandard(): array
- {
- $data = $this->getDataAndReset();
- if ($data !== null) {
- return ['-n', '-c', $data['tmpIni']];
- }
- return [];
- }
- public function usePersistent(): array
- {
- $data = $this->getDataAndReset();
- if ($data !== null) {
- $this->updateEnv('PHPRC', $data['tmpIni']);
- $this->updateEnv('PHP_INI_SCAN_DIR', '');
- }
- return [];
- }
- private function getDataAndReset(): ?array
- {
- $data = XdebugHandler::getRestartSettings();
- if ($data !== null) {
- $this->updateEnv('PHPRC', $data['phprc']);
- $this->updateEnv('PHP_INI_SCAN_DIR', $data['scanDir']);
- }
- return $data;
- }
- private function updateEnv(string $name, $value): void
- {
- Process::setEnv($name, false !== $value ? $value : null);
- }
- }
- <?php
- declare(strict_types=1);
- namespace Composer\XdebugHandler;
- use Composer\Pcre\Preg;
- class Process
- {
- public static function escape(string $arg, bool $meta = true, bool $module = false): string
- {
- if (!defined('PHP_WINDOWS_VERSION_BUILD')) {
- return "'".str_replace("'", "'\\''", $arg)."'";
- }
- $quote = strpbrk($arg, " \t") !== false || $arg === '';
- $arg = Preg::replace('/(\\\\*)"/', '$1$1\\"', $arg, -1, $dquotes);
- if ($meta) {
- $meta = $dquotes || Preg::isMatch('/%[^%]+%/', $arg);
- if (!$meta) {
- $quote = $quote || strpbrk($arg, '^&|<>()') !== false;
- } elseif ($module && !$dquotes && $quote) {
- $meta = false;
- }
- }
- if ($quote) {
- $arg = '"'.(Preg::replace('/(\\\\*)$/', '$1$1', $arg)).'"';
- }
- if ($meta) {
- $arg = Preg::replace('/(["^&|<>()%])/', '^$1', $arg);
- }
- return $arg;
- }
- public static function escapeShellCommand(array $args): string
- {
- $command = '';
- $module = array_shift($args);
- if ($module !== null) {
- $command = self::escape($module, true, true);
- foreach ($args as $arg) {
- $command .= ' '.self::escape($arg);
- }
- }
- return $command;
- }
- public static function setEnv(string $name, ?string $value = null): bool
- {
- $unset = null === $value;
- if (!putenv($unset ? $name : $name.'='.$value)) {
- return false;
- }
- if ($unset) {
- unset($_SERVER[$name]);
- } else {
- $_SERVER[$name] = $value;
- }
- if (false !== stripos((string) ini_get('variables_order'), 'E')) {
- if ($unset) {
- unset($_ENV[$name]);
- } else {
- $_ENV[$name] = $value;
- }
- }
- return true;
- }
- }
- <?php
- declare(strict_types=1);
- namespace Composer\XdebugHandler;
- use Psr\Log\LoggerInterface;
- use Psr\Log\LogLevel;
- class Status
- {
- const ENV_RESTART = 'XDEBUG_HANDLER_RESTART';
- const CHECK = 'Check';
- const ERROR = 'Error';
- const INFO = 'Info';
- const NORESTART = 'NoRestart';
- const RESTART = 'Restart';
- const RESTARTING = 'Restarting';
- const RESTARTED = 'Restarted';
- private $debug;
- private $envAllowXdebug;
- private $loaded;
- private $logger;
- private $modeOff;
- private $time;
- public function __construct(string $envAllowXdebug, bool $debug)
- {
- $start = getenv(self::ENV_RESTART);
- Process::setEnv(self::ENV_RESTART);
- $this->time = is_numeric($start) ? round((microtime(true) - $start) * 1000) : 0;
- $this->envAllowXdebug = $envAllowXdebug;
- $this->debug = $debug && defined('STDERR');
- $this->modeOff = false;
- }
- public function setLogger(LoggerInterface $logger): void
- {
- $this->logger = $logger;
- }
- public function report(string $op, ?string $data): void
- {
- if ($this->logger !== null || $this->debug) {
- $callable = [$this, 'report'.$op];
- if (!is_callable($callable)) {
- throw new \InvalidArgumentException('Unknown op handler: '.$op);
- }
- $params = $data !== null ? [$data] : [];
- call_user_func_array($callable, $params);
- }
- }
- private function output(string $text, ?string $level = null): void
- {
- if ($this->logger !== null) {
- $this->logger->log($level !== null ? $level: LogLevel::DEBUG, $text);
- }
- if ($this->debug) {
- fwrite(STDERR, sprintf('xdebug-handler[%d] %s', getmypid(), $text.PHP_EOL));
- }
- }
- private function reportCheck(string $loaded): void
- {
- list($version, $mode) = explode('|', $loaded);
- if ($version !== '') {
- $this->loaded = '('.$version.')'.($mode !== '' ? ' xdebug.mode='.$mode : '');
- }
- $this->modeOff = $mode === 'off';
- $this->output('Checking '.$this->envAllowXdebug);
- }
- private function reportError(string $error): void
- {
- $this->output(sprintf('No restart (%s)', $error), LogLevel::WARNING);
- }
- private function reportInfo(string $info): void
- {
- $this->output($info);
- }
- private function reportNoRestart(): void
- {
- $this->output($this->getLoadedMessage());
- if ($this->loaded !== null) {
- $text = sprintf('No restart (%s)', $this->getEnvAllow());
- if (!((bool) getenv($this->envAllowXdebug))) {
- $text .= ' Allowed by '.($this->modeOff ? 'xdebug.mode' : 'application');
- }
- $this->output($text);
- }
- }
- private function reportRestart(): void
- {
- $this->output($this->getLoadedMessage());
- Process::setEnv(self::ENV_RESTART, (string) microtime(true));
- }
- private function reportRestarted(): void
- {
- $loaded = $this->getLoadedMessage();
- $text = sprintf('Restarted (%d ms). %s', $this->time, $loaded);
- $level = $this->loaded !== null ? LogLevel::WARNING : null;
- $this->output($text, $level);
- }
- private function reportRestarting(string $command): void
- {
- $text = sprintf('Process restarting (%s)', $this->getEnvAllow());
- $this->output($text);
- $text = 'Running '.$command;
- $this->output($text);
- }
- private function getEnvAllow(): string
- {
- return $this->envAllowXdebug.'='.getenv($this->envAllowXdebug);
- }
- private function getLoadedMessage(): string
- {
- $loaded = $this->loaded !== null ? sprintf('loaded %s', $this->loaded) : 'not loaded';
- return 'The Xdebug extension is '.$loaded;
- }
- }
- <?php
- declare(strict_types=1);
- namespace Composer\XdebugHandler;
- use Composer\Pcre\Preg;
- use Psr\Log\LoggerInterface;
- class XdebugHandler
- {
- const SUFFIX_ALLOW = '_ALLOW_XDEBUG';
- const SUFFIX_INIS = '_ORIGINAL_INIS';
- const RESTART_ID = 'internal';
- const RESTART_SETTINGS = 'XDEBUG_HANDLER_SETTINGS';
- const DEBUG = 'XDEBUG_HANDLER_DEBUG';
- protected $tmpIni;
- private static $inRestart;
- private static $name;
- private static $skipped;
- private static $xdebugActive;
- private static $xdebugMode;
- private static $xdebugVersion;
- private $cli;
- private $debug;
- private $envAllowXdebug;
- private $envOriginalInis;
- private $persistent;
- private $script;
- private $statusWriter;
- public function __construct(string $envPrefix)
- {
- if ($envPrefix === '') {
- throw new \RuntimeException('Invalid constructor parameter');
- }
- self::$name = strtoupper($envPrefix);
- $this->envAllowXdebug = self::$name.self::SUFFIX_ALLOW;
- $this->envOriginalInis = self::$name.self::SUFFIX_INIS;
- self::setXdebugDetails();
- self::$inRestart = false;
- if ($this->cli = PHP_SAPI === 'cli') {
- $this->debug = (string) getenv(self::DEBUG);
- }
- $this->statusWriter = new Status($this->envAllowXdebug, (bool) $this->debug);
- }
- public function setLogger(LoggerInterface $logger): self
- {
- $this->statusWriter->setLogger($logger);
- return $this;
- }
- public function setMainScript(string $script): self
- {
- $this->script = $script;
- return $this;
- }
- public function setPersistent(): self
- {
- $this->persistent = true;
- return $this;
- }
- public function check(): void
- {
- $this->notify(Status::CHECK, self::$xdebugVersion.'|'.self::$xdebugMode);
- $envArgs = explode('|', (string) getenv($this->envAllowXdebug));
- if (!((bool) $envArgs[0]) && $this->requiresRestart(self::$xdebugActive)) {
- $this->notify(Status::RESTART);
- if ($this->prepareRestart()) {
- $command = $this->getCommand();
- $this->restart($command);
- }
- return;
- }
- if (self::RESTART_ID === $envArgs[0] && count($envArgs) === 5) {
- $this->notify(Status::RESTARTED);
- Process::setEnv($this->envAllowXdebug);
- self::$inRestart = true;
- if (self::$xdebugVersion === null) {
- self::$skipped = $envArgs[1];
- }
- $this->tryEnableSignals();
- $this->setEnvRestartSettings($envArgs);
- return;
- }
- $this->notify(Status::NORESTART);
- $settings = self::getRestartSettings();
- if ($settings !== null) {
- $this->syncSettings($settings);
- }
- }
- public static function getAllIniFiles(): array
- {
- if (self::$name !== null) {
- $env = getenv(self::$name.self::SUFFIX_INIS);
- if (false !== $env) {
- return explode(PATH_SEPARATOR, $env);
- }
- }
- $paths = [(string) php_ini_loaded_file()];
- $scanned = php_ini_scanned_files();
- if ($scanned !== false) {
- $paths = array_merge($paths, array_map('trim', explode(',', $scanned)));
- }
- return $paths;
- }
- public static function getRestartSettings(): ?array
- {
- $envArgs = explode('|', (string) getenv(self::RESTART_SETTINGS));
- if (count($envArgs) !== 6
- || (!self::$inRestart && php_ini_loaded_file() !== $envArgs[0])) {
- return null;
- }
- return [
- 'tmpIni' => $envArgs[0],
- 'scannedInis' => (bool) $envArgs[1],
- 'scanDir' => '*' === $envArgs[2] ? false : $envArgs[2],
- 'phprc' => '*' === $envArgs[3] ? false : $envArgs[3],
- 'inis' => explode(PATH_SEPARATOR, $envArgs[4]),
- 'skipped' => $envArgs[5],
- ];
- }
- public static function getSkippedVersion(): string
- {
- return (string) self::$skipped;
- }
- public static function isXdebugActive(): bool
- {
- self::setXdebugDetails();
- return self::$xdebugActive;
- }
- protected function requiresRestart(bool $default): bool
- {
- return $default;
- }
- protected function restart(array $command): void
- {
- $this->doRestart($command);
- }
- private function doRestart(array $command): void
- {
- $this->tryEnableSignals();
- $this->notify(Status::RESTARTING, implode(' ', $command));
- if (PHP_VERSION_ID >= 70400) {
- $cmd = $command;
- } else {
- $cmd = Process::escapeShellCommand($command);
- if (defined('PHP_WINDOWS_VERSION_BUILD')) {
- $cmd = '"'.$cmd.'"';
- }
- }
- $process = proc_open($cmd, [], $pipes);
- if (is_resource($process)) {
- $exitCode = proc_close($process);
- }
- if (!isset($exitCode)) {
- $this->notify(Status::ERROR, 'Unable to restart process');
- $exitCode = -1;
- } else {
- $this->notify(Status::INFO, 'Restarted process exited '.$exitCode);
- }
- if ($this->debug === '2') {
- $this->notify(Status::INFO, 'Temp ini saved: '.$this->tmpIni);
- } else {
- @unlink((string) $this->tmpIni);
- }
- exit($exitCode);
- }
- private function prepareRestart(): bool
- {
- $error = null;
- $iniFiles = self::getAllIniFiles();
- $scannedInis = count($iniFiles) > 1;
- $tmpDir = sys_get_temp_dir();
- if (!$this->cli) {
- $error = 'Unsupported SAPI: '.PHP_SAPI;
- } elseif (!$this->checkConfiguration($info)) {
- $error = $info;
- } elseif (!$this->checkMainScript()) {
- $error = 'Unable to access main script: '.$this->script;
- } elseif (!$this->writeTmpIni($iniFiles, $tmpDir, $error)) {
- $error = $error !== null ? $error : 'Unable to create temp ini file at: '.$tmpDir;
- } elseif (!$this->setEnvironment($scannedInis, $iniFiles)) {
- $error = 'Unable to set environment variables';
- }
- if ($error !== null) {
- $this->notify(Status::ERROR, $error);
- }
- return $error === null;
- }
- private function writeTmpIni(array $iniFiles, string $tmpDir, ?string &$error): bool
- {
- if (($tmpfile = @tempnam($tmpDir, '')) === false) {
- return false;
- }
- $this->tmpIni = $tmpfile;
- if ($iniFiles[0] === '') {
- array_shift($iniFiles);
- }
- $content = '';
- $sectionRegex = '/^\s*\[(?:PATH|HOST)\s*=/mi';
- $xdebugRegex = '/^\s*(zend_extension\s*=.*xdebug.*)$/mi';
- foreach ($iniFiles as $file) {
- if (($data = @file_get_contents($file)) === false) {
- $error = 'Unable to read ini: '.$file;
- return false;
- }
- if (Preg::isMatchWithOffsets($sectionRegex, $data, $matches, PREG_OFFSET_CAPTURE)) {
- $data = substr($data, 0, $matches[0][1]);
- }
- $content .= Preg::replace($xdebugRegex, ';$1', $data).PHP_EOL;
- }
- $config = parse_ini_string($content);
- $loaded = ini_get_all(null, false);
- if (false === $config || false === $loaded) {
- $error = 'Unable to parse ini data';
- return false;
- }
- $content .= $this->mergeLoadedConfig($loaded, $config);
- $content .= 'opcache.enable_cli=0'.PHP_EOL;
- return (bool) @file_put_contents($this->tmpIni, $content);
- }
- private function getCommand(): array
- {
- $php = [PHP_BINARY];
- $args = array_slice($_SERVER['argv'], 1);
- if (!$this->persistent) {
- array_push($php, '-n', '-c', $this->tmpIni);
- }
- return array_merge($php, [$this->script], $args);
- }
- private function setEnvironment(bool $scannedInis, array $iniFiles): bool
- {
- $scanDir = getenv('PHP_INI_SCAN_DIR');
- $phprc = getenv('PHPRC');
- if (!putenv($this->envOriginalInis.'='.implode(PATH_SEPARATOR, $iniFiles))) {
- return false;
- }
- if ($this->persistent) {
- if (!putenv('PHP_INI_SCAN_DIR=') || !putenv('PHPRC='.$this->tmpIni)) {
- return false;
- }
- }
- $envArgs = [
- self::RESTART_ID,
- self::$xdebugVersion,
- (int) $scannedInis,
- false === $scanDir ? '*' : $scanDir,
- false === $phprc ? '*' : $phprc,
- ];
- return putenv($this->envAllowXdebug.'='.implode('|', $envArgs));
- }
- private function notify(string $op, ?string $data = null): void
- {
- $this->statusWriter->report($op, $data);
- }
- private function mergeLoadedConfig(array $loadedConfig, array $iniConfig): string
- {
- $content = '';
- foreach ($loadedConfig as $name => $value) {
- if (!is_string($value)
- || strpos($name, 'xdebug') === 0
- || $name === 'apc.mmap_file_mask') {
- continue;
- }
- if (!isset($iniConfig[$name]) || $iniConfig[$name] !== $value) {
- $content .= $name.'="'.addcslashes($value, '\\"').'"'.PHP_EOL;
- }
- }
- return $content;
- }
- private function checkMainScript(): bool
- {
- if ($this->script !== null) {
- return file_exists($this->script) || '--' === $this->script;
- }
- if (file_exists($this->script = $_SERVER['argv'][0])) {
- return true;
- }
- $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
- $main = end($trace);
- if ($main !== false && isset($main['file'])) {
- return file_exists($this->script = $main['file']);
- }
- return false;
- }
- private function setEnvRestartSettings(array $envArgs): void
- {
- $settings = [
- php_ini_loaded_file(),
- $envArgs[2],
- $envArgs[3],
- $envArgs[4],
- getenv($this->envOriginalInis),
- self::$skipped,
- ];
- Process::setEnv(self::RESTART_SETTINGS, implode('|', $settings));
- }
- private function syncSettings(array $settings): void
- {
- if (false === getenv($this->envOriginalInis)) {
- Process::setEnv($this->envOriginalInis, implode(PATH_SEPARATOR, $settings['inis']));
- }
- self::$skipped = $settings['skipped'];
- $this->notify(Status::INFO, 'Process called with existing restart settings');
- }
- private function checkConfiguration(?string &$info): bool
- {
- if (!function_exists('proc_open')) {
- $info = 'proc_open function is disabled';
- return false;
- }
- if (extension_loaded('uopz') && !((bool) ini_get('uopz.disable'))) {
- if (function_exists('uopz_allow_exit')) {
- @uopz_allow_exit(true);
- } else {
- $info = 'uopz extension is not compatible';
- return false;
- }
- }
- if (defined('PHP_WINDOWS_VERSION_BUILD') && PHP_VERSION_ID < 70400) {
- $workingDir = getcwd();
- if ($workingDir === false) {
- $info = 'unable to determine working directory';
- return false;
- }
- if (0 === strpos($workingDir, '\\\\')) {
- $info = 'cmd.exe does not support UNC paths: '.$workingDir;
- return false;
- }
- }
- return true;
- }
- private function tryEnableSignals(): void
- {
- if (function_exists('pcntl_async_signals') && function_exists('pcntl_signal')) {
- pcntl_async_signals(true);
- $message = 'Async signals enabled';
- if (!self::$inRestart) {
- pcntl_signal(SIGINT, SIG_IGN);
- } elseif (is_int(pcntl_signal_get_handler(SIGINT))) {
- pcntl_signal(SIGINT, SIG_DFL);
- }
- }
- if (!self::$inRestart && function_exists('sapi_windows_set_ctrl_handler')) {
- sapi_windows_set_ctrl_handler(function ($evt) {});
- }
- }
- private static function setXdebugDetails(): void
- {
- if (self::$xdebugActive !== null) {
- return;
- }
- self::$xdebugActive = false;
- if (!extension_loaded('xdebug')) {
- return;
- }
- $version = phpversion('xdebug');
- self::$xdebugVersion = $version !== false ? $version : 'unknown';
- if (version_compare(self::$xdebugVersion, '3.1', '>=')) {
- $modes = xdebug_info('mode');
- self::$xdebugMode = count($modes) === 0 ? 'off' : implode(',', $modes);
- self::$xdebugActive = self::$xdebugMode !== 'off';
- return;
- }
- $iniMode = ini_get('xdebug.mode');
- if ($iniMode === false) {
- self::$xdebugActive = true;
- return;
- }
- $envMode = (string) getenv('XDEBUG_MODE');
- if ($envMode !== '') {
- self::$xdebugMode = $envMode;
- } else {
- self::$xdebugMode = $iniMode !== '' ? $iniMode : 'off';
- }
- if (Preg::isMatch('/^,+$/', str_replace(' ', '', self::$xdebugMode))) {
- self::$xdebugMode = 'off';
- }
- self::$xdebugActive = self::$xdebugMode !== 'off';
- }
- }
- MIT License
- Copyright (c) 2016
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
- The above copyright notice and this permission notice shall be included in all
- copies or substantial portions of the Software.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- SOFTWARE.
- <?php
- namespace JsonSchema\Constraints;
- use JsonSchema\Entity\JsonPointer;
- use JsonSchema\Exception\InvalidArgumentException;
- use JsonSchema\Exception\ValidationException;
- use JsonSchema\Validator;
- class BaseConstraint
- {
- protected $errors = array();
- protected $errorMask = Validator::ERROR_NONE;
- protected $factory;
- public function __construct(Factory $factory = null)
- {
- $this->factory = $factory ?: new Factory();
- }
- public function addError(JsonPointer $path = null, $message, $constraint = '', array $more = null)
- {
- $error = array(
- 'property' => $this->convertJsonPointerIntoPropertyPath($path ?: new JsonPointer('')),
- 'pointer' => ltrim(strval($path ?: new JsonPointer('')), '#'),
- 'message' => $message,
- 'constraint' => $constraint,
- 'context' => $this->factory->getErrorContext(),
- );
- if ($this->factory->getConfig(Constraint::CHECK_MODE_EXCEPTIONS)) {
- throw new ValidationException(sprintf('Error validating %s: %s', $error['pointer'], $error['message']));
- }
- if (is_array($more) && count($more) > 0) {
- $error += $more;
- }
- $this->errors[] = $error;
- $this->errorMask |= $error['context'];
- }
- public function addErrors(array $errors)
- {
- if ($errors) {
- $this->errors = array_merge($this->errors, $errors);
- $errorMask = &$this->errorMask;
- array_walk($errors, function ($error) use (&$errorMask) {
- if (isset($error['context'])) {
- $errorMask |= $error['context'];
- }
- });
- }
- }
- public function getErrors($errorContext = Validator::ERROR_ALL)
- {
- if ($errorContext === Validator::ERROR_ALL) {
- return $this->errors;
- }
- return array_filter($this->errors, function ($error) use ($errorContext) {
- if ($errorContext & $error['context']) {
- return true;
- }
- });
- }
- public function numErrors($errorContext = Validator::ERROR_ALL)
- {
- if ($errorContext === Validator::ERROR_ALL) {
- return count($this->errors);
- }
- return count($this->getErrors($errorContext));
- }
- public function isValid()
- {
- return !$this->getErrors();
- }
- public function reset()
- {
- $this->errors = array();
- $this->errorMask = Validator::ERROR_NONE;
- }
- public function getErrorMask()
- {
- return $this->errorMask;
- }
- public static function arrayToObjectRecursive($array)
- {
- $json = json_encode($array);
- if (json_last_error() !== \JSON_ERROR_NONE) {
- $message = 'Unable to encode schema array as JSON';
- if (function_exists('json_last_error_msg')) {
- $message .= ': ' . json_last_error_msg();
- }
- throw new InvalidArgumentException($message);
- }
- return (object) json_decode($json);
- }
- }
- <?php
- namespace JsonSchema\Constraints;
- use JsonSchema\Entity\JsonPointer;
- class CollectionConstraint extends Constraint
- {
- public function check(&$value, $schema = null, JsonPointer $path = null, $i = null)
- {
- if (isset($schema->minItems) && count($value) < $schema->minItems) {
- $this->addError($path, 'There must be a minimum of ' . $schema->minItems . ' items in the array', 'minItems', array('minItems' => $schema->minItems));
- }
- if (isset($schema->maxItems) && count($value) > $schema->maxItems) {
- $this->addError($path, 'There must be a maximum of ' . $schema->maxItems . ' items in the array', 'maxItems', array('maxItems' => $schema->maxItems));
- }
- if (isset($schema->uniqueItems) && $schema->uniqueItems) {
- $unique = $value;
- if (is_array($value) && count($value)) {
- $unique = array_map(function ($e) {
- return var_export($e, true);
- }, $value);
- }
- if (count(array_unique($unique)) != count($value)) {
- $this->addError($path, 'There are no duplicates allowed in the array', 'uniqueItems');
- }
- }
- if (isset($schema->items)) {
- $this->validateItems($value, $schema, $path, $i);
- }
- }
- protected function validateItems(&$value, $schema = null, JsonPointer $path = null, $i = null)
- {
- if (is_object($schema->items)) {
- foreach ($value as $k => &$v) {
- $initErrors = $this->getErrors();
- $this->checkUndefined($v, $schema->items, $path, $k);
- if (count($initErrors) < count($this->getErrors()) && (isset($schema->additionalItems) && $schema->additionalItems !== false)) {
- $secondErrors = $this->getErrors();
- $this->checkUndefined($v, $schema->additionalItems, $path, $k);
- }
- if (isset($secondErrors) && count($secondErrors) < count($this->getErrors())) {
- $this->errors = $secondErrors;
- } elseif (isset($secondErrors) && count($secondErrors) === count($this->getErrors())) {
- $this->errors = $initErrors;
- }
- }
- unset($v);
- } else {
- foreach ($value as $k => &$v) {
- if (array_key_exists($k, $schema->items)) {
- $this->checkUndefined($v, $schema->items[$k], $path, $k);
- } else {
- if (property_exists($schema, 'additionalItems')) {
- if ($schema->additionalItems !== false) {
- $this->checkUndefined($v, $schema->additionalItems, $path, $k);
- } else {
- $this->addError(
- $path, 'The item ' . $i . '[' . $k . '] is not defined and the definition does not allow additional items', 'additionalItems', array('additionalItems' => $schema->additionalItems));
- }
- } else {
- $this->checkUndefined($v, new \stdClass(), $path, $k);
- }
- }
- }
- unset($v);
- if (count($value) > 0) {
- for ($k = count($value); $k < count($schema->items); $k++) {
- $undefinedInstance = $this->factory->createInstanceFor('undefined');
- $this->checkUndefined($undefinedInstance, $schema->items[$k], $path, $k);
- }
- }
- }
- }
- }
- <?php
- namespace JsonSchema\Constraints;
- use JsonSchema\Entity\JsonPointer;
- abstract class Constraint extends BaseConstraint implements ConstraintInterface
- {
- protected $inlineSchemaProperty = '$schema';
- const CHECK_MODE_NONE = 0x00000000;
- const CHECK_MODE_NORMAL = 0x00000001;
- const CHECK_MODE_TYPE_CAST = 0x00000002;
- const CHECK_MODE_COERCE_TYPES = 0x00000004;
- const CHECK_MODE_APPLY_DEFAULTS = 0x00000008;
- const CHECK_MODE_EXCEPTIONS = 0x00000010;
- const CHECK_MODE_DISABLE_FORMAT = 0x00000020;
- const CHECK_MODE_ONLY_REQUIRED_DEFAULTS = 0x00000080;
- const CHECK_MODE_VALIDATE_SCHEMA = 0x00000100;
- protected function incrementPath(JsonPointer $path = null, $i)
- {
- $path = $path ?: new JsonPointer('');
- if ($i === null || $i === '') {
- return $path;
- }
- $path = $path->withPropertyPaths(
- array_merge(
- $path->getPropertyPaths(),
- array($i)
- )
- );
- return $path;
- }
- protected function checkArray(&$value, $schema = null, JsonPointer $path = null, $i = null)
- {
- $validator = $this->factory->createInstanceFor('collection');
- $validator->check($value, $schema, $path, $i);
- $this->addErrors($validator->getErrors());
- }
- protected function checkObject(&$value, $schema = null, JsonPointer $path = null, $properties = null,
- $additionalProperties = null, $patternProperties = null, $appliedDefaults = array())
- {
- $validator = $this->factory->createInstanceFor('object');
- $validator->check($value, $schema, $path, $properties, $additionalProperties, $patternProperties, $appliedDefaults);
- $this->addErrors($validator->getErrors());
- }
- protected function checkType(&$value, $schema = null, JsonPointer $path = null, $i = null)
- {
- $validator = $this->factory->createInstanceFor('type');
- $validator->check($value, $schema, $path, $i);
- $this->addErrors($validator->getErrors());
- }
- protected function checkUndefined(&$value, $schema = null, JsonPointer $path = null, $i = null, $fromDefault = false)
- {
- $validator = $this->factory->createInstanceFor('undefined');
- $validator->check($value, $this->factory->getSchemaStorage()->resolveRefSchema($schema), $path, $i, $fromDefault);
- $this->addErrors($validator->getErrors());
- }
- protected function checkString($value, $schema = null, JsonPointer $path = null, $i = null)
- {
- $validator = $this->factory->createInstanceFor('string');
- $validator->check($value, $schema, $path, $i);
- $this->addErrors($validator->getErrors());
- }
- protected function checkNumber($value, $schema = null, JsonPointer $path = null, $i = null)
- {
- $validator = $this->factory->createInstanceFor('number');
- $validator->check($value, $schema, $path, $i);
- $this->addErrors($validator->getErrors());
- }
- protected function checkEnum($value, $schema = null, JsonPointer $path = null, $i = null)
- {
- $validator = $this->factory->createInstanceFor('enum');
- $validator->check($value, $schema, $path, $i);
- $this->addErrors($validator->getErrors());
- }
- protected function checkFormat($value, $schema = null, JsonPointer $path = null, $i = null)
- {
- $validator = $this->factory->createInstanceFor('format');
- $validator->check($value, $schema, $path, $i);
- $this->addErrors($validator->getErrors());
- }
- protected function getTypeCheck()
- {
- return $this->factory->getTypeCheck();
- }
- protected function convertJsonPointerIntoPropertyPath(JsonPointer $pointer)
- {
- $result = array_map(
- function ($path) {
- return sprintf(is_numeric($path) ? '[%d]' : '.%s', $path);
- },
- $pointer->getPropertyPaths()
- );
- return trim(implode('', $result), '.');
- }
- }
- <?php
- namespace JsonSchema\Constraints;
- use JsonSchema\Entity\JsonPointer;
- interface ConstraintInterface
- {
- public function getErrors();
- public function addErrors(array $errors);
- public function addError(JsonPointer $path = null, $message, $constraint='', array $more = null);
- public function isValid();
- public function check(&$value, $schema = null, JsonPointer $path = null, $i = null);
- }
- <?php
- namespace JsonSchema\Constraints;
- use JsonSchema\Entity\JsonPointer;
- class EnumConstraint extends Constraint
- {
- public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
- {
- if ($element instanceof UndefinedConstraint && (!isset($schema->required) || !$schema->required)) {
- return;
- }
- $type = gettype($element);
- foreach ($schema->enum as $enum) {
- $enumType = gettype($enum);
- if ($this->factory->getConfig(self::CHECK_MODE_TYPE_CAST) && $type == 'array' && $enumType == 'object') {
- if ((object) $element == $enum) {
- return;
- }
- }
- if ($type === gettype($enum)) {
- if ($type == 'object') {
- if ($element == $enum) {
- return;
- }
- } elseif ($element === $enum) {
- return;
- }
- }
- }
- $this->addError($path, 'Does not have a value in the enumeration ' . json_encode($schema->enum), 'enum', array('enum' => $schema->enum));
- }
- }
- <?php
- namespace JsonSchema\Constraints;
- use JsonSchema\Exception\InvalidArgumentException;
- use JsonSchema\SchemaStorage;
- use JsonSchema\SchemaStorageInterface;
- use JsonSchema\Uri\UriRetriever;
- use JsonSchema\UriRetrieverInterface;
- use JsonSchema\Validator;
- class Factory
- {
- protected $schemaStorage;
- protected $uriRetriever;
- private $checkMode = Constraint::CHECK_MODE_NORMAL;
- private $typeCheck = array();
- protected $errorContext = Validator::ERROR_DOCUMENT_VALIDATION;
- protected $constraintMap = array(
- 'array' => 'JsonSchema\Constraints\CollectionConstraint',
- 'collection' => 'JsonSchema\Constraints\CollectionConstraint',
- 'object' => 'JsonSchema\Constraints\ObjectConstraint',
- 'type' => 'JsonSchema\Constraints\TypeConstraint',
- 'undefined' => 'JsonSchema\Constraints\UndefinedConstraint',
- 'string' => 'JsonSchema\Constraints\StringConstraint',
- 'number' => 'JsonSchema\Constraints\NumberConstraint',
- 'enum' => 'JsonSchema\Constraints\EnumConstraint',
- 'format' => 'JsonSchema\Constraints\FormatConstraint',
- 'schema' => 'JsonSchema\Constraints\SchemaConstraint',
- 'validator' => 'JsonSchema\Validator'
- );
- private $instanceCache = array();
- public function __construct(
- SchemaStorageInterface $schemaStorage = null,
- UriRetrieverInterface $uriRetriever = null,
- $checkMode = Constraint::CHECK_MODE_NORMAL
- ) {
- $this->setConfig($checkMode);
- $this->uriRetriever = $uriRetriever ?: new UriRetriever();
- $this->schemaStorage = $schemaStorage ?: new SchemaStorage($this->uriRetriever);
- }
- public function setConfig($checkMode = Constraint::CHECK_MODE_NORMAL)
- {
- $this->checkMode = $checkMode;
- }
- public function addConfig($options)
- {
- $this->checkMode |= $options;
- }
- public function removeConfig($options)
- {
- $this->checkMode &= ~$options;
- }
- public function getConfig($options = null)
- {
- if ($options === null) {
- return $this->checkMode;
- }
- return $this->checkMode & $options;
- }
- public function getUriRetriever()
- {
- return $this->uriRetriever;
- }
- public function getSchemaStorage()
- {
- return $this->schemaStorage;
- }
- public function getTypeCheck()
- {
- if (!isset($this->typeCheck[$this->checkMode])) {
- $this->typeCheck[$this->checkMode] = ($this->checkMode & Constraint::CHECK_MODE_TYPE_CAST)
- ? new TypeCheck\LooseTypeCheck()
- : new TypeCheck\StrictTypeCheck();
- }
- return $this->typeCheck[$this->checkMode];
- }
- public function setConstraintClass($name, $class)
- {
- if (!class_exists($class)) {
- throw new InvalidArgumentException('Unknown constraint ' . $name);
- }
- if (!in_array('JsonSchema\Constraints\ConstraintInterface', class_implements($class))) {
- throw new InvalidArgumentException('Invalid class ' . $name);
- }
- $this->constraintMap[$name] = $class;
- return $this;
- }
- public function createInstanceFor($constraintName)
- {
- if (!isset($this->constraintMap[$constraintName])) {
- throw new InvalidArgumentException('Unknown constraint ' . $constraintName);
- }
- if (!isset($this->instanceCache[$constraintName])) {
- $this->instanceCache[$constraintName] = new $this->constraintMap[$constraintName]($this);
- }
- return clone $this->instanceCache[$constraintName];
- }
- public function getErrorContext()
- {
- return $this->errorContext;
- }
- public function setErrorContext($errorContext)
- {
- $this->errorContext = $errorContext;
- }
- }
- <?php
- namespace JsonSchema\Constraints;
- use JsonSchema\Entity\JsonPointer;
- use JsonSchema\Rfc3339;
- class FormatConstraint extends Constraint
- {
- public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
- {
- if (!isset($schema->format) || $this->factory->getConfig(self::CHECK_MODE_DISABLE_FORMAT)) {
- return;
- }
- switch ($schema->format) {
- case 'date':
- if (!$date = $this->validateDateTime($element, 'Y-m-d')) {
- $this->addError($path, sprintf('Invalid date %s, expected format YYYY-MM-DD', json_encode($element)), 'format', array('format' => $schema->format));
- }
- break;
- case 'time':
- if (!$this->validateDateTime($element, 'H:i:s')) {
- $this->addError($path, sprintf('Invalid time %s, expected format hh:mm:ss', json_encode($element)), 'format', array('format' => $schema->format));
- }
- break;
- case 'date-time':
- if (null === Rfc3339::createFromString($element)) {
- $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));
- }
- break;
- case 'utc-millisec':
- if (!$this->validateDateTime($element, 'U')) {
- $this->addError($path, sprintf('Invalid time %s, expected integer of milliseconds since Epoch', json_encode($element)), 'format', array('format' => $schema->format));
- }
- break;
- case 'regex':
- if (!$this->validateRegex($element)) {
- $this->addError($path, 'Invalid regex format ' . $element, 'format', array('format' => $schema->format));
- }
- break;
- case 'color':
- if (!$this->validateColor($element)) {
- $this->addError($path, 'Invalid color', 'format', array('format' => $schema->format));
- }
- break;
- case 'style':
- if (!$this->validateStyle($element)) {
- $this->addError($path, 'Invalid style', 'format', array('format' => $schema->format));
- }
- break;
- case 'phone':
- if (!$this->validatePhone($element)) {
- $this->addError($path, 'Invalid phone number', 'format', array('format' => $schema->format));
- }
- break;
- case 'uri':
- if (null === filter_var($element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE)) {
- $this->addError($path, 'Invalid URL format', 'format', array('format' => $schema->format));
- }
- break;
- case 'uriref':
- case 'uri-reference':
- if (null === filter_var($element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE)) {
- if (substr($element, 0, 2) === '//') {
- $validURL = filter_var('scheme:' . $element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE);
- } elseif (substr($element, 0, 1) === '/') {
- $validURL = filter_var('scheme://host' . $element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE);
- } elseif (strlen($element)) {
- $pathParts = explode('/', $element, 2);
- if (strpos($pathParts[0], ':') !== false) {
- $validURL = null;
- } else {
- $validURL = filter_var('scheme://host/' . $element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE);
- }
- } else {
- $validURL = null;
- }
- if ($validURL === null) {
- $this->addError($path, 'Invalid URL format', 'format', array('format' => $schema->format));
- }
- }
- break;
- case 'email':
- $filterFlags = FILTER_NULL_ON_FAILURE;
- if (defined('FILTER_FLAG_EMAIL_UNICODE')) {
- $filterFlags |= constant('FILTER_FLAG_EMAIL_UNICODE');
- }
- if (null === filter_var($element, FILTER_VALIDATE_EMAIL, $filterFlags)) {
- $this->addError($path, 'Invalid email', 'format', array('format' => $schema->format));
- }
- break;
- case 'ip-address':
- case 'ipv4':
- if (null === filter_var($element, FILTER_VALIDATE_IP, FILTER_NULL_ON_FAILURE | FILTER_FLAG_IPV4)) {
- $this->addError($path, 'Invalid IP address', 'format', array('format' => $schema->format));
- }
- break;
- case 'ipv6':
- if (null === filter_var($element, FILTER_VALIDATE_IP, FILTER_NULL_ON_FAILURE | FILTER_FLAG_IPV6)) {
- $this->addError($path, 'Invalid IP address', 'format', array('format' => $schema->format));
- }
- break;
- case 'host-name':
- case 'hostname':
- if (!$this->validateHostname($element)) {
- $this->addError($path, 'Invalid hostname', 'format', array('format' => $schema->format));
- }
- break;
- default:
- break;
- }
- }
- protected function validateDateTime($datetime, $format)
- {
- $dt = \DateTime::createFromFormat($format, $datetime);
- if (!$dt) {
- return false;
- }
- if ($datetime === $dt->format($format)) {
- return true;
- }
- if ((strpos('u', $format) !== -1) && (preg_match('/\.\d+Z$/', $datetime))) {
- return true;
- }
- return false;
- }
- protected function validateRegex($regex)
- {
- return false !== @preg_match('/' . $regex . '/u', '');
- }
- protected function validateColor($color)
- {
- if (in_array(strtolower($color), array('aqua', 'black', 'blue', 'fuchsia',
- 'gray', 'green', 'lime', 'maroon', 'navy', 'olive', 'orange', 'purple',
- 'red', 'silver', 'teal', 'white', 'yellow'))) {
- return true;
- }
- return preg_match('/^#([a-f0-9]{3}|[a-f0-9]{6})$/i', $color);
- }
- protected function validateStyle($style)
- {
- $properties = explode(';', rtrim($style, ';'));
- $invalidEntries = preg_grep('/^\s*[-a-z]+\s*:\s*.+$/i', $properties, PREG_GREP_INVERT);
- return empty($invalidEntries);
- }
- protected function validatePhone($phone)
- {
- return preg_match('/^\+?(\(\d{3}\)|\d{3}) \d{3} \d{4}$/', $phone);
- }
- protected function validateHostname($host)
- {
- $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';
- return preg_match($hostnameRegex, $host);
- }
- }
- <?php
- namespace JsonSchema\Constraints;
- use JsonSchema\Entity\JsonPointer;
- class NumberConstraint extends Constraint
- {
- public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
- {
- if (isset($schema->exclusiveMinimum)) {
- if (isset($schema->minimum)) {
- if ($schema->exclusiveMinimum && $element <= $schema->minimum) {
- $this->addError($path, 'Must have a minimum value of ' . $schema->minimum, 'exclusiveMinimum', array('minimum' => $schema->minimum));
- } elseif ($element < $schema->minimum) {
- $this->addError($path, 'Must have a minimum value of ' . $schema->minimum, 'minimum', array('minimum' => $schema->minimum));
- }
- } else {
- $this->addError($path, 'Use of exclusiveMinimum requires presence of minimum', 'missingMinimum');
- }
- } elseif (isset($schema->minimum) && $element < $schema->minimum) {
- $this->addError($path, 'Must have a minimum value of ' . $schema->minimum, 'minimum', array('minimum' => $schema->minimum));
- }
- if (isset($schema->exclusiveMaximum)) {
- if (isset($schema->maximum)) {
- if ($schema->exclusiveMaximum && $element >= $schema->maximum) {
- $this->addError($path, 'Must have a maximum value of ' . $schema->maximum, 'exclusiveMaximum', array('maximum' => $schema->maximum));
- } elseif ($element > $schema->maximum) {
- $this->addError($path, 'Must have a maximum value of ' . $schema->maximum, 'maximum', array('maximum' => $schema->maximum));
- }
- } else {
- $this->addError($path, 'Use of exclusiveMaximum requires presence of maximum', 'missingMaximum');
- }
- } elseif (isset($schema->maximum) && $element > $schema->maximum) {
- $this->addError($path, 'Must have a maximum value of ' . $schema->maximum, 'maximum', array('maximum' => $schema->maximum));
- }
- if (isset($schema->divisibleBy) && $this->fmod($element, $schema->divisibleBy) != 0) {
- $this->addError($path, 'Is not divisible by ' . $schema->divisibleBy, 'divisibleBy', array('divisibleBy' => $schema->divisibleBy));
- }
- if (isset($schema->multipleOf) && $this->fmod($element, $schema->multipleOf) != 0) {
- $this->addError($path, 'Must be a multiple of ' . $schema->multipleOf, 'multipleOf', array('multipleOf' => $schema->multipleOf));
- }
- $this->checkFormat($element, $schema, $path, $i);
- }
- private function fmod($number1, $number2)
- {
- $modulus = ($number1 - round($number1 / $number2) * $number2);
- $precision = 0.0000000001;
- if (-$precision < $modulus && $modulus < $precision) {
- return 0.0;
- }
- return $modulus;
- }
- }
- <?php
- namespace JsonSchema\Constraints;
- use JsonSchema\Entity\JsonPointer;
- class ObjectConstraint extends Constraint
- {
- protected $appliedDefaults = array();
- public function check(&$element, $schema = null, JsonPointer $path = null, $properties = null,
- $additionalProp = null, $patternProperties = null, $appliedDefaults = array())
- {
- if ($element instanceof UndefinedConstraint) {
- return;
- }
- $this->appliedDefaults = $appliedDefaults;
- $matches = array();
- if ($patternProperties) {
- $matches = $this->validatePatternProperties($element, $path, $patternProperties);
- }
- if ($properties) {
- $this->validateProperties($element, $properties, $path);
- }
- $this->validateElement($element, $matches, $schema, $path, $properties, $additionalProp);
- }
- public function validatePatternProperties($element, JsonPointer $path = null, $patternProperties)
- {
- $try = array('/', '#', '+', '~', '%');
- $matches = array();
- foreach ($patternProperties as $pregex => $schema) {
- $delimiter = '/';
- foreach ($try as $delimiter) {
- if (strpos($pregex, $delimiter) === false) {
- break;
- }
- }
- if (@preg_match($delimiter . $pregex . $delimiter . 'u', '') === false) {
- $this->addError($path, 'The pattern "' . $pregex . '" is invalid', 'pregex', array('pregex' => $pregex));
- continue;
- }
- foreach ($element as $i => $value) {
- if (preg_match($delimiter . $pregex . $delimiter . 'u', $i)) {
- $matches[] = $i;
- $this->checkUndefined($value, $schema ?: new \stdClass(), $path, $i, in_array($i, $this->appliedDefaults));
- }
- }
- }
- return $matches;
- }
- public function validateElement($element, $matches, $schema = null, JsonPointer $path = null,
- $properties = null, $additionalProp = null)
- {
- $this->validateMinMaxConstraint($element, $schema, $path);
- foreach ($element as $i => $value) {
- $definition = $this->getProperty($properties, $i);
- if (!in_array($i, $matches) && $additionalProp === false && $this->inlineSchemaProperty !== $i && !$definition) {
- $this->addError($path, 'The property ' . $i . ' is not defined and the definition does not allow additional properties', 'additionalProp');
- }
- if (!in_array($i, $matches) && $additionalProp && !$definition) {
- if ($additionalProp === true) {
- $this->checkUndefined($value, null, $path, $i, in_array($i, $this->appliedDefaults));
- } else {
- $this->checkUndefined($value, $additionalProp, $path, $i, in_array($i, $this->appliedDefaults));
- }
- }
- $require = $this->getProperty($definition, 'requires');
- if ($require && !$this->getProperty($element, $require)) {
- $this->addError($path, 'The presence of the property ' . $i . ' requires that ' . $require . ' also be present', 'requires');
- }
- $property = $this->getProperty($element, $i, $this->factory->createInstanceFor('undefined'));
- if (is_object($property)) {
- $this->validateMinMaxConstraint(!($property instanceof UndefinedConstraint) ? $property : $element, $definition, $path);
- }
- }
- }
- public function validateProperties(&$element, $properties = null, JsonPointer $path = null)
- {
- $undefinedConstraint = $this->factory->createInstanceFor('undefined');
- foreach ($properties as $i => $value) {
- $property = &$this->getProperty($element, $i, $undefinedConstraint);
- $definition = $this->getProperty($properties, $i);
- if (is_object($definition)) {
- $this->checkUndefined($property, $definition, $path, $i, in_array($i, $this->appliedDefaults));
- }
- }
- }
- protected function &getProperty(&$element, $property, $fallback = null)
- {
- if (is_array($element) && (isset($element[$property]) || array_key_exists($property, $element)) ) {
- return $element[$property];
- } elseif (is_object($element) && property_exists($element, $property)) {
- return $element->$property;
- }
- return $fallback;
- }
- protected function validateMinMaxConstraint($element, $objectDefinition, JsonPointer $path = null)
- {
- if (isset($objectDefinition->minProperties) && !is_object($objectDefinition->minProperties)) {
- if ($this->getTypeCheck()->propertyCount($element) < $objectDefinition->minProperties) {
- $this->addError($path, 'Must contain a minimum of ' . $objectDefinition->minProperties . ' properties', 'minProperties', array('minProperties' => $objectDefinition->minProperties));
- }
- }
- if (isset($objectDefinition->maxProperties) && !is_object($objectDefinition->maxProperties)) {
- if ($this->getTypeCheck()->propertyCount($element) > $objectDefinition->maxProperties) {
- $this->addError($path, 'Must contain no more than ' . $objectDefinition->maxProperties . ' properties', 'maxProperties', array('maxProperties' => $objectDefinition->maxProperties));
- }
- }
- }
- }
- <?php
- namespace JsonSchema\Constraints;
- use JsonSchema\Entity\JsonPointer;
- use JsonSchema\Exception\InvalidArgumentException;
- use JsonSchema\Exception\InvalidSchemaException;
- use JsonSchema\Exception\RuntimeException;
- use JsonSchema\Validator;
- class SchemaConstraint extends Constraint
- {
- const DEFAULT_SCHEMA_SPEC = 'http://json-schema.org/draft-04/schema#';
- public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
- {
- if ($schema !== null) {
- $validationSchema = $schema;
- } elseif ($this->getTypeCheck()->propertyExists($element, $this->inlineSchemaProperty)) {
- $validationSchema = $this->getTypeCheck()->propertyGet($element, $this->inlineSchemaProperty);
- } else {
- throw new InvalidArgumentException('no schema found to verify against');
- }
- if (is_array($validationSchema)) {
- $validationSchema = BaseConstraint::arrayToObjectRecursive($validationSchema);
- }
- if ($this->factory->getConfig(self::CHECK_MODE_VALIDATE_SCHEMA)) {
- if (!$this->getTypeCheck()->isObject($validationSchema)) {
- throw new RuntimeException('Cannot validate the schema of a non-object');
- }
- if ($this->getTypeCheck()->propertyExists($validationSchema, '$schema')) {
- $schemaSpec = $this->getTypeCheck()->propertyGet($validationSchema, '$schema');
- } else {
- $schemaSpec = self::DEFAULT_SCHEMA_SPEC;
- }
- $schemaStorage = $this->factory->getSchemaStorage();
- if (!$this->getTypeCheck()->isObject($schemaSpec)) {
- $schemaSpec = $schemaStorage->getSchema($schemaSpec);
- }
- $initialErrorCount = $this->numErrors();
- $initialConfig = $this->factory->getConfig();
- $initialContext = $this->factory->getErrorContext();
- $this->factory->removeConfig(self::CHECK_MODE_VALIDATE_SCHEMA | self::CHECK_MODE_APPLY_DEFAULTS);
- $this->factory->addConfig(self::CHECK_MODE_TYPE_CAST);
- $this->factory->setErrorContext(Validator::ERROR_SCHEMA_VALIDATION);
- try {
- $this->check($validationSchema, $schemaSpec);
- } catch (\Exception $e) {
- if ($this->factory->getConfig(self::CHECK_MODE_EXCEPTIONS)) {
- throw new InvalidSchemaException('Schema did not pass validation', 0, $e);
- }
- }
- if ($this->numErrors() > $initialErrorCount) {
- $this->addError($path, 'Schema is not valid', 'schema');
- }
- $this->factory->setConfig($initialConfig);
- $this->factory->setErrorContext($initialContext);
- }
- $this->checkUndefined($element, $validationSchema, $path, $i);
- }
- }
- <?php
- namespace JsonSchema\Constraints;
- use JsonSchema\Entity\JsonPointer;
- class StringConstraint extends Constraint
- {
- public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
- {
- if (isset($schema->maxLength) && $this->strlen($element) > $schema->maxLength) {
- $this->addError($path, 'Must be at most ' . $schema->maxLength . ' characters long', 'maxLength', array(
- 'maxLength' => $schema->maxLength,
- ));
- }
- if (isset($schema->minLength) && $this->strlen($element) < $schema->minLength) {
- $this->addError($path, 'Must be at least ' . $schema->minLength . ' characters long', 'minLength', array(
- 'minLength' => $schema->minLength,
- ));
- }
- if (isset($schema->pattern) && !preg_match('#' . str_replace('#', '\\#', $schema->pattern) . '#u', $element)) {
- $this->addError($path, 'Does not match the regex pattern ' . $schema->pattern, 'pattern', array(
- 'pattern' => $schema->pattern,
- ));
- }
- $this->checkFormat($element, $schema, $path, $i);
- }
- private function strlen($string)
- {
- if (extension_loaded('mbstring')) {
- return mb_strlen($string, mb_detect_encoding($string));
- }
- return strlen($string);
- }
- }
- <?php
- namespace JsonSchema\Constraints\TypeCheck;
- class LooseTypeCheck implements TypeCheckInterface
- {
- public static function isObject($value)
- {
- return
- is_object($value) ||
- (is_array($value) && (count($value) == 0 || self::isAssociativeArray($value)));
- }
- public static function isArray($value)
- {
- return
- is_array($value) &&
- (count($value) == 0 || !self::isAssociativeArray($value));
- }
- public static function propertyGet($value, $property)
- {
- if (is_object($value)) {
- return $value->{$property};
- }
- return $value[$property];
- }
- public static function propertySet(&$value, $property, $data)
- {
- if (is_object($value)) {
- $value->{$property} = $data;
- } else {
- $value[$property] = $data;
- }
- }
- public static function propertyExists($value, $property)
- {
- if (is_object($value)) {
- return property_exists($value, $property);
- }
- return array_key_exists($property, $value);
- }
- public static function propertyCount($value)
- {
- if (is_object($value)) {
- return count(get_object_vars($value));
- }
- return count($value);
- }
- private static function isAssociativeArray($arr)
- {
- return array_keys($arr) !== range(0, count($arr) - 1);
- }
- }
- <?php
- namespace JsonSchema\Constraints\TypeCheck;
- class StrictTypeCheck implements TypeCheckInterface
- {
- public static function isObject($value)
- {
- return is_object($value);
- }
- public static function isArray($value)
- {
- return is_array($value);
- }
- public static function propertyGet($value, $property)
- {
- return $value->{$property};
- }
- public static function propertySet(&$value, $property, $data)
- {
- $value->{$property} = $data;
- }
- public static function propertyExists($value, $property)
- {
- return property_exists($value, $property);
- }
- public static function propertyCount($value)
- {
- if (!is_object($value)) {
- return 0;
- }
- return count(get_object_vars($value));
- }
- }
- <?php
- namespace JsonSchema\Constraints\TypeCheck;
- interface TypeCheckInterface
- {
- public static function isObject($value);
- public static function isArray($value);
- public static function propertyGet($value, $property);
- public static function propertySet(&$value, $property, $data);
- public static function propertyExists($value, $property);
- public static function propertyCount($value);
- }
- <?php
- namespace JsonSchema\Constraints;
- use JsonSchema\Entity\JsonPointer;
- use JsonSchema\Exception\InvalidArgumentException;
- use UnexpectedValueException as StandardUnexpectedValueException;
- class TypeConstraint extends Constraint
- {
- public static $wording = array(
- 'integer' => 'an integer',
- 'number' => 'a number',
- 'boolean' => 'a boolean',
- 'object' => 'an object',
- 'array' => 'an array',
- 'string' => 'a string',
- 'null' => 'a null',
- 'any' => null,
- 0 => null,
- );
- public function check(&$value = null, $schema = null, JsonPointer $path = null, $i = null)
- {
- $type = isset($schema->type) ? $schema->type : null;
- $isValid = false;
- $wording = array();
- if (is_array($type)) {
- $this->validateTypesArray($value, $type, $wording, $isValid, $path);
- } elseif (is_object($type)) {
- $this->checkUndefined($value, $type, $path);
- return;
- } else {
- $isValid = $this->validateType($value, $type);
- }
- if ($isValid === false) {
- if (!is_array($type)) {
- $this->validateTypeNameWording($type);
- $wording[] = self::$wording[$type];
- }
- $this->addError($path, ucwords(gettype($value)) . ' value found, but ' .
- $this->implodeWith($wording, ', ', 'or') . ' is required', 'type');
- }
- }
- protected function validateTypesArray(&$value, array $type, &$validTypesWording, &$isValid, $path)
- {
- foreach ($type as $tp) {
- if (is_object($tp)) {
- if (!$isValid) {
- $validator = $this->factory->createInstanceFor('type');
- $subSchema = new \stdClass();
- $subSchema->type = $tp;
- $validator->check($value, $subSchema, $path, null);
- $error = $validator->getErrors();
- $isValid = !(bool) $error;
- $validTypesWording[] = self::$wording['object'];
- }
- } else {
- $this->validateTypeNameWording($tp);
- $validTypesWording[] = self::$wording[$tp];
- if (!$isValid) {
- $isValid = $this->validateType($value, $tp);
- }
- }
- }
- }
- protected function implodeWith(array $elements, $delimiter = ', ', $listEnd = false)
- {
- if ($listEnd === false || !isset($elements[1])) {
- return implode($delimiter, $elements);
- }
- $lastElement = array_slice($elements, -1);
- $firsElements = join($delimiter, array_slice($elements, 0, -1));
- $implodedElements = array_merge(array($firsElements), $lastElement);
- return join(" $listEnd ", $implodedElements);
- }
- protected function validateTypeNameWording($type)
- {
- if (!array_key_exists($type, self::$wording)) {
- throw new StandardUnexpectedValueException(
- sprintf(
- 'No wording for %s available, expected wordings are: [%s]',
- var_export($type, true),
- implode(', ', array_filter(self::$wording)))
- );
- }
- }
- protected function validateType(&$value, $type)
- {
- if (!$type) {
- return true;
- }
- if ('any' === $type) {
- return true;
- }
- if ('object' === $type) {
- return $this->getTypeCheck()->isObject($value);
- }
- if ('array' === $type) {
- return $this->getTypeCheck()->isArray($value);
- }
- $coerce = $this->factory->getConfig(Constraint::CHECK_MODE_COERCE_TYPES);
- if ('integer' === $type) {
- if ($coerce) {
- $value = $this->toInteger($value);
- }
- return is_int($value);
- }
- if ('number' === $type) {
- if ($coerce) {
- $value = $this->toNumber($value);
- }
- return is_numeric($value) && !is_string($value);
- }
- if ('boolean' === $type) {
- if ($coerce) {
- $value = $this->toBoolean($value);
- }
- return is_bool($value);
- }
- if ('string' === $type) {
- return is_string($value);
- }
- if ('email' === $type) {
- return is_string($value);
- }
- if ('null' === $type) {
- return is_null($value);
- }
- throw new InvalidArgumentException((is_object($value) ? 'object' : $value) . ' is an invalid type for ' . $type);
- }
- protected function toBoolean($value)
- {
- if ($value === 'true') {
- return true;
- }
- if ($value === 'false') {
- return false;
- }
- return $value;
- }
- protected function toNumber($value)
- {
- if (is_numeric($value)) {
- return $value + 0;
- }
- return $value;
- }
- protected function toInteger($value)
- {
- if (is_numeric($value) && (int) $value == $value) {
- return (int) $value;
- }
- return $value;
- }
- }
- <?php
- namespace JsonSchema\Constraints;
- use JsonSchema\Constraints\TypeCheck\LooseTypeCheck;
- use JsonSchema\Entity\JsonPointer;
- use JsonSchema\Exception\ValidationException;
- use JsonSchema\Uri\UriResolver;
- class UndefinedConstraint extends Constraint
- {
- protected $appliedDefaults = array();
- public function check(&$value, $schema = null, JsonPointer $path = null, $i = null, $fromDefault = false)
- {
- if (is_null($schema) || !is_object($schema)) {
- return;
- }
- $path = $this->incrementPath($path ?: new JsonPointer(''), $i);
- if ($fromDefault) {
- $path->setFromDefault();
- }
- $this->validateCommonProperties($value, $schema, $path, $i);
- $this->validateOfProperties($value, $schema, $path, '');
- $this->validateTypes($value, $schema, $path, $i);
- }
- public function validateTypes(&$value, $schema, JsonPointer $path, $i = null)
- {
- if ($this->getTypeCheck()->isArray($value)) {
- $this->checkArray($value, $schema, $path, $i);
- }
- if (LooseTypeCheck::isObject($value)) {
- $this->checkObject(
- $value,
- $schema,
- $path,
- isset($schema->properties) ? $schema->properties : null,
- isset($schema->additionalProperties) ? $schema->additionalProperties : null,
- isset($schema->patternProperties) ? $schema->patternProperties : null,
- $this->appliedDefaults
- );
- }
- if (is_string($value)) {
- $this->checkString($value, $schema, $path, $i);
- }
- if (is_numeric($value)) {
- $this->checkNumber($value, $schema, $path, $i);
- }
- if (isset($schema->enum)) {
- $this->checkEnum($value, $schema, $path, $i);
- }
- }
- protected function validateCommonProperties(&$value, $schema, JsonPointer $path, $i = '')
- {
- if (isset($schema->extends)) {
- if (is_string($schema->extends)) {
- $schema->extends = $this->validateUri($schema, $schema->extends);
- }
- if (is_array($schema->extends)) {
- foreach ($schema->extends as $extends) {
- $this->checkUndefined($value, $extends, $path, $i);
- }
- } else {
- $this->checkUndefined($value, $schema->extends, $path, $i);
- }
- }
- if (!$path->fromDefault()) {
- $this->applyDefaultValues($value, $schema, $path);
- }
- if ($this->getTypeCheck()->isObject($value)) {
- if (!($value instanceof self) && isset($schema->required) && is_array($schema->required)) {
- foreach ($schema->required as $required) {
- if (!$this->getTypeCheck()->propertyExists($value, $required)) {
- $this->addError(
- $this->incrementPath($path ?: new JsonPointer(''), $required),
- 'The property ' . $required . ' is required',
- 'required'
- );
- }
- }
- } elseif (isset($schema->required) && !is_array($schema->required)) {
- if ($schema->required && $value instanceof self) {
- $propertyPaths = $path->getPropertyPaths();
- $propertyName = end($propertyPaths);
- $this->addError(
- $path,
- 'The property ' . $propertyName . ' is required',
- 'required'
- );
- }
- } else {
- if ($value instanceof self) {
- return;
- }
- }
- }
- if (!($value instanceof self)) {
- $this->checkType($value, $schema, $path, $i);
- }
- if (isset($schema->disallow)) {
- $initErrors = $this->getErrors();
- $typeSchema = new \stdClass();
- $typeSchema->type = $schema->disallow;
- $this->checkType($value, $typeSchema, $path);
- if (count($this->getErrors()) == count($initErrors)) {
- $this->addError($path, 'Disallowed value was matched', 'disallow');
- } else {
- $this->errors = $initErrors;
- }
- }
- if (isset($schema->not)) {
- $initErrors = $this->getErrors();
- $this->checkUndefined($value, $schema->not, $path, $i);
- if (count($this->getErrors()) == count($initErrors)) {
- $this->addError($path, 'Matched a schema which it should not', 'not');
- } else {
- $this->errors = $initErrors;
- }
- }
- if (isset($schema->dependencies) && $this->getTypeCheck()->isObject($value)) {
- $this->validateDependencies($value, $schema->dependencies, $path);
- }
- }
- private function shouldApplyDefaultValue($requiredOnly, $schema, $name = null, $parentSchema = null)
- {
- if (!$requiredOnly) {
- return true;
- }
- if (
- $name !== null
- && isset($parentSchema->required)
- && is_array($parentSchema->required)
- && in_array($name, $parentSchema->required)
- ) {
- return true;
- }
- if (isset($schema->required) && !is_array($schema->required) && $schema->required) {
- return true;
- }
- return false;
- }
- protected function applyDefaultValues(&$value, $schema, $path)
- {
- if (!$this->factory->getConfig(self::CHECK_MODE_APPLY_DEFAULTS)) {
- return;
- }
- $requiredOnly = $this->factory->getConfig(self::CHECK_MODE_ONLY_REQUIRED_DEFAULTS);
- if (isset($schema->properties) && LooseTypeCheck::isObject($value)) {
- foreach ($schema->properties as $currentProperty => $propertyDefinition) {
- $propertyDefinition = $this->factory->getSchemaStorage()->resolveRefSchema($propertyDefinition);
- if (
- !LooseTypeCheck::propertyExists($value, $currentProperty)
- && property_exists($propertyDefinition, 'default')
- && $this->shouldApplyDefaultValue($requiredOnly, $propertyDefinition, $currentProperty, $schema)
- ) {
- if (is_object($propertyDefinition->default)) {
- LooseTypeCheck::propertySet($value, $currentProperty, clone $propertyDefinition->default);
- } else {
- LooseTypeCheck::propertySet($value, $currentProperty, $propertyDefinition->default);
- }
- $this->appliedDefaults[] = $currentProperty;
- }
- }
- } elseif (isset($schema->items) && LooseTypeCheck::isArray($value)) {
- $items = array();
- if (LooseTypeCheck::isArray($schema->items)) {
- $items = $schema->items;
- } elseif (isset($schema->minItems) && count($value) < $schema->minItems) {
- $items = array_fill(count($value), $schema->minItems - count($value), $schema->items);
- }
- foreach ($items as $currentItem => $itemDefinition) {
- $itemDefinition = $this->factory->getSchemaStorage()->resolveRefSchema($itemDefinition);
- if (
- !array_key_exists($currentItem, $value)
- && property_exists($itemDefinition, 'default')
- && $this->shouldApplyDefaultValue($requiredOnly, $itemDefinition)) {
- if (is_object($itemDefinition->default)) {
- $value[$currentItem] = clone $itemDefinition->default;
- } else {
- $value[$currentItem] = $itemDefinition->default;
- }
- }
- $path->setFromDefault();
- }
- } elseif (
- $value instanceof self
- && property_exists($schema, 'default')
- && $this->shouldApplyDefaultValue($requiredOnly, $schema)) {
- $value = is_object($schema->default) ? clone $schema->default : $schema->default;
- $path->setFromDefault();
- }
- }
- protected function validateOfProperties(&$value, $schema, JsonPointer $path, $i = '')
- {
- if ($value instanceof self) {
- return;
- }
- if (isset($schema->allOf)) {
- $isValid = true;
- foreach ($schema->allOf as $allOf) {
- $initErrors = $this->getErrors();
- $this->checkUndefined($value, $allOf, $path, $i);
- $isValid = $isValid && (count($this->getErrors()) == count($initErrors));
- }
- if (!$isValid) {
- $this->addError($path, 'Failed to match all schemas', 'allOf');
- }
- }
- if (isset($schema->anyOf)) {
- $isValid = false;
- $startErrors = $this->getErrors();
- $caughtException = null;
- foreach ($schema->anyOf as $anyOf) {
- $initErrors = $this->getErrors();
- try {
- $this->checkUndefined($value, $anyOf, $path, $i);
- if ($isValid = (count($this->getErrors()) == count($initErrors))) {
- break;
- }
- } catch (ValidationException $e) {
- $isValid = false;
- }
- }
- if (!$isValid) {
- $this->addError($path, 'Failed to match at least one schema', 'anyOf');
- } else {
- $this->errors = $startErrors;
- }
- }
- if (isset($schema->oneOf)) {
- $allErrors = array();
- $matchedSchemas = 0;
- $startErrors = $this->getErrors();
- foreach ($schema->oneOf as $oneOf) {
- try {
- $this->errors = array();
- $this->checkUndefined($value, $oneOf, $path, $i);
- if (count($this->getErrors()) == 0) {
- $matchedSchemas++;
- }
- $allErrors = array_merge($allErrors, array_values($this->getErrors()));
- } catch (ValidationException $e) {
- }
- }
- if ($matchedSchemas !== 1) {
- $this->addErrors(array_merge($allErrors, $startErrors));
- $this->addError($path, 'Failed to match exactly one schema', 'oneOf');
- } else {
- $this->errors = $startErrors;
- }
- }
- }
- protected function validateDependencies($value, $dependencies, JsonPointer $path, $i = '')
- {
- foreach ($dependencies as $key => $dependency) {
- if ($this->getTypeCheck()->propertyExists($value, $key)) {
- if (is_string($dependency)) {
- if (!$this->getTypeCheck()->propertyExists($value, $dependency)) {
- $this->addError($path, "$key depends on $dependency and $dependency is missing", 'dependencies');
- }
- } elseif (is_array($dependency)) {
- foreach ($dependency as $d) {
- if (!$this->getTypeCheck()->propertyExists($value, $d)) {
- $this->addError($path, "$key depends on $d and $d is missing", 'dependencies');
- }
- }
- } elseif (is_object($dependency)) {
- $this->checkUndefined($value, $dependency, $path, $i);
- }
- }
- }
- }
- protected function validateUri($schema, $schemaUri = null)
- {
- $resolver = new UriResolver();
- $retriever = $this->factory->getUriRetriever();
- $jsonSchema = null;
- if ($resolver->isValid($schemaUri)) {
- $schemaId = property_exists($schema, 'id') ? $schema->id : null;
- $jsonSchema = $retriever->retrieve($schemaId, $schemaUri);
- }
- return $jsonSchema;
- }
- }
- <?php
- namespace JsonSchema\Entity;
- use JsonSchema\Exception\InvalidArgumentException;
- class JsonPointer
- {
- private $filename;
- private $propertyPaths = array();
- private $fromDefault = false;
- public function __construct($value)
- {
- if (!is_string($value)) {
- throw new InvalidArgumentException('Ref value must be a string');
- }
- $splitRef = explode('#', $value, 2);
- $this->filename = $splitRef[0];
- if (array_key_exists(1, $splitRef)) {
- $this->propertyPaths = $this->decodePropertyPaths($splitRef[1]);
- }
- }
- private function decodePropertyPaths($propertyPathString)
- {
- $paths = array();
- foreach (explode('/', trim($propertyPathString, '/')) as $path) {
- $path = $this->decodePath($path);
- if (is_string($path) && '' !== $path) {
- $paths[] = $path;
- }
- }
- return $paths;
- }
- private function encodePropertyPaths()
- {
- return array_map(
- array($this, 'encodePath'),
- $this->getPropertyPaths()
- );
- }
- private function decodePath($path)
- {
- return strtr($path, array('~1' => '/', '~0' => '~', '%25' => '%'));
- }
- private function encodePath($path)
- {
- return strtr($path, array('/' => '~1', '~' => '~0', '%' => '%25'));
- }
- public function getFilename()
- {
- return $this->filename;
- }
- public function getPropertyPaths()
- {
- return $this->propertyPaths;
- }
- public function withPropertyPaths(array $propertyPaths)
- {
- $new = clone $this;
- $new->propertyPaths = $propertyPaths;
- return $new;
- }
- public function getPropertyPathAsString()
- {
- return rtrim('#/' . implode('/', $this->encodePropertyPaths()), '/');
- }
- public function __toString()
- {
- return $this->getFilename() . $this->getPropertyPathAsString();
- }
- public function setFromDefault()
- {
- $this->fromDefault = true;
- }
- public function fromDefault()
- {
- return $this->fromDefault;
- }
- }
- <?php
- namespace JsonSchema\Exception;
- interface ExceptionInterface
- {
- }
- <?php
- namespace JsonSchema\Exception;
- class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
- {
- }
- <?php
- namespace JsonSchema\Exception;
- class InvalidConfigException extends RuntimeException
- {
- }
- <?php
- namespace JsonSchema\Exception;
- class InvalidSchemaException extends RuntimeException
- {
- }
- <?php
- namespace JsonSchema\Exception;
- class InvalidSchemaMediaTypeException extends RuntimeException
- {
- }
- <?php
- namespace JsonSchema\Exception;
- class InvalidSourceUriException extends InvalidArgumentException
- {
- }
- <?php
- namespace JsonSchema\Exception;
- class JsonDecodingException extends RuntimeException
- {
- public function __construct($code = JSON_ERROR_NONE, \Exception $previous = null)
- {
- switch ($code) {
- case JSON_ERROR_DEPTH:
- $message = 'The maximum stack depth has been exceeded';
- break;
- case JSON_ERROR_STATE_MISMATCH:
- $message = 'Invalid or malformed JSON';
- break;
- case JSON_ERROR_CTRL_CHAR:
- $message = 'Control character error, possibly incorrectly encoded';
- break;
- case JSON_ERROR_UTF8:
- $message = 'Malformed UTF-8 characters, possibly incorrectly encoded';
- break;
- case JSON_ERROR_SYNTAX:
- $message = 'JSON syntax is malformed';
- break;
- default:
- $message = 'Syntax error';
- }
- parent::__construct($message, $code, $previous);
- }
- }
- <?php
- namespace JsonSchema\Exception;
- class ResourceNotFoundException extends RuntimeException
- {
- }
- <?php
- namespace JsonSchema\Exception;
- class RuntimeException extends \RuntimeException implements ExceptionInterface
- {
- }
- <?php
- namespace JsonSchema\Exception;
- class UnresolvableJsonPointerException extends InvalidArgumentException
- {
- }
- <?php
- namespace JsonSchema\Exception;
- class UriResolverException extends RuntimeException
- {
- }
- <?php
- namespace JsonSchema\Exception;
- class ValidationException extends RuntimeException
- {
- }
- <?php
- namespace JsonSchema\Iterator;
- class ObjectIterator implements \Iterator, \Countable
- {
- private $object;
- private $position = 0;
- private $data = array();
- private $initialized = false;
- public function __construct($object)
- {
- $this->object = $object;
- }
- public function current()
- {
- $this->initialize();
- return $this->data[$this->position];
- }
- public function next()
- {
- $this->initialize();
- $this->position++;
- }
- public function key()
- {
- $this->initialize();
- return $this->position;
- }
- public function valid()
- {
- $this->initialize();
- return isset($this->data[$this->position]);
- }
- public function rewind()
- {
- $this->initialize();
- $this->position = 0;
- }
- public function count()
- {
- $this->initialize();
- return count($this->data);
- }
- private function initialize()
- {
- if (!$this->initialized) {
- $this->data = $this->buildDataFromObject($this->object);
- $this->initialized = true;
- }
- }
- private function buildDataFromObject($object)
- {
- $result = array();
- $stack = new \SplStack();
- $stack->push($object);
- while (!$stack->isEmpty()) {
- $current = $stack->pop();
- if (is_object($current)) {
- array_push($result, $current);
- }
- foreach ($this->getDataFromItem($current) as $propertyName => $propertyValue) {
- if (is_object($propertyValue) || is_array($propertyValue)) {
- $stack->push($propertyValue);
- }
- }
- }
- return $result;
- }
- private function getDataFromItem($item)
- {
- if (!is_object($item) && !is_array($item)) {
- return array();
- }
- return is_object($item) ? get_object_vars($item) : $item;
- }
- }
- <?php
- namespace JsonSchema;
- class Rfc3339
- {
- const REGEX = '/^(\d{4}-\d{2}-\d{2}[T ]{1}\d{2}:\d{2}:\d{2})(\.\d+)?(Z|([+-]\d{2}):?(\d{2}))$/';
- public static function createFromString($string)
- {
- if (!preg_match(self::REGEX, strtoupper($string), $matches)) {
- return null;
- }
- $dateAndTime = $matches[1];
- $microseconds = $matches[2] ?: '.000000';
- $timeZone = 'Z' !== $matches[3] ? $matches[4] . ':' . $matches[5] : '+00:00';
- $dateFormat = strpos($dateAndTime, 'T') === false ? 'Y-m-d H:i:s.uP' : 'Y-m-d\TH:i:s.uP';
- $dateTime = \DateTime::createFromFormat($dateFormat, $dateAndTime . $microseconds . $timeZone, new \DateTimeZone('UTC'));
- return $dateTime ?: null;
- }
- }
- <?php
- namespace JsonSchema;
- use JsonSchema\Constraints\BaseConstraint;
- use JsonSchema\Entity\JsonPointer;
- use JsonSchema\Exception\UnresolvableJsonPointerException;
- use JsonSchema\Uri\UriResolver;
- use JsonSchema\Uri\UriRetriever;
- class SchemaStorage implements SchemaStorageInterface
- {
- const INTERNAL_PROVIDED_SCHEMA_URI = 'internal://provided-schema/';
- protected $uriRetriever;
- protected $uriResolver;
- protected $schemas = array();
- public function __construct(
- UriRetrieverInterface $uriRetriever = null,
- UriResolverInterface $uriResolver = null
- ) {
- $this->uriRetriever = $uriRetriever ?: new UriRetriever();
- $this->uriResolver = $uriResolver ?: new UriResolver();
- }
- public function getUriRetriever()
- {
- return $this->uriRetriever;
- }
- public function getUriResolver()
- {
- return $this->uriResolver;
- }
- public function addSchema($id, $schema = null)
- {
- if (is_null($schema) && $id !== self::INTERNAL_PROVIDED_SCHEMA_URI) {
- $schema = $this->uriRetriever->retrieve($id);
- }
- if (is_array($schema)) {
- $schema = BaseConstraint::arrayToObjectRecursive($schema);
- }
- if (is_object($schema) && property_exists($schema, 'id')) {
- if ($schema->id == 'http://json-schema.org/draft-04/schema#') {
- $schema->properties->id->format = 'uri-reference';
- } elseif ($schema->id == 'http://json-schema.org/draft-03/schema#') {
- $schema->properties->id->format = 'uri-reference';
- $schema->properties->{'$ref'}->format = 'uri-reference';
- }
- }
- $this->expandRefs($schema, $id);
- $this->schemas[$id] = $schema;
- }
- private function expandRefs(&$schema, $base = null)
- {
- if (!is_object($schema)) {
- if (is_array($schema)) {
- foreach ($schema as &$member) {
- $this->expandRefs($member, $base);
- }
- }
- return;
- }
- if (property_exists($schema, 'id') && is_string($schema->id) && $base != $schema->id) {
- $base = $this->uriResolver->resolve($schema->id, $base);
- }
- if (property_exists($schema, '$ref') && is_string($schema->{'$ref'})) {
- $refPointer = new JsonPointer($this->uriResolver->resolve($schema->{'$ref'}, $base));
- $schema->{'$ref'} = (string) $refPointer;
- }
- foreach ($schema as &$member) {
- $this->expandRefs($member, $base);
- }
- }
- public function getSchema($id)
- {
- if (!array_key_exists($id, $this->schemas)) {
- $this->addSchema($id);
- }
- return $this->schemas[$id];
- }
- public function resolveRef($ref)
- {
- $jsonPointer = new JsonPointer($ref);
- $fileName = $jsonPointer->getFilename();
- if (!strlen($fileName)) {
- throw new UnresolvableJsonPointerException(sprintf(
- "Could not resolve fragment '%s': no file is defined",
- $jsonPointer->getPropertyPathAsString()
- ));
- }
- $refSchema = $this->getSchema($fileName);
- foreach ($jsonPointer->getPropertyPaths() as $path) {
- if (is_object($refSchema) && property_exists($refSchema, $path)) {
- $refSchema = $this->resolveRefSchema($refSchema->{$path});
- } elseif (is_array($refSchema) && array_key_exists($path, $refSchema)) {
- $refSchema = $this->resolveRefSchema($refSchema[$path]);
- } else {
- throw new UnresolvableJsonPointerException(sprintf(
- 'File: %s is found, but could not resolve fragment: %s',
- $jsonPointer->getFilename(),
- $jsonPointer->getPropertyPathAsString()
- ));
- }
- }
- return $refSchema;
- }
- public function resolveRefSchema($refSchema)
- {
- if (is_object($refSchema) && property_exists($refSchema, '$ref') && is_string($refSchema->{'$ref'})) {
- $newSchema = $this->resolveRef($refSchema->{'$ref'});
- $refSchema = (object) (get_object_vars($refSchema) + get_object_vars($newSchema));
- unset($refSchema->{'$ref'});
- }
- return $refSchema;
- }
- }
- <?php
- namespace JsonSchema;
- interface SchemaStorageInterface
- {
- public function addSchema($id, $schema = null);
- public function getSchema($id);
- public function resolveRef($ref);
- public function resolveRefSchema($refSchema);
- }
- <?php
- namespace JsonSchema\Uri\Retrievers;
- abstract class AbstractRetriever implements UriRetrieverInterface
- {
- protected $contentType;
- public function getContentType()
- {
- return $this->contentType;
- }
- }
- <?php
- namespace JsonSchema\Uri\Retrievers;
- use JsonSchema\Exception\RuntimeException;
- use JsonSchema\Validator;
- class Curl extends AbstractRetriever
- {
- protected $messageBody;
- public function __construct()
- {
- if (!function_exists('curl_init')) {
- throw new RuntimeException('cURL not installed');
- }
- }
- public function retrieve($uri)
- {
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $uri);
- curl_setopt($ch, CURLOPT_HEADER, true);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: ' . Validator::SCHEMA_MEDIA_TYPE));
- $response = curl_exec($ch);
- if (false === $response) {
- throw new \JsonSchema\Exception\ResourceNotFoundException('JSON schema not found');
- }
- $this->fetchMessageBody($response);
- $this->fetchContentType($response);
- curl_close($ch);
- return $this->messageBody;
- }
- private function fetchMessageBody($response)
- {
- preg_match("/(?:\r\n){2}(.*)$/ms", $response, $match);
- $this->messageBody = $match[1];
- }
- protected function fetchContentType($response)
- {
- if (0 < preg_match("/Content-Type:(\V*)/ims", $response, $match)) {
- $this->contentType = trim($match[1]);
- return true;
- }
- return false;
- }
- }
- <?php
- namespace JsonSchema\Uri\Retrievers;
- use JsonSchema\Exception\ResourceNotFoundException;
- class FileGetContents extends AbstractRetriever
- {
- protected $messageBody;
- public function retrieve($uri)
- {
- $errorMessage = null;
- set_error_handler(function ($errno, $errstr) use (&$errorMessage) {
- $errorMessage = $errstr;
- });
- $response = file_get_contents($uri);
- restore_error_handler();
- if ($errorMessage) {
- throw new ResourceNotFoundException($errorMessage);
- }
- if (false === $response) {
- throw new ResourceNotFoundException('JSON schema not found at ' . $uri);
- }
- if ($response == ''
- && substr($uri, 0, 7) == 'file://' && substr($uri, -1) == '/'
- ) {
- throw new ResourceNotFoundException('JSON schema not found at ' . $uri);
- }
- $this->messageBody = $response;
- if (!empty($http_response_header)) {
- $this->fetchContentType($http_response_header);
- } else {
- $this->contentType = null;
- }
- return $this->messageBody;
- }
- private function fetchContentType(array $headers)
- {
- foreach ($headers as $header) {
- if ($this->contentType = self::getContentTypeMatchInHeader($header)) {
- return true;
- }
- }
- return false;
- }
- protected static function getContentTypeMatchInHeader($header)
- {
- if (0 < preg_match("/Content-Type:(\V*)/ims", $header, $match)) {
- return trim($match[1]);
- }
- return null;
- }
- }
- <?php
- namespace JsonSchema\Uri\Retrievers;
- use JsonSchema\Validator;
- class PredefinedArray extends AbstractRetriever
- {
- private $schemas;
- public function __construct(array $schemas, $contentType = Validator::SCHEMA_MEDIA_TYPE)
- {
- $this->schemas = $schemas;
- $this->contentType = $contentType;
- }
- public function retrieve($uri)
- {
- if (!array_key_exists($uri, $this->schemas)) {
- throw new \JsonSchema\Exception\ResourceNotFoundException(sprintf(
- 'The JSON schema "%s" was not found.',
- $uri
- ));
- }
- return $this->schemas[$uri];
- }
- }
- <?php
- namespace JsonSchema\Uri\Retrievers;
- interface UriRetrieverInterface
- {
- public function retrieve($uri);
- public function getContentType();
- }
- <?php
- namespace JsonSchema\Uri;
- use JsonSchema\Exception\UriResolverException;
- use JsonSchema\UriResolverInterface;
- class UriResolver implements UriResolverInterface
- {
- public function parse($uri)
- {
- preg_match('|^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?|', $uri, $match);
- $components = array();
- if (5 < count($match)) {
- $components = array(
- 'scheme' => $match[2],
- 'authority' => $match[4],
- 'path' => $match[5]
- );
- }
- if (7 < count($match)) {
- $components['query'] = $match[7];
- }
- if (9 < count($match)) {
- $components['fragment'] = $match[9];
- }
- return $components;
- }
- public function generate(array $components)
- {
- $uri = $components['scheme'] . '://'
- . $components['authority']
- . $components['path'];
- if (array_key_exists('query', $components) && strlen($components['query'])) {
- $uri .= '?' . $components['query'];
- }
- if (array_key_exists('fragment', $components)) {
- $uri .= '#' . $components['fragment'];
- }
- return $uri;
- }
- public function resolve($uri, $baseUri = null)
- {
- if (
- !is_null($baseUri) &&
- !filter_var($baseUri, \FILTER_VALIDATE_URL) &&
- !preg_match('|^[^/]+://|u', $baseUri)
- ) {
- if (is_file($baseUri)) {
- $baseUri = 'file://' . realpath($baseUri);
- } elseif (is_dir($baseUri)) {
- $baseUri = 'file://' . realpath($baseUri) . '/';
- } else {
- $baseUri = 'file://' . getcwd() . '/' . $baseUri;
- }
- }
- if ($uri == '') {
- return $baseUri;
- }
- $components = $this->parse($uri);
- $path = $components['path'];
- if (!empty($components['scheme'])) {
- return $uri;
- }
- $baseComponents = $this->parse($baseUri);
- $basePath = $baseComponents['path'];
- $baseComponents['path'] = self::combineRelativePathWithBasePath($path, $basePath);
- if (isset($components['fragment'])) {
- $baseComponents['fragment'] = $components['fragment'];
- }
- return $this->generate($baseComponents);
- }
- public static function combineRelativePathWithBasePath($relativePath, $basePath)
- {
- $relativePath = self::normalizePath($relativePath);
- if ($relativePath == '') {
- return $basePath;
- }
- if ($relativePath[0] == '/') {
- return $relativePath;
- }
- $basePathSegments = explode('/', $basePath);
- preg_match('|^/?(\.\./(?:\./)*)*|', $relativePath, $match);
- $numLevelUp = strlen($match[0]) /3 + 1;
- if ($numLevelUp >= count($basePathSegments)) {
- throw new UriResolverException(sprintf("Unable to resolve URI '%s' from base '%s'", $relativePath, $basePath));
- }
- $basePathSegments = array_slice($basePathSegments, 0, -$numLevelUp);
- $path = preg_replace('|^/?(\.\./(\./)*)*|', '', $relativePath);
- return implode('/', $basePathSegments) . '/' . $path;
- }
- private static function normalizePath($path)
- {
- $path = preg_replace('|((?<!\.)\./)*|', '', $path);
- $path = preg_replace('|//|', '/', $path);
- return $path;
- }
- public function isValid($uri)
- {
- $components = $this->parse($uri);
- return !empty($components);
- }
- }
- <?php
- namespace JsonSchema\Uri;
- use JsonSchema\Exception\InvalidSchemaMediaTypeException;
- use JsonSchema\Exception\JsonDecodingException;
- use JsonSchema\Exception\ResourceNotFoundException;
- use JsonSchema\Uri\Retrievers\FileGetContents;
- use JsonSchema\Uri\Retrievers\UriRetrieverInterface;
- use JsonSchema\UriRetrieverInterface as BaseUriRetrieverInterface;
- use JsonSchema\Validator;
- class UriRetriever implements BaseUriRetrieverInterface
- {
- protected $translationMap = array(
- '|^https?://json-schema.org/draft-(0[34])/schema#?|' => 'package://dist/schema/json-schema-draft-$1.json'
- );
- protected $allowedInvalidContentTypeEndpoints = array(
- 'http://json-schema.org/',
- 'https://json-schema.org/'
- );
- protected $uriRetriever = null;
- private $schemaCache = array();
- public function addInvalidContentTypeEndpoint($endpoint)
- {
- $this->allowedInvalidContentTypeEndpoints[] = $endpoint;
- }
- public function confirmMediaType($uriRetriever, $uri)
- {
- $contentType = $uriRetriever->getContentType();
- if (is_null($contentType)) {
- return;
- }
- if (in_array($contentType, array(Validator::SCHEMA_MEDIA_TYPE, 'application/json'))) {
- return;
- }
- foreach ($this->allowedInvalidContentTypeEndpoints as $endpoint) {
- if (strpos($uri, $endpoint) === 0) {
- return true;
- }
- }
- throw new InvalidSchemaMediaTypeException(sprintf('Media type %s expected', Validator::SCHEMA_MEDIA_TYPE));
- }
- public function getUriRetriever()
- {
- if (is_null($this->uriRetriever)) {
- $this->setUriRetriever(new FileGetContents());
- }
- return $this->uriRetriever;
- }
- public function resolvePointer($jsonSchema, $uri)
- {
- $resolver = new UriResolver();
- $parsed = $resolver->parse($uri);
- if (empty($parsed['fragment'])) {
- return $jsonSchema;
- }
- $path = explode('/', $parsed['fragment']);
- while ($path) {
- $pathElement = array_shift($path);
- if (!empty($pathElement)) {
- $pathElement = str_replace('~1', '/', $pathElement);
- $pathElement = str_replace('~0', '~', $pathElement);
- if (!empty($jsonSchema->$pathElement)) {
- $jsonSchema = $jsonSchema->$pathElement;
- } else {
- throw new ResourceNotFoundException(
- 'Fragment "' . $parsed['fragment'] . '" not found'
- . ' in ' . $uri
- );
- }
- if (!is_object($jsonSchema)) {
- throw new ResourceNotFoundException(
- 'Fragment part "' . $pathElement . '" is no object '
- . ' in ' . $uri
- );
- }
- }
- }
- return $jsonSchema;
- }
- public function retrieve($uri, $baseUri = null, $translate = true)
- {
- $resolver = new UriResolver();
- $resolvedUri = $fetchUri = $resolver->resolve($uri, $baseUri);
- $arParts = $resolver->parse($resolvedUri);
- if (isset($arParts['fragment'])) {
- unset($arParts['fragment']);
- $fetchUri = $resolver->generate($arParts);
- }
- if ($translate) {
- $fetchUri = $this->translate($fetchUri);
- }
- $jsonSchema = $this->loadSchema($fetchUri);
- $jsonSchema = $this->resolvePointer($jsonSchema, $resolvedUri);
- if ($jsonSchema instanceof \stdClass) {
- $jsonSchema->id = $resolvedUri;
- }
- return $jsonSchema;
- }
- protected function loadSchema($fetchUri)
- {
- if (isset($this->schemaCache[$fetchUri])) {
- return $this->schemaCache[$fetchUri];
- }
- $uriRetriever = $this->getUriRetriever();
- $contents = $this->uriRetriever->retrieve($fetchUri);
- $this->confirmMediaType($uriRetriever, $fetchUri);
- $jsonSchema = json_decode($contents);
- if (JSON_ERROR_NONE < $error = json_last_error()) {
- throw new JsonDecodingException($error);
- }
- $this->schemaCache[$fetchUri] = $jsonSchema;
- return $jsonSchema;
- }
- public function setUriRetriever(UriRetrieverInterface $uriRetriever)
- {
- $this->uriRetriever = $uriRetriever;
- return $this;
- }
- public function parse($uri)
- {
- preg_match('|^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?|', $uri, $match);
- $components = array();
- if (5 < count($match)) {
- $components = array(
- 'scheme' => $match[2],
- 'authority' => $match[4],
- 'path' => $match[5]
- );
- }
- if (7 < count($match)) {
- $components['query'] = $match[7];
- }
- if (9 < count($match)) {
- $components['fragment'] = $match[9];
- }
- return $components;
- }
- public function generate(array $components)
- {
- $uri = $components['scheme'] . '://'
- . $components['authority']
- . $components['path'];
- if (array_key_exists('query', $components)) {
- $uri .= $components['query'];
- }
- if (array_key_exists('fragment', $components)) {
- $uri .= $components['fragment'];
- }
- return $uri;
- }
- public function resolve($uri, $baseUri = null)
- {
- $components = $this->parse($uri);
- $path = $components['path'];
- if ((array_key_exists('scheme', $components)) && ('http' === $components['scheme'])) {
- return $uri;
- }
- $baseComponents = $this->parse($baseUri);
- $basePath = $baseComponents['path'];
- $baseComponents['path'] = UriResolver::combineRelativePathWithBasePath($path, $basePath);
- return $this->generate($baseComponents);
- }
- public function isValid($uri)
- {
- $components = $this->parse($uri);
- return !empty($components);
- }
- public function setTranslation($from, $to)
- {
- $this->translationMap[$from] = $to;
- }
- public function translate($uri)
- {
- foreach ($this->translationMap as $from => $to) {
- $uri = preg_replace($from, $to, $uri);
- }
- $uri = preg_replace('|^package://|', sprintf('file://%s/', realpath(__DIR__ . '/../../..')), $uri);
- return $uri;
- }
- }
- <?php
- namespace JsonSchema;
- interface UriResolverInterface
- {
- public function resolve($uri, $baseUri = null);
- }
- <?php
- namespace JsonSchema;
- interface UriRetrieverInterface
- {
- public function retrieve($uri, $baseUri = null);
- }
- <?php
- namespace JsonSchema;
- use JsonSchema\Constraints\BaseConstraint;
- use JsonSchema\Constraints\Constraint;
- class Validator extends BaseConstraint
- {
- const SCHEMA_MEDIA_TYPE = 'application/schema+json';
- const ERROR_NONE = 0x00000000;
- const ERROR_ALL = 0xFFFFFFFF;
- const ERROR_DOCUMENT_VALIDATION = 0x00000001;
- const ERROR_SCHEMA_VALIDATION = 0x00000002;
- public function validate(&$value, $schema = null, $checkMode = null)
- {
- if (is_array($schema)) {
- $schema = self::arrayToObjectRecursive($schema);
- }
- $initialCheckMode = $this->factory->getConfig();
- if ($checkMode !== null) {
- $this->factory->setConfig($checkMode);
- }
- if (is_object($schema) && property_exists($schema, 'id')) {
- $schemaURI = $schema->id;
- } else {
- $schemaURI = SchemaStorage::INTERNAL_PROVIDED_SCHEMA_URI;
- }
- $this->factory->getSchemaStorage()->addSchema($schemaURI, $schema);
- $validator = $this->factory->createInstanceFor('schema');
- $validator->check(
- $value,
- $this->factory->getSchemaStorage()->getSchema($schemaURI)
- );
- $this->factory->setConfig($initialCheckMode);
- $this->addErrors(array_unique($validator->getErrors(), SORT_REGULAR));
- return $validator->getErrorMask();
- }
- public function check($value, $schema)
- {
- return $this->validate($value, $schema);
- }
- public function coerce(&$value, $schema)
- {
- return $this->validate($value, $schema, Constraint::CHECK_MODE_COERCE_TYPES);
- }
- }
- The MIT License (MIT)
- Copyright (c) 2013-2016 container-interop
- Copyright (c) 2016 PHP Framework Interoperability Group
- Permission is hereby granted, free of charge, to any person obtaining a copy of
- this software and associated documentation files (the "Software"), to deal in
- the Software without restriction, including without limitation the rights to
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
- the Software, and to permit persons to whom the Software is furnished to do so,
- subject to the following conditions:
- The above copyright notice and this permission notice shall be included in all
- copies or substantial portions of the Software.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
- FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
- COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- <?php
- namespace Psr\Container;
- interface ContainerExceptionInterface
- {
- }
- <?php
- declare(strict_types=1);
- namespace Psr\Container;
- interface ContainerInterface
- {
- public function get(string $id);
- public function has(string $id);
- }
- <?php
- namespace Psr\Container;
- interface NotFoundExceptionInterface extends ContainerExceptionInterface
- {
- }
- Copyright (c) 2012 PHP Framework Interoperability Group
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
- The above copyright notice and this permission notice shall be included in
- all copies or substantial portions of the Software.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
- <?php
- namespace Psr\Log;
- abstract class AbstractLogger implements LoggerInterface
- {
- public function emergency($message, array $context = array())
- {
- $this->log(LogLevel::EMERGENCY, $message, $context);
- }
- public function alert($message, array $context = array())
- {
- $this->log(LogLevel::ALERT, $message, $context);
- }
- public function critical($message, array $context = array())
- {
- $this->log(LogLevel::CRITICAL, $message, $context);
- }
- public function error($message, array $context = array())
- {
- $this->log(LogLevel::ERROR, $message, $context);
- }
- public function warning($message, array $context = array())
- {
- $this->log(LogLevel::WARNING, $message, $context);
- }
- public function notice($message, array $context = array())
- {
- $this->log(LogLevel::NOTICE, $message, $context);
- }
- public function info($message, array $context = array())
- {
- $this->log(LogLevel::INFO, $message, $context);
- }
- public function debug($message, array $context = array())
- {
- $this->log(LogLevel::DEBUG, $message, $context);
- }
- }
- <?php
- namespace Psr\Log;
- class InvalidArgumentException extends \InvalidArgumentException
- {
- }
- <?php
- namespace Psr\Log;
- class LogLevel
- {
- const EMERGENCY = 'emergency';
- const ALERT = 'alert';
- const CRITICAL = 'critical';
- const ERROR = 'error';
- const WARNING = 'warning';
- const NOTICE = 'notice';
- const INFO = 'info';
- const DEBUG = 'debug';
- }
- <?php
- namespace Psr\Log;
- interface LoggerAwareInterface
- {
- public function setLogger(LoggerInterface $logger);
- }
- <?php
- namespace Psr\Log;
- trait LoggerAwareTrait
- {
- protected $logger;
- public function setLogger(LoggerInterface $logger)
- {
- $this->logger = $logger;
- }
- }
- <?php
- namespace Psr\Log;
- interface LoggerInterface
- {
- public function emergency($message, array $context = array());
- public function alert($message, array $context = array());
- public function critical($message, array $context = array());
- public function error($message, array $context = array());
- public function warning($message, array $context = array());
- public function notice($message, array $context = array());
- public function info($message, array $context = array());
- public function debug($message, array $context = array());
- public function log($level, $message, array $context = array());
- }
- <?php
- namespace Psr\Log;
- trait LoggerTrait
- {
- public function emergency($message, array $context = array())
- {
- $this->log(LogLevel::EMERGENCY, $message, $context);
- }
- public function alert($message, array $context = array())
- {
- $this->log(LogLevel::ALERT, $message, $context);
- }
- public function critical($message, array $context = array())
- {
- $this->log(LogLevel::CRITICAL, $message, $context);
- }
- public function error($message, array $context = array())
- {
- $this->log(LogLevel::ERROR, $message, $context);
- }
- public function warning($message, array $context = array())
- {
- $this->log(LogLevel::WARNING, $message, $context);
- }
- public function notice($message, array $context = array())
- {
- $this->log(LogLevel::NOTICE, $message, $context);
- }
- public function info($message, array $context = array())
- {
- $this->log(LogLevel::INFO, $message, $context);
- }
- public function debug($message, array $context = array())
- {
- $this->log(LogLevel::DEBUG, $message, $context);
- }
- abstract public function log($level, $message, array $context = array());
- }
- <?php
- namespace Psr\Log;
- class NullLogger extends AbstractLogger
- {
- public function log($level, $message, array $context = array())
- {
- }
- }
- <?php
- namespace Psr\Log\Test;
- class DummyTest
- {
- public function __toString()
- {
- return 'DummyTest';
- }
- }
- <?php
- namespace Psr\Log\Test;
- use Psr\Log\LoggerInterface;
- use Psr\Log\LogLevel;
- use PHPUnit\Framework\TestCase;
- abstract class LoggerInterfaceTest extends TestCase
- {
- abstract public function getLogger();
- abstract public function getLogs();
- public function testImplements()
- {
- $this->assertInstanceOf('Psr\Log\LoggerInterface', $this->getLogger());
- }
- public function testLogsAtAllLevels($level, $message)
- {
- $logger = $this->getLogger();
- $logger->{$level}($message, array('user' => 'Bob'));
- $logger->log($level, $message, array('user' => 'Bob'));
- $expected = array(
- $level.' message of level '.$level.' with context: Bob',
- $level.' message of level '.$level.' with context: Bob',
- );
- $this->assertEquals($expected, $this->getLogs());
- }
- public function provideLevelsAndMessages()
- {
- return array(
- LogLevel::EMERGENCY => array(LogLevel::EMERGENCY, 'message of level emergency with context: {user}'),
- LogLevel::ALERT => array(LogLevel::ALERT, 'message of level alert with context: {user}'),
- LogLevel::CRITICAL => array(LogLevel::CRITICAL, 'message of level critical with context: {user}'),
- LogLevel::ERROR => array(LogLevel::ERROR, 'message of level error with context: {user}'),
- LogLevel::WARNING => array(LogLevel::WARNING, 'message of level warning with context: {user}'),
- LogLevel::NOTICE => array(LogLevel::NOTICE, 'message of level notice with context: {user}'),
- LogLevel::INFO => array(LogLevel::INFO, 'message of level info with context: {user}'),
- LogLevel::DEBUG => array(LogLevel::DEBUG, 'message of level debug with context: {user}'),
- );
- }
- public function testThrowsOnInvalidLevel()
- {
- $logger = $this->getLogger();
- $logger->log('invalid level', 'Foo');
- }
- public function testContextReplacement()
- {
- $logger = $this->getLogger();
- $logger->info('{Message {nothing} {user} {foo.bar} a}', array('user' => 'Bob', 'foo.bar' => 'Bar'));
- $expected = array('info {Message {nothing} Bob Bar a}');
- $this->assertEquals($expected, $this->getLogs());
- }
- public function testObjectCastToString()
- {
- if (method_exists($this, 'createPartialMock')) {
- $dummy = $this->createPartialMock('Psr\Log\Test\DummyTest', array('__toString'));
- } else {
- $dummy = $this->getMock('Psr\Log\Test\DummyTest', array('__toString'));
- }
- $dummy->expects($this->once())
- ->method('__toString')
- ->will($this->returnValue('DUMMY'));
- $this->getLogger()->warning($dummy);
- $expected = array('warning DUMMY');
- $this->assertEquals($expected, $this->getLogs());
- }
- public function testContextCanContainAnything()
- {
- $closed = fopen('php://memory', 'r');
- fclose($closed);
- $context = array(
- 'bool' => true,
- 'null' => null,
- 'string' => 'Foo',
- 'int' => 0,
- 'float' => 0.5,
- 'nested' => array('with object' => new DummyTest),
- 'object' => new \DateTime,
- 'resource' => fopen('php://memory', 'r'),
- 'closed' => $closed,
- );
- $this->getLogger()->warning('Crazy context data', $context);
- $expected = array('warning Crazy context data');
- $this->assertEquals($expected, $this->getLogs());
- }
- public function testContextExceptionKeyCanBeExceptionOrOtherValues()
- {
- $logger = $this->getLogger();
- $logger->warning('Random message', array('exception' => 'oops'));
- $logger->critical('Uncaught Exception!', array('exception' => new \LogicException('Fail')));
- $expected = array(
- 'warning Random message',
- 'critical Uncaught Exception!'
- );
- $this->assertEquals($expected, $this->getLogs());
- }
- }
- <?php
- namespace Psr\Log\Test;
- use Psr\Log\AbstractLogger;
- class TestLogger extends AbstractLogger
- {
- public $records = [];
- public $recordsByLevel = [];
- public function log($level, $message, array $context = [])
- {
- $record = [
- 'level' => $level,
- 'message' => $message,
- 'context' => $context,
- ];
- $this->recordsByLevel[$record['level']][] = $record;
- $this->records[] = $record;
- }
- public function hasRecords($level)
- {
- return isset($this->recordsByLevel[$level]);
- }
- public function hasRecord($record, $level)
- {
- if (is_string($record)) {
- $record = ['message' => $record];
- }
- return $this->hasRecordThatPasses(function ($rec) use ($record) {
- if ($rec['message'] !== $record['message']) {
- return false;
- }
- if (isset($record['context']) && $rec['context'] !== $record['context']) {
- return false;
- }
- return true;
- }, $level);
- }
- public function hasRecordThatContains($message, $level)
- {
- return $this->hasRecordThatPasses(function ($rec) use ($message) {
- return strpos($rec['message'], $message) !== false;
- }, $level);
- }
- public function hasRecordThatMatches($regex, $level)
- {
- return $this->hasRecordThatPasses(function ($rec) use ($regex) {
- return preg_match($regex, $rec['message']) > 0;
- }, $level);
- }
- public function hasRecordThatPasses(callable $predicate, $level)
- {
- if (!isset($this->recordsByLevel[$level])) {
- return false;
- }
- foreach ($this->recordsByLevel[$level] as $i => $rec) {
- if (call_user_func($predicate, $rec, $i)) {
- return true;
- }
- }
- return false;
- }
- public function __call($method, $args)
- {
- if (preg_match('/(.*)(Debug|Info|Notice|Warning|Error|Critical|Alert|Emergency)(.*)/', $method, $matches) > 0) {
- $genericMethod = $matches[1] . ('Records' !== $matches[3] ? 'Record' : '') . $matches[3];
- $level = strtolower($matches[2]);
- if (method_exists($this, $genericMethod)) {
- $args[] = $level;
- return call_user_func_array([$this, $genericMethod], $args);
- }
- }
- throw new \BadMethodCallException('Call to undefined method ' . get_class($this) . '::' . $method . '()');
- }
- public function reset()
- {
- $this->records = [];
- $this->recordsByLevel = [];
- }
- }
- The MIT License (MIT)
- Copyright (c) 2012 Jan Sorgalla, Christian Lück, Cees-Jan Kiewiet, Chris Boden
- Permission is hereby granted, free of charge, to any person
- obtaining a copy of this software and associated documentation
- files (the "Software"), to deal in the Software without
- restriction, including without limitation the rights to use,
- copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the
- Software is furnished to do so, subject to the following
- conditions:
- The above copyright notice and this permission notice shall be
- included in all copies or substantial portions of the Software.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- OTHER DEALINGS IN THE SOFTWARE.
- <?php
- namespace React\Promise;
- interface CancellablePromiseInterface extends PromiseInterface
- {
- public function cancel();
- }
- <?php
- namespace React\Promise;
- class CancellationQueue
- {
- private $started = false;
- private $queue = [];
- public function __invoke()
- {
- if ($this->started) {
- return;
- }
- $this->started = true;
- $this->drain();
- }
- public function enqueue($cancellable)
- {
- if (!\is_object($cancellable) || !\method_exists($cancellable, 'then') || !\method_exists($cancellable, 'cancel')) {
- return;
- }
- $length = \array_push($this->queue, $cancellable);
- if ($this->started && 1 === $length) {
- $this->drain();
- }
- }
- private function drain()
- {
- for ($i = key($this->queue); isset($this->queue[$i]); $i++) {
- $cancellable = $this->queue[$i];
- $exception = null;
- try {
- $cancellable->cancel();
- } catch (\Throwable $exception) {
- } catch (\Exception $exception) {
- }
- unset($this->queue[$i]);
- if ($exception) {
- throw $exception;
- }
- }
- $this->queue = [];
- }
- }
- <?php
- namespace React\Promise;
- class Deferred implements PromisorInterface
- {
- private $promise;
- private $resolveCallback;
- private $rejectCallback;
- private $notifyCallback;
- private $canceller;
- public function __construct(callable $canceller = null)
- {
- $this->canceller = $canceller;
- }
- public function promise()
- {
- if (null === $this->promise) {
- $this->promise = new Promise(function ($resolve, $reject, $notify) {
- $this->resolveCallback = $resolve;
- $this->rejectCallback = $reject;
- $this->notifyCallback = $notify;
- }, $this->canceller);
- $this->canceller = null;
- }
- return $this->promise;
- }
- public function resolve($value = null)
- {
- $this->promise();
- \call_user_func($this->resolveCallback, $value);
- }
- public function reject($reason = null)
- {
- $this->promise();
- \call_user_func($this->rejectCallback, $reason);
- }
- public function notify($update = null)
- {
- $this->promise();
- \call_user_func($this->notifyCallback, $update);
- }
- public function progress($update = null)
- {
- $this->notify($update);
- }
- }
- <?php
- namespace React\Promise\Exception;
- class LengthException extends \LengthException
- {
- }
- <?php
- namespace React\Promise;
- interface ExtendedPromiseInterface extends PromiseInterface
- {
- public function done(callable $onFulfilled = null, callable $onRejected = null, callable $onProgress = null);
- public function otherwise(callable $onRejected);
- public function always(callable $onFulfilledOrRejected);
- public function progress(callable $onProgress);
- }
- <?php
- namespace React\Promise;
- class FulfilledPromise implements ExtendedPromiseInterface, CancellablePromiseInterface
- {
- private $value;
- public function __construct($value = null)
- {
- if ($value instanceof PromiseInterface) {
- throw new \InvalidArgumentException('You cannot create React\Promise\FulfilledPromise with a promise. Use React\Promise\resolve($promiseOrValue) instead.');
- }
- $this->value = $value;
- }
- public function then(callable $onFulfilled = null, callable $onRejected = null, callable $onProgress = null)
- {
- if (null === $onFulfilled) {
- return $this;
- }
- try {
- return resolve($onFulfilled($this->value));
- } catch (\Throwable $exception) {
- return new RejectedPromise($exception);
- } catch (\Exception $exception) {
- return new RejectedPromise($exception);
- }
- }
- public function done(callable $onFulfilled = null, callable $onRejected = null, callable $onProgress = null)
- {
- if (null === $onFulfilled) {
- return;
- }
- $result = $onFulfilled($this->value);
- if ($result instanceof ExtendedPromiseInterface) {
- $result->done();
- }
- }
- public function otherwise(callable $onRejected)
- {
- return $this;
- }
- public function always(callable $onFulfilledOrRejected)
- {
- return $this->then(function ($value) use ($onFulfilledOrRejected) {
- return resolve($onFulfilledOrRejected())->then(function () use ($value) {
- return $value;
- });
- });
- }
- public function progress(callable $onProgress)
- {
- return $this;
- }
- public function cancel()
- {
- }
- }
- <?php
- namespace React\Promise;
- class LazyPromise implements ExtendedPromiseInterface, CancellablePromiseInterface
- {
- private $factory;
- private $promise;
- public function __construct(callable $factory)
- {
- $this->factory = $factory;
- }
- public function then(callable $onFulfilled = null, callable $onRejected = null, callable $onProgress = null)
- {
- return $this->promise()->then($onFulfilled, $onRejected, $onProgress);
- }
- public function done(callable $onFulfilled = null, callable $onRejected = null, callable $onProgress = null)
- {
- return $this->promise()->done($onFulfilled, $onRejected, $onProgress);
- }
- public function otherwise(callable $onRejected)
- {
- return $this->promise()->otherwise($onRejected);
- }
- public function always(callable $onFulfilledOrRejected)
- {
- return $this->promise()->always($onFulfilledOrRejected);
- }
- public function progress(callable $onProgress)
- {
- return $this->promise()->progress($onProgress);
- }
- public function cancel()
- {
- return $this->promise()->cancel();
- }
- public function promise()
- {
- if (null === $this->promise) {
- try {
- $this->promise = resolve(\call_user_func($this->factory));
- } catch (\Throwable $exception) {
- $this->promise = new RejectedPromise($exception);
- } catch (\Exception $exception) {
- $this->promise = new RejectedPromise($exception);
- }
- }
- return $this->promise;
- }
- }
- <?php
- namespace React\Promise;
- class Promise implements ExtendedPromiseInterface, CancellablePromiseInterface
- {
- private $canceller;
- private $result;
- private $handlers = [];
- private $progressHandlers = [];
- private $requiredCancelRequests = 0;
- private $cancelRequests = 0;
- public function __construct(callable $resolver, callable $canceller = null)
- {
- $this->canceller = $canceller;
- $cb = $resolver;
- $resolver = $canceller = null;
- $this->call($cb);
- }
- public function then(callable $onFulfilled = null, callable $onRejected = null, callable $onProgress = null)
- {
- if (null !== $this->result) {
- return $this->result->then($onFulfilled, $onRejected, $onProgress);
- }
- if (null === $this->canceller) {
- return new static($this->resolver($onFulfilled, $onRejected, $onProgress));
- }
- $parent = $this;
- ++$parent->requiredCancelRequests;
- return new static(
- $this->resolver($onFulfilled, $onRejected, $onProgress),
- static function () use (&$parent) {
- if (++$parent->cancelRequests >= $parent->requiredCancelRequests) {
- $parent->cancel();
- }
- $parent = null;
- }
- );
- }
- public function done(callable $onFulfilled = null, callable $onRejected = null, callable $onProgress = null)
- {
- if (null !== $this->result) {
- return $this->result->done($onFulfilled, $onRejected, $onProgress);
- }
- $this->handlers[] = static function (ExtendedPromiseInterface $promise) use ($onFulfilled, $onRejected) {
- $promise
- ->done($onFulfilled, $onRejected);
- };
- if ($onProgress) {
- $this->progressHandlers[] = $onProgress;
- }
- }
- public function otherwise(callable $onRejected)
- {
- return $this->then(null, static function ($reason) use ($onRejected) {
- if (!_checkTypehint($onRejected, $reason)) {
- return new RejectedPromise($reason);
- }
- return $onRejected($reason);
- });
- }
- public function always(callable $onFulfilledOrRejected)
- {
- return $this->then(static function ($value) use ($onFulfilledOrRejected) {
- return resolve($onFulfilledOrRejected())->then(function () use ($value) {
- return $value;
- });
- }, static function ($reason) use ($onFulfilledOrRejected) {
- return resolve($onFulfilledOrRejected())->then(function () use ($reason) {
- return new RejectedPromise($reason);
- });
- });
- }
- public function progress(callable $onProgress)
- {
- return $this->then(null, null, $onProgress);
- }
- public function cancel()
- {
- if (null === $this->canceller || null !== $this->result) {
- return;
- }
- $canceller = $this->canceller;
- $this->canceller = null;
- $this->call($canceller);
- }
- private function resolver(callable $onFulfilled = null, callable $onRejected = null, callable $onProgress = null)
- {
- return function ($resolve, $reject, $notify) use ($onFulfilled, $onRejected, $onProgress) {
- if ($onProgress) {
- $progressHandler = static function ($update) use ($notify, $onProgress) {
- try {
- $notify($onProgress($update));
- } catch (\Throwable $e) {
- $notify($e);
- } catch (\Exception $e) {
- $notify($e);
- }
- };
- } else {
- $progressHandler = $notify;
- }
- $this->handlers[] = static function (ExtendedPromiseInterface $promise) use ($onFulfilled, $onRejected, $resolve, $reject, $progressHandler) {
- $promise
- ->then($onFulfilled, $onRejected)
- ->done($resolve, $reject, $progressHandler);
- };
- $this->progressHandlers[] = $progressHandler;
- };
- }
- private function reject($reason = null)
- {
- if (null !== $this->result) {
- return;
- }
- $this->settle(reject($reason));
- }
- private function settle(ExtendedPromiseInterface $promise)
- {
- $promise = $this->unwrap($promise);
- if ($promise === $this) {
- $promise = new RejectedPromise(
- new \LogicException('Cannot resolve a promise with itself.')
- );
- }
- $handlers = $this->handlers;
- $this->progressHandlers = $this->handlers = [];
- $this->result = $promise;
- $this->canceller = null;
- foreach ($handlers as $handler) {
- $handler($promise);
- }
- }
- private function unwrap($promise)
- {
- $promise = $this->extract($promise);
- while ($promise instanceof self && null !== $promise->result) {
- $promise = $this->extract($promise->result);
- }
- return $promise;
- }
- private function extract($promise)
- {
- if ($promise instanceof LazyPromise) {
- $promise = $promise->promise();
- }
- return $promise;
- }
- private function call(callable $cb)
- {
- $callback = $cb;
- $cb = null;
- if (\is_array($callback)) {
- $ref = new \ReflectionMethod($callback[0], $callback[1]);
- } elseif (\is_object($callback) && !$callback instanceof \Closure) {
- $ref = new \ReflectionMethod($callback, '__invoke');
- } else {
- $ref = new \ReflectionFunction($callback);
- }
- $args = $ref->getNumberOfParameters();
- try {
- if ($args === 0) {
- $callback();
- } else {
- $target =& $this;
- $progressHandlers =& $this->progressHandlers;
- $callback(
- static function ($value = null) use (&$target) {
- if ($target !== null) {
- $target->settle(resolve($value));
- $target = null;
- }
- },
- static function ($reason = null) use (&$target) {
- if ($target !== null) {
- $target->reject($reason);
- $target = null;
- }
- },
- static function ($update = null) use (&$progressHandlers) {
- foreach ($progressHandlers as $handler) {
- $handler($update);
- }
- }
- );
- }
- } catch (\Throwable $e) {
- $target = null;
- $this->reject($e);
- } catch (\Exception $e) {
- $target = null;
- $this->reject($e);
- }
- }
- }
- <?php
- namespace React\Promise;
- interface PromiseInterface
- {
- public function then(callable $onFulfilled = null, callable $onRejected = null, callable $onProgress = null);
- }
- <?php
- namespace React\Promise;
- interface PromisorInterface
- {
- public function promise();
- }
- <?php
- namespace React\Promise;
- class RejectedPromise implements ExtendedPromiseInterface, CancellablePromiseInterface
- {
- private $reason;
- public function __construct($reason = null)
- {
- if ($reason instanceof PromiseInterface) {
- throw new \InvalidArgumentException('You cannot create React\Promise\RejectedPromise with a promise. Use React\Promise\reject($promiseOrValue) instead.');
- }
- $this->reason = $reason;
- }
- public function then(callable $onFulfilled = null, callable $onRejected = null, callable $onProgress = null)
- {
- if (null === $onRejected) {
- return $this;
- }
- try {
- return resolve($onRejected($this->reason));
- } catch (\Throwable $exception) {
- return new RejectedPromise($exception);
- } catch (\Exception $exception) {
- return new RejectedPromise($exception);
- }
- }
- public function done(callable $onFulfilled = null, callable $onRejected = null, callable $onProgress = null)
- {
- if (null === $onRejected) {
- throw UnhandledRejectionException::resolve($this->reason);
- }
- $result = $onRejected($this->reason);
- if ($result instanceof self) {
- throw UnhandledRejectionException::resolve($result->reason);
- }
- if ($result instanceof ExtendedPromiseInterface) {
- $result->done();
- }
- }
- public function otherwise(callable $onRejected)
- {
- if (!_checkTypehint($onRejected, $this->reason)) {
- return $this;
- }
- return $this->then(null, $onRejected);
- }
- public function always(callable $onFulfilledOrRejected)
- {
- return $this->then(null, function ($reason) use ($onFulfilledOrRejected) {
- return resolve($onFulfilledOrRejected())->then(function () use ($reason) {
- return new RejectedPromise($reason);
- });
- });
- }
- public function progress(callable $onProgress)
- {
- return $this;
- }
- public function cancel()
- {
- }
- }
- <?php
- namespace React\Promise;
- class UnhandledRejectionException extends \RuntimeException
- {
- private $reason;
- public static function resolve($reason)
- {
- if ($reason instanceof \Exception || $reason instanceof \Throwable) {
- return $reason;
- }
- return new static($reason);
- }
- public function __construct($reason)
- {
- $this->reason = $reason;
- $message = \sprintf('Unhandled Rejection: %s', \json_encode($reason));
- parent::__construct($message, 0);
- }
- public function getReason()
- {
- return $this->reason;
- }
- }
- <?php
- namespace React\Promise;
- function resolve($promiseOrValue = null)
- {
- if ($promiseOrValue instanceof ExtendedPromiseInterface) {
- return $promiseOrValue;
- }
- if (\is_object($promiseOrValue) && \method_exists($promiseOrValue, 'then')) {
- $canceller = null;
- if (\method_exists($promiseOrValue, 'cancel')) {
- $canceller = [$promiseOrValue, 'cancel'];
- }
- return new Promise(function ($resolve, $reject, $notify) use ($promiseOrValue) {
- $promiseOrValue->then($resolve, $reject, $notify);
- }, $canceller);
- }
- return new FulfilledPromise($promiseOrValue);
- }
- function reject($promiseOrValue = null)
- {
- if ($promiseOrValue instanceof PromiseInterface) {
- return resolve($promiseOrValue)->then(function ($value) {
- return new RejectedPromise($value);
- });
- }
- return new RejectedPromise($promiseOrValue);
- }
- function all($promisesOrValues)
- {
- return map($promisesOrValues, function ($val) {
- return $val;
- });
- }
- function race($promisesOrValues)
- {
- $cancellationQueue = new CancellationQueue();
- $cancellationQueue->enqueue($promisesOrValues);
- return new Promise(function ($resolve, $reject, $notify) use ($promisesOrValues, $cancellationQueue) {
- resolve($promisesOrValues)
- ->done(function ($array) use ($cancellationQueue, $resolve, $reject, $notify) {
- if (!is_array($array) || !$array) {
- $resolve();
- return;
- }
- foreach ($array as $promiseOrValue) {
- $cancellationQueue->enqueue($promiseOrValue);
- resolve($promiseOrValue)
- ->done($resolve, $reject, $notify);
- }
- }, $reject, $notify);
- }, $cancellationQueue);
- }
- function any($promisesOrValues)
- {
- return some($promisesOrValues, 1)
- ->then(function ($val) {
- return \array_shift($val);
- });
- }
- function some($promisesOrValues, $howMany)
- {
- $cancellationQueue = new CancellationQueue();
- $cancellationQueue->enqueue($promisesOrValues);
- return new Promise(function ($resolve, $reject, $notify) use ($promisesOrValues, $howMany, $cancellationQueue) {
- resolve($promisesOrValues)
- ->done(function ($array) use ($howMany, $cancellationQueue, $resolve, $reject, $notify) {
- if (!\is_array($array) || $howMany < 1) {
- $resolve([]);
- return;
- }
- $len = \count($array);
- if ($len < $howMany) {
- throw new Exception\LengthException(
- \sprintf(
- 'Input array must contain at least %d item%s but contains only %s item%s.',
- $howMany,
- 1 === $howMany ? '' : 's',
- $len,
- 1 === $len ? '' : 's'
- )
- );
- }
- $toResolve = $howMany;
- $toReject = ($len - $toResolve) + 1;
- $values = [];
- $reasons = [];
- foreach ($array as $i => $promiseOrValue) {
- $fulfiller = function ($val) use ($i, &$values, &$toResolve, $toReject, $resolve) {
- if ($toResolve < 1 || $toReject < 1) {
- return;
- }
- $values[$i] = $val;
- if (0 === --$toResolve) {
- $resolve($values);
- }
- };
- $rejecter = function ($reason) use ($i, &$reasons, &$toReject, $toResolve, $reject) {
- if ($toResolve < 1 || $toReject < 1) {
- return;
- }
- $reasons[$i] = $reason;
- if (0 === --$toReject) {
- $reject($reasons);
- }
- };
- $cancellationQueue->enqueue($promiseOrValue);
- resolve($promiseOrValue)
- ->done($fulfiller, $rejecter, $notify);
- }
- }, $reject, $notify);
- }, $cancellationQueue);
- }
- function map($promisesOrValues, callable $mapFunc)
- {
- $cancellationQueue = new CancellationQueue();
- $cancellationQueue->enqueue($promisesOrValues);
- return new Promise(function ($resolve, $reject, $notify) use ($promisesOrValues, $mapFunc, $cancellationQueue) {
- resolve($promisesOrValues)
- ->done(function ($array) use ($mapFunc, $cancellationQueue, $resolve, $reject, $notify) {
- if (!\is_array($array) || !$array) {
- $resolve([]);
- return;
- }
- $toResolve = \count($array);
- $values = [];
- foreach ($array as $i => $promiseOrValue) {
- $cancellationQueue->enqueue($promiseOrValue);
- $values[$i] = null;
- resolve($promiseOrValue)
- ->then($mapFunc)
- ->done(
- function ($mapped) use ($i, &$values, &$toResolve, $resolve) {
- $values[$i] = $mapped;
- if (0 === --$toResolve) {
- $resolve($values);
- }
- },
- $reject,
- $notify
- );
- }
- }, $reject, $notify);
- }, $cancellationQueue);
- }
- function reduce($promisesOrValues, callable $reduceFunc, $initialValue = null)
- {
- $cancellationQueue = new CancellationQueue();
- $cancellationQueue->enqueue($promisesOrValues);
- return new Promise(function ($resolve, $reject, $notify) use ($promisesOrValues, $reduceFunc, $initialValue, $cancellationQueue) {
- resolve($promisesOrValues)
- ->done(function ($array) use ($reduceFunc, $initialValue, $cancellationQueue, $resolve, $reject, $notify) {
- if (!\is_array($array)) {
- $array = [];
- }
- $total = \count($array);
- $i = 0;
- $wrappedReduceFunc = function ($current, $val) use ($reduceFunc, $cancellationQueue, $total, &$i) {
- $cancellationQueue->enqueue($val);
- return $current
- ->then(function ($c) use ($reduceFunc, $total, &$i, $val) {
- return resolve($val)
- ->then(function ($value) use ($reduceFunc, $total, &$i, $c) {
- return $reduceFunc($c, $value, $i++, $total);
- });
- });
- };
- $cancellationQueue->enqueue($initialValue);
- \array_reduce($array, $wrappedReduceFunc, resolve($initialValue))
- ->done($resolve, $reject, $notify);
- }, $reject, $notify);
- }, $cancellationQueue);
- }
- function _checkTypehint(callable $callback, $object)
- {
- if (!\is_object($object)) {
- return true;
- }
- if (\is_array($callback)) {
- $callbackReflection = new \ReflectionMethod($callback[0], $callback[1]);
- } elseif (\is_object($callback) && !$callback instanceof \Closure) {
- $callbackReflection = new \ReflectionMethod($callback, '__invoke');
- } else {
- $callbackReflection = new \ReflectionFunction($callback);
- }
- $parameters = $callbackReflection->getParameters();
- if (!isset($parameters[0])) {
- return true;
- }
- $expectedException = $parameters[0];
- if (\PHP_VERSION_ID < 70100 || \defined('HHVM_VERSION')) {
- if (!$expectedException->getClass()) {
- return true;
- }
- return $expectedException->getClass()->isInstance($object);
- }
- $type = $expectedException->getType();
- $isTypeUnion = true;
- $types = [];
- switch (true) {
- case $type === null:
- break;
- case $type instanceof \ReflectionNamedType:
- $types = [$type];
- break;
- case $type instanceof \ReflectionIntersectionType:
- $isTypeUnion = false;
- case $type instanceof \ReflectionUnionType;
- $types = $type->getTypes();
- break;
- default:
- throw new \LogicException('Unexpected return value of ReflectionParameter::getType');
- }
- if (empty($types)) {
- return true;
- }
- foreach ($types as $type) {
- if (!$type instanceof \ReflectionNamedType) {
- throw new \LogicException('This implementation does not support groups of intersection or union types');
- }
- $matches = ($type->isBuiltin() && \gettype($object) === $type->getName())
- || (new \ReflectionClass($type->getName()))->isInstance($object);
- if ($matches) {
- if ($isTypeUnion) {
- return true;
- }
- } else {
- if (!$isTypeUnion) {
- return false;
- }
- }
- }
- return $isTypeUnion ? false : true;
- }
- <?php
- if (!\function_exists('React\Promise\resolve')) {
- require __DIR__.'/functions.php';
- }
- Copyright (c) 2011 Jordi Boggiano
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is furnished
- to do so, subject to the following conditions:
- The above copyright notice and this permission notice shall be included in all
- copies or substantial portions of the Software.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
- <?php
- namespace Seld\JsonLint;
- class DuplicateKeyException extends ParsingException
- {
- protected $details;
- public function __construct($message, $key, array $details)
- {
- $details['key'] = $key;
- parent::__construct($message, $details);
- }
- public function getKey()
- {
- return $this->details['key'];
- }
- public function getDetails()
- {
- return $this->details;
- }
- }
- <?php
- namespace Seld\JsonLint;
- use stdClass;
- class JsonParser
- {
- const DETECT_KEY_CONFLICTS = 1;
- const ALLOW_DUPLICATE_KEYS = 2;
- const PARSE_TO_ASSOC = 4;
- private $lexer;
- private $flags;
- private $stack;
- private $vstack;
- private $lstack;
- private $symbols = array(
- 'error' => 2,
- 'JSONString' => 3,
- 'STRING' => 4,
- 'JSONNumber' => 5,
- 'NUMBER' => 6,
- 'JSONNullLiteral' => 7,
- 'NULL' => 8,
- 'JSONBooleanLiteral' => 9,
- 'TRUE' => 10,
- 'FALSE' => 11,
- 'JSONText' => 12,
- 'JSONValue' => 13,
- 'EOF' => 14,
- 'JSONObject' => 15,
- 'JSONArray' => 16,
- '{' => 17,
- '}' => 18,
- 'JSONMemberList' => 19,
- 'JSONMember' => 20,
- ':' => 21,
- ',' => 22,
- '[' => 23,
- ']' => 24,
- 'JSONElementList' => 25,
- '$accept' => 0,
- '$end' => 1,
- );
- private $terminals_ = array(
- 2 => "error",
- 4 => "STRING",
- 6 => "NUMBER",
- 8 => "NULL",
- 10 => "TRUE",
- 11 => "FALSE",
- 14 => "EOF",
- 17 => "{",
- 18 => "}",
- 21 => ":",
- 22 => ",",
- 23 => "[",
- 24 => "]",
- );
- private $productions_ = array(
- 1 => array(3, 1),
- 2 => array(5, 1),
- 3 => array(7, 1),
- 4 => array(9, 1),
- 5 => array(9, 1),
- 6 => array(12, 2),
- 7 => array(13, 1),
- 8 => array(13, 1),
- 9 => array(13, 1),
- 10 => array(13, 1),
- 11 => array(13, 1),
- 12 => array(13, 1),
- 13 => array(15, 2),
- 14 => array(15, 3),
- 15 => array(20, 3),
- 16 => array(19, 1),
- 17 => array(19, 3),
- 18 => array(16, 2),
- 19 => array(16, 3),
- 20 => array(25, 1),
- 21 => array(25, 3)
- );
- private $table = array(
- 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)),
- 1 => array( 1 => array(3)),
- 2 => array( 14 => array(1,16)),
- 3 => array( 14 => array(2,7), 18 => array(2,7), 22 => array(2,7), 24 => array(2,7)),
- 4 => array( 14 => array(2,8), 18 => array(2,8), 22 => array(2,8), 24 => array(2,8)),
- 5 => array( 14 => array(2,9), 18 => array(2,9), 22 => array(2,9), 24 => array(2,9)),
- 6 => array( 14 => array(2,10), 18 => array(2,10), 22 => array(2,10), 24 => array(2,10)),
- 7 => array( 14 => array(2,11), 18 => array(2,11), 22 => array(2,11), 24 => array(2,11)),
- 8 => array( 14 => array(2,12), 18 => array(2,12), 22 => array(2,12), 24 => array(2,12)),
- 9 => array( 14 => array(2,3), 18 => array(2,3), 22 => array(2,3), 24 => array(2,3)),
- 10 => array( 14 => array(2,4), 18 => array(2,4), 22 => array(2,4), 24 => array(2,4)),
- 11 => array( 14 => array(2,5), 18 => array(2,5), 22 => array(2,5), 24 => array(2,5)),
- 12 => array( 14 => array(2,1), 18 => array(2,1), 21 => array(2,1), 22 => array(2,1), 24 => array(2,1)),
- 13 => array( 14 => array(2,2), 18 => array(2,2), 22 => array(2,2), 24 => array(2,2)),
- 14 => array( 3 => 20, 4 => array(1,12), 18 => array(1,17), 19 => 18, 20 => 19 ),
- 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 ),
- 16 => array( 1 => array(2,6)),
- 17 => array( 14 => array(2,13), 18 => array(2,13), 22 => array(2,13), 24 => array(2,13)),
- 18 => array( 18 => array(1,24), 22 => array(1,25)),
- 19 => array( 18 => array(2,16), 22 => array(2,16)),
- 20 => array( 21 => array(1,26)),
- 21 => array( 14 => array(2,18), 18 => array(2,18), 22 => array(2,18), 24 => array(2,18)),
- 22 => array( 22 => array(1,28), 24 => array(1,27)),
- 23 => array( 22 => array(2,20), 24 => array(2,20)),
- 24 => array( 14 => array(2,14), 18 => array(2,14), 22 => array(2,14), 24 => array(2,14)),
- 25 => array( 3 => 20, 4 => array(1,12), 20 => 29 ),
- 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)),
- 27 => array( 14 => array(2,19), 18 => array(2,19), 22 => array(2,19), 24 => array(2,19)),
- 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)),
- 29 => array( 18 => array(2,17), 22 => array(2,17)),
- 30 => array( 18 => array(2,15), 22 => array(2,15)),
- 31 => array( 22 => array(2,21), 24 => array(2,21)),
- );
- private $defaultActions = array(
- 16 => array(2, 6)
- );
- public function lint($input, $flags = 0)
- {
- try {
- $this->parse($input, $flags);
- } catch (ParsingException $e) {
- return $e;
- }
- return null;
- }
- public function parse($input, $flags = 0)
- {
- $this->failOnBOM($input);
- $this->flags = $flags;
- $this->stack = array(0);
- $this->vstack = array(null);
- $this->lstack = array();
- $yytext = '';
- $yylineno = 0;
- $yyleng = 0;
- $recovering = 0;
- $this->lexer = new Lexer();
- $this->lexer->setInput($input);
- $yyloc = $this->lexer->yylloc;
- $this->lstack[] = $yyloc;
- $symbol = null;
- $preErrorSymbol = null;
- $action = null;
- $a = null;
- $r = null;
- $p = null;
- $len = null;
- $newState = null;
- $expected = null;
- $errStr = null;
- while (true) {
- $state = $this->stack[\count($this->stack)-1];
- if (isset($this->defaultActions[$state])) {
- $action = $this->defaultActions[$state];
- } else {
- if ($symbol === null) {
- $symbol = $this->lexer->lex();
- }
- $action = isset($this->table[$state][$symbol]) ? $this->table[$state][$symbol] : false;
- }
- if (!$action || !$action[0]) {
- assert(isset($symbol));
- if (!$recovering) {
- $expected = array();
- foreach ($this->table[$state] as $p => $ignore) {
- if (isset($this->terminals_[$p]) && $p > 2) {
- $expected[] = "'" . $this->terminals_[$p] . "'";
- }
- }
- $message = null;
- if (\in_array("'STRING'", $expected) && \in_array(substr($this->lexer->match, 0, 1), array('"', "'"))) {
- $message = "Invalid string";
- if ("'" === substr($this->lexer->match, 0, 1)) {
- $message .= ", it appears you used single quotes instead of double quotes";
- } elseif (preg_match('{".+?(\\\\[^"bfnrt/\\\\u](...)?)}', $this->lexer->getFullUpcomingInput(), $match)) {
- $message .= ", it appears you have an unescaped backslash at: ".$match[1];
- } elseif (preg_match('{"(?:[^"]+|\\\\")*$}m', $this->lexer->getFullUpcomingInput())) {
- $message .= ", it appears you forgot to terminate a string, or attempted to write a multiline string which is invalid";
- }
- }
- $errStr = 'Parse error on line ' . ($yylineno+1) . ":\n";
- $errStr .= $this->lexer->showPosition() . "\n";
- if ($message) {
- $errStr .= $message;
- } else {
- $errStr .= (\count($expected) > 1) ? "Expected one of: " : "Expected: ";
- $errStr .= implode(', ', $expected);
- }
- if (',' === substr(trim($this->lexer->getPastInput()), -1)) {
- $errStr .= " - It appears you have an extra trailing comma";
- }
- $this->parseError($errStr, array(
- 'text' => $this->lexer->match,
- 'token' => isset($this->terminals_[$symbol]) ? $this->terminals_[$symbol] : $symbol,
- 'line' => $this->lexer->yylineno,
- 'loc' => $yyloc,
- 'expected' => $expected,
- ));
- }
- if ($recovering == 3) {
- if ($symbol === Lexer::EOF) {
- throw new ParsingException($errStr ?: 'Parsing halted.');
- }
- $yyleng = $this->lexer->yyleng;
- $yytext = $this->lexer->yytext;
- $yylineno = $this->lexer->yylineno;
- $yyloc = $this->lexer->yylloc;
- $symbol = $this->lexer->lex();
- }
- while (true) {
- if (\array_key_exists(Lexer::T_ERROR, $this->table[$state])) {
- break;
- }
- if ($state == 0) {
- throw new ParsingException($errStr ?: 'Parsing halted.');
- }
- $this->popStack(1);
- $state = $this->stack[\count($this->stack)-1];
- }
- $preErrorSymbol = $symbol;
- $symbol = Lexer::T_ERROR;
- $state = $this->stack[\count($this->stack)-1];
- $action = isset($this->table[$state][Lexer::T_ERROR]) ? $this->table[$state][Lexer::T_ERROR] : false;
- if ($action === false) {
- throw new \LogicException('No table value found for '.$state.' => '.Lexer::T_ERROR);
- }
- $recovering = 3;
- }
- if (\is_array($action[0]) && \count($action) > 1) {
- throw new ParsingException('Parse Error: multiple actions possible at state: ' . $state . ', token: ' . $symbol);
- }
- switch ($action[0]) {
- case 1:
- assert(isset($symbol));
- $this->stack[] = $symbol;
- $this->vstack[] = $this->lexer->yytext;
- $this->lstack[] = $this->lexer->yylloc;
- $this->stack[] = $action[1];
- $symbol = null;
- if (!$preErrorSymbol) {
- $yyleng = $this->lexer->yyleng;
- $yytext = $this->lexer->yytext;
- $yylineno = $this->lexer->yylineno;
- $yyloc = $this->lexer->yylloc;
- if ($recovering > 0) {
- $recovering--;
- }
- } else {
- $symbol = $preErrorSymbol;
- $preErrorSymbol = null;
- }
- break;
- case 2:
- $len = $this->productions_[$action[1]][1];
- $currentToken = $this->vstack[\count($this->vstack) - $len];
- $position = array(
- 'first_line' => $this->lstack[\count($this->lstack) - ($len ?: 1)]['first_line'],
- 'last_line' => $this->lstack[\count($this->lstack) - 1]['last_line'],
- 'first_column' => $this->lstack[\count($this->lstack) - ($len ?: 1)]['first_column'],
- 'last_column' => $this->lstack[\count($this->lstack) - 1]['last_column'],
- );
- list($newToken, $actionResult) = $this->performAction($currentToken, $yytext, $yyleng, $yylineno, $action[1]);
- if (!$actionResult instanceof Undefined) {
- return $actionResult;
- }
- if ($len) {
- $this->popStack($len);
- }
- $this->stack[] = $this->productions_[$action[1]][0];
- $this->vstack[] = $newToken;
- $this->lstack[] = $position;
- $newState = $this->table[$this->stack[\count($this->stack)-2]][$this->stack[\count($this->stack)-1]];
- $this->stack[] = $newState;
- break;
- case 3:
- return true;
- }
- }
- }
- protected function parseError($str, $hash = null)
- {
- throw new ParsingException($str, $hash ?: array());
- }
- private function performAction($currentToken, $yytext, $yyleng, $yylineno, $yystate)
- {
- $token = $currentToken;
- $len = \count($this->vstack) - 1;
- switch ($yystate) {
- case 1:
- $yytext = preg_replace_callback('{(?:\\\\["bfnrt/\\\\]|\\\\u[a-fA-F0-9]{4})}', array($this, 'stringInterpolation'), $yytext);
- $token = $yytext;
- break;
- case 2:
- if (strpos($yytext, 'e') !== false || strpos($yytext, 'E') !== false) {
- $token = \floatval($yytext);
- } else {
- $token = strpos($yytext, '.') === false ? \intval($yytext) : \floatval($yytext);
- }
- break;
- case 3:
- $token = null;
- break;
- case 4:
- $token = true;
- break;
- case 5:
- $token = false;
- break;
- case 6:
- $token = $this->vstack[$len-1];
- return array($token, $token);
- case 13:
- if ($this->flags & self::PARSE_TO_ASSOC) {
- $token = array();
- } else {
- $token = new stdClass;
- }
- break;
- case 14:
- $token = $this->vstack[$len-1];
- break;
- case 15:
- $token = array($this->vstack[$len-2], $this->vstack[$len]);
- break;
- case 16:
- assert(\is_array($this->vstack[$len]));
- if (PHP_VERSION_ID < 70100) {
- $property = $this->vstack[$len][0] === '' ? '_empty_' : $this->vstack[$len][0];
- } else {
- $property = $this->vstack[$len][0];
- }
- if ($this->flags & self::PARSE_TO_ASSOC) {
- $token = array();
- $token[$property] = $this->vstack[$len][1];
- } else {
- $token = new stdClass;
- $token->$property = $this->vstack[$len][1];
- }
- break;
- case 17:
- assert(\is_array($this->vstack[$len]));
- if ($this->flags & self::PARSE_TO_ASSOC) {
- assert(\is_array($this->vstack[$len-2]));
- $token =& $this->vstack[$len-2];
- $key = $this->vstack[$len][0];
- if (($this->flags & self::DETECT_KEY_CONFLICTS) && isset($this->vstack[$len-2][$key])) {
- $errStr = 'Parse error on line ' . ($yylineno+1) . ":\n";
- $errStr .= $this->lexer->showPosition() . "\n";
- $errStr .= "Duplicate key: ".$this->vstack[$len][0];
- throw new DuplicateKeyException($errStr, $this->vstack[$len][0], array('line' => $yylineno+1));
- } elseif (($this->flags & self::ALLOW_DUPLICATE_KEYS) && isset($this->vstack[$len-2][$key])) {
- $duplicateCount = 1;
- do {
- $duplicateKey = $key . '.' . $duplicateCount++;
- } while (isset($this->vstack[$len-2][$duplicateKey]));
- $key = $duplicateKey;
- }
- $this->vstack[$len-2][$key] = $this->vstack[$len][1];
- } else {
- assert($this->vstack[$len-2] instanceof stdClass);
- $token = $this->vstack[$len-2];
- if (PHP_VERSION_ID < 70100) {
- $key = $this->vstack[$len][0] === '' ? '_empty_' : $this->vstack[$len][0];
- } else {
- $key = $this->vstack[$len][0];
- }
- if (($this->flags & self::DETECT_KEY_CONFLICTS) && isset($this->vstack[$len-2]->{$key})) {
- $errStr = 'Parse error on line ' . ($yylineno+1) . ":\n";
- $errStr .= $this->lexer->showPosition() . "\n";
- $errStr .= "Duplicate key: ".$this->vstack[$len][0];
- throw new DuplicateKeyException($errStr, $this->vstack[$len][0], array('line' => $yylineno+1));
- } elseif (($this->flags & self::ALLOW_DUPLICATE_KEYS) && isset($this->vstack[$len-2]->{$key})) {
- $duplicateCount = 1;
- do {
- $duplicateKey = $key . '.' . $duplicateCount++;
- } while (isset($this->vstack[$len-2]->$duplicateKey));
- $key = $duplicateKey;
- }
- $this->vstack[$len-2]->$key = $this->vstack[$len][1];
- }
- break;
- case 18:
- $token = array();
- break;
- case 19:
- $token = $this->vstack[$len-1];
- break;
- case 20:
- $token = array($this->vstack[$len]);
- break;
- case 21:
- assert(\is_array($this->vstack[$len-2]));
- $this->vstack[$len-2][] = $this->vstack[$len];
- $token = $this->vstack[$len-2];
- break;
- }
- return array($token, new Undefined());
- }
- private function stringInterpolation($match)
- {
- switch ($match[0]) {
- case '\\\\':
- return '\\';
- case '\"':
- return '"';
- case '\b':
- return \chr(8);
- case '\f':
- return \chr(12);
- case '\n':
- return "\n";
- case '\r':
- return "\r";
- case '\t':
- return "\t";
- case '\/':
- return "/";
- default:
- return html_entity_decode('&#x'.ltrim(substr($match[0], 2), '0').';', ENT_QUOTES, 'UTF-8');
- }
- }
- private function popStack($n)
- {
- $this->stack = \array_slice($this->stack, 0, - (2 * $n));
- $this->vstack = \array_slice($this->vstack, 0, - $n);
- $this->lstack = \array_slice($this->lstack, 0, - $n);
- }
- private function failOnBOM($input)
- {
- $bom = "\xEF\xBB\xBF";
- if (substr($input, 0, 3) === $bom) {
- $this->parseError("BOM detected, make sure your input does not include a Unicode Byte-Order-Mark");
- }
- }
- }
- <?php
- namespace Seld\JsonLint;
- class Lexer
- {
- const EOF = 1;
- const T_INVALID = -1;
- const T_SKIP_WHITESPACE = 0;
- const T_ERROR = 2;
- private $rules = array(
- 0 => '/\G\s+/',
- 1 => '/\G-?([0-9]|[1-9][0-9]+)(\.[0-9]+)?([eE][+-]?[0-9]+)?\b/',
- 2 => '{\G"(?>\\\\["bfnrt/\\\\]|\\\\u[a-fA-F0-9]{4}|[^\0-\x1f\\\\"]++)*+"}',
- 3 => '/\G\{/',
- 4 => '/\G\}/',
- 5 => '/\G\[/',
- 6 => '/\G\]/',
- 7 => '/\G,/',
- 8 => '/\G:/',
- 9 => '/\Gtrue\b/',
- 10 => '/\Gfalse\b/',
- 11 => '/\Gnull\b/',
- 12 => '/\G$/',
- 13 => '/\G./',
- );
- private $input;
- private $more;
- private $done;
- private $offset;
- public $match;
- public $yylineno;
- public $yyleng;
- public $yytext;
- public $yylloc;
- public function lex()
- {
- do {
- $symbol = $this->next();
- } while ($symbol === self::T_SKIP_WHITESPACE);
- return $symbol;
- }
- public function setInput($input)
- {
- $this->input = $input;
- $this->more = false;
- $this->done = false;
- $this->offset = 0;
- $this->yylineno = $this->yyleng = 0;
- $this->yytext = $this->match = '';
- $this->yylloc = array('first_line' => 1, 'first_column' => 0, 'last_line' => 1, 'last_column' => 0);
- return $this;
- }
- public function showPosition()
- {
- $pre = str_replace("\n", '', $this->getPastInput());
- $c = str_repeat('-', max(0, \strlen($pre) - 1));
- return $pre . str_replace("\n", '', $this->getUpcomingInput()) . "\n" . $c . "^";
- }
- public function getPastInput()
- {
- $pastLength = $this->offset - \strlen($this->match);
- return ($pastLength > 20 ? '...' : '') . substr($this->input, max(0, $pastLength - 20), min(20, $pastLength));
- }
- public function getUpcomingInput()
- {
- $next = $this->match;
- if (\strlen($next) < 20) {
- $next .= substr($this->input, $this->offset, 20 - \strlen($next));
- }
- return substr($next, 0, 20) . (\strlen($next) > 20 ? '...' : '');
- }
- public function getFullUpcomingInput()
- {
- $next = $this->match;
- if (substr($next, 0, 1) === '"' && substr_count($next, '"') === 1) {
- $len = \strlen($this->input);
- if ($len === $this->offset) {
- $strEnd = $len;
- } else {
- $strEnd = min(strpos($this->input, '"', $this->offset + 1) ?: $len, strpos($this->input, "\n", $this->offset + 1) ?: $len);
- }
- $next .= substr($this->input, $this->offset, $strEnd - $this->offset);
- } elseif (\strlen($next) < 20) {
- $next .= substr($this->input, $this->offset, 20 - \strlen($next));
- }
- return $next;
- }
- protected function parseError($str)
- {
- throw new ParsingException($str);
- }
- private function next()
- {
- if ($this->done) {
- return self::EOF;
- }
- if ($this->offset === \strlen($this->input)) {
- $this->done = true;
- }
- $token = null;
- $match = null;
- $col = null;
- $lines = null;
- if (!$this->more) {
- $this->yytext = '';
- $this->match = '';
- }
- $rulesLen = 14;
- for ($i=0; $i < $rulesLen; $i++) {
- if (preg_match($this->rules[$i], $this->input, $match, 0, $this->offset)) {
- $lines = explode("\n", $match[0]);
- array_shift($lines);
- $lineCount = \count($lines);
- $this->yylineno += $lineCount;
- $this->yylloc = array(
- 'first_line' => $this->yylloc['last_line'],
- 'last_line' => $this->yylineno+1,
- 'first_column' => $this->yylloc['last_column'],
- 'last_column' => $lineCount > 0 ? \strlen($lines[$lineCount - 1]) : $this->yylloc['last_column'] + \strlen($match[0]),
- );
- $this->yytext .= $match[0];
- $this->match .= $match[0];
- $this->yyleng = \strlen($this->yytext);
- $this->more = false;
- $this->offset += \strlen($match[0]);
- return $this->performAction($i);
- }
- }
- if ($this->offset === \strlen($this->input)) {
- return self::EOF;
- }
- $this->parseError(
- 'Lexical error on line ' . ($this->yylineno+1) . ". Unrecognized text.\n" . $this->showPosition()
- );
- }
- private function performAction($rule)
- {
- switch ($rule) {
- case 0:
- return self::T_SKIP_WHITESPACE;
- case 1:
- return 6;
- case 2:
- $this->yytext = substr($this->yytext, 1, $this->yyleng-2);
- return 4;
- case 3:
- return 17;
- case 4:
- return 18;
- case 5:
- return 23;
- case 6:
- return 24;
- case 7:
- return 22;
- case 8:
- return 21;
- case 9:
- return 10;
- case 10:
- return 11;
- case 11:
- return 8;
- case 12:
- return 14;
- case 13:
- return self::T_INVALID;
- default:
- throw new \LogicException('Unsupported rule '.$rule);
- }
- }
- }
- <?php
- namespace Seld\JsonLint;
- class ParsingException extends \Exception
- {
- protected $details;
- public function __construct($message, $details = array())
- {
- $this->details = $details;
- parent::__construct($message);
- }
- public function getDetails()
- {
- return $this->details;
- }
- }
- <?php
- namespace Seld\JsonLint;
- class Undefined
- {
- }
- Copyright (c) 2015 Jordi Boggiano
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is furnished
- to do so, subject to the following conditions:
- The above copyright notice and this permission notice shall be included in all
- copies or substantial portions of the Software.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
- <?php
- namespace Seld\PharUtils;
- class Linter
- {
- public static function lint($path, array $excludedPaths = array())
- {
- $php = defined('PHP_BINARY') ? PHP_BINARY : 'php';
- if ($isWindows = defined('PHP_WINDOWS_VERSION_BUILD')) {
- $tmpFile = @tempnam(sys_get_temp_dir(), '');
- if (!$tmpFile || !is_writable($tmpFile)) {
- throw new \RuntimeException('Unable to create temp file');
- }
- $php = self::escapeWindowsPath($php);
- $tmpFile = self::escapeWindowsPath($tmpFile);
- if (PHP_VERSION_ID >= 80000) {
- $format = '%s -l %s';
- } else {
- $format = '"%s -l %s"';
- }
- $command = sprintf($format, $php, $tmpFile);
- } else {
- $command = "'".$php."' -l";
- }
- $descriptorspec = array(
- 0 => array('pipe', 'r'),
- 1 => array('pipe', 'w'),
- 2 => array('pipe', 'w')
- );
- $baseLen = strlen(realpath($path)) + 7 + 1;
- foreach (new \RecursiveIteratorIterator(new \Phar($path)) as $file) {
- if ($file->isDir()) {
- continue;
- }
- if (substr($file, -4) === '.php') {
- $filename = (string) $file;
- if (in_array(substr($filename, $baseLen), $excludedPaths, true)) {
- continue;
- }
- if ($isWindows) {
- file_put_contents($tmpFile, file_get_contents($filename));
- }
- $process = proc_open($command, $descriptorspec, $pipes);
- if (is_resource($process)) {
- if (!$isWindows) {
- fwrite($pipes[0], file_get_contents($filename));
- }
- fclose($pipes[0]);
- $stdout = stream_get_contents($pipes[1]);
- fclose($pipes[1]);
- $stderr = stream_get_contents($pipes[2]);
- fclose($pipes[2]);
- $exitCode = proc_close($process);
- if ($exitCode !== 0) {
- if ($isWindows) {
- $stderr = str_replace($tmpFile, $filename, $stderr);
- }
- throw new \UnexpectedValueException('Failed linting '.$file.': '.$stderr);
- }
- } else {
- throw new \RuntimeException('Could not start linter process');
- }
- }
- }
- if ($isWindows) {
- @unlink($tmpFile);
- }
- }
- private static function escapeWindowsPath($path)
- {
- if (strpbrk($path, " ()") !== false) {
- $path = '"'.$path.'"';
- }
- return $path;
- }
- }
- <?php
- namespace Seld\PharUtils;
- class Timestamps
- {
- private $contents;
- public function __construct($file)
- {
- $this->contents = file_get_contents($file);
- }
- public function updateTimestamps($timestamp = null)
- {
- if ($timestamp instanceof \DateTime || $timestamp instanceof \DateTimeInterface) {
- $timestamp = $timestamp->getTimestamp();
- } elseif (is_string($timestamp)) {
- $timestamp = strtotime($timestamp);
- } elseif (!is_int($timestamp)) {
- $timestamp = strtotime('1984-12-24T00:00:00Z');
- }
- if (!preg_match('{__HALT_COMPILER\(\);(?: +\?>)?\r?\n}', $this->contents, $match, PREG_OFFSET_CAPTURE)) {
- throw new \RuntimeException('Could not detect the stub\'s end in the phar');
- }
- $pos = $match[0][1] + strlen($match[0][0]);
- $stubEnd = $pos + $this->readUint($pos, 4);
- $pos += 4;
- $numFiles = $this->readUint($pos, 4);
- $pos += 4;
- $pos += 2;
- $pos += 4;
- $aliasLength = $this->readUint($pos, 4);
- $pos += 4 + $aliasLength;
- $metadataLength = $this->readUint($pos, 4);
- $pos += 4 + $metadataLength;
- while ($pos < $stubEnd) {
- $filenameLength = $this->readUint($pos, 4);
- $pos += 4 + $filenameLength;
- $pos += 4;
- $this->contents = substr_replace($this->contents, pack('L', $timestamp), $pos, 4);
- $pos += 4*4;
- $metadataLength = $this->readUint($pos, 4);
- $pos += 4 + $metadataLength;
- $numFiles--;
- }
- if ($numFiles !== 0) {
- throw new \LogicException('All files were not processed, something must have gone wrong');
- }
- }
- public function save($path, $signatureAlgo)
- {
- $pos = $this->determineSignatureBegin();
- $algos = array(
- \Phar::MD5 => 'md5',
- \Phar::SHA1 => 'sha1',
- \Phar::SHA256 => 'sha256',
- \Phar::SHA512 => 'sha512',
- );
- if (!isset($algos[$signatureAlgo])) {
- throw new \UnexpectedValueException('Invalid hash algorithm given: '.$signatureAlgo.' expected one of Phar::MD5, Phar::SHA1, Phar::SHA256 or Phar::SHA512');
- }
- $algo = $algos[$signatureAlgo];
- $signature = hash($algo, substr($this->contents, 0, $pos), true)
- . pack('L', $signatureAlgo)
- . 'GBMB';
- $this->contents = substr($this->contents, 0, $pos) . $signature;
- return file_put_contents($path, $this->contents);
- }
- private function readUint($pos, $bytes)
- {
- $res = unpack('V', substr($this->contents, $pos, $bytes));
- return $res[1];
- }
- private function determineSignatureBegin()
- {
- if (!preg_match('{__HALT_COMPILER\(\);(?: +\?>)?\r?\n}', $this->contents, $match, PREG_OFFSET_CAPTURE)) {
- throw new \RuntimeException('Could not detect the stub\'s end in the phar');
- }
- $pos = $match[0][1] + strlen($match[0][0]);
- $manifestEnd = $pos + 4 + $this->readUint($pos, 4);
- $pos += 4;
- $numFiles = $this->readUint($pos, 4);
- $pos += 4;
- $pos += 2;
- $pos += 4;
- $aliasLength = $this->readUint($pos, 4);
- $pos += 4 + $aliasLength;
- $metadataLength = $this->readUint($pos, 4);
- $pos += 4 + $metadataLength;
- $compressedSizes = 0;
- while (($numFiles > 0) && ($pos < $manifestEnd - 24)) {
- $filenameLength = $this->readUint($pos, 4);
- $pos += 4 + $filenameLength;
- $pos += 2*4;
- $compressedSizes += $this->readUint($pos, 4);
- $pos += 3*4;
- $metadataLength = $this->readUint($pos, 4);
- $pos += 4 + $metadataLength;
- $numFiles--;
- }
- if ($numFiles !== 0) {
- throw new \LogicException('All files were not processed, something must have gone wrong');
- }
- return $manifestEnd + $compressedSizes;
- }
- }
- Copyright (c) 2015 Jordi Boggiano
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is furnished
- to do so, subject to the following conditions:
- The above copyright notice and this permission notice shall be included in all
- copies or substantial portions of the Software.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
- <?php
- namespace Seld\Signal;
- use Psr\Log\LoggerInterface;
- use Closure;
- use WeakReference;
- final class SignalHandler
- {
- public const SIGHUP = 'SIGHUP';
- public const SIGINT = 'SIGINT';
- public const SIGQUIT = 'SIGQUIT';
- public const SIGILL = 'SIGILL';
- public const SIGTRAP = 'SIGTRAP';
- public const SIGABRT = 'SIGABRT';
- public const SIGIOT = 'SIGIOT';
- public const SIGBUS = 'SIGBUS';
- public const SIGFPE = 'SIGFPE';
- public const SIGKILL = 'SIGKILL';
- public const SIGUSR1 = 'SIGUSR1';
- public const SIGUSR2 = 'SIGUSR2';
- public const SIGSEGV = 'SIGSEGV';
- public const SIGPIPE = 'SIGPIPE';
- public const SIGALRM = 'SIGALRM';
- public const SIGTERM = 'SIGTERM';
- public const SIGSTKFLT = 'SIGSTKFLT';
- public const SIGCLD = 'SIGCLD';
- public const SIGCHLD = 'SIGCHLD';
- public const SIGCONT = 'SIGCONT';
- public const SIGSTOP = 'SIGSTOP';
- public const SIGTSTP = 'SIGTSTP';
- public const SIGTTIN = 'SIGTTIN';
- public const SIGTTOU = 'SIGTTOU';
- public const SIGURG = 'SIGURG';
- public const SIGXCPU = 'SIGXCPU';
- public const SIGXFSZ = 'SIGXFSZ';
- public const SIGVTALRM = 'SIGVTALRM';
- public const SIGPROF = 'SIGPROF';
- public const SIGWINCH = 'SIGWINCH';
- public const SIGPOLL = 'SIGPOLL';
- public const SIGIO = 'SIGIO';
- public const SIGPWR = 'SIGPWR';
- public const SIGSYS = 'SIGSYS';
- public const SIGBABY = 'SIGBABY';
- public const SIGBREAK = 'SIGBREAK';
- private const ALL_SIGNALS = [
- self::SIGHUP, self::SIGINT, self::SIGQUIT, self::SIGILL, self::SIGTRAP, self::SIGABRT, self::SIGIOT, self::SIGBUS,
- self::SIGFPE, self::SIGKILL, self::SIGUSR1, self::SIGUSR2, self::SIGSEGV, self::SIGPIPE, self::SIGALRM, self::SIGTERM,
- self::SIGSTKFLT, self::SIGCLD, self::SIGCHLD, self::SIGCONT, self::SIGSTOP, self::SIGTSTP, self::SIGTTIN, self::SIGTTOU,
- self::SIGURG, self::SIGXCPU, self::SIGXFSZ, self::SIGVTALRM, self::SIGPROF, self::SIGWINCH, self::SIGPOLL, self::SIGIO,
- self::SIGPWR, self::SIGSYS, self::SIGBABY, self::SIGBREAK
- ];
- private $triggered = null;
- private $signals;
- private $loggerOrCallback;
- private static $handlers = [];
- private static $windowsHandler = null;
- private function __construct(array $signals, $loggerOrCallback)
- {
- if (!is_callable($loggerOrCallback) && !$loggerOrCallback instanceof LoggerInterface && $loggerOrCallback !== null) {
- throw new \InvalidArgumentException('$loggerOrCallback must be a '.LoggerInterface::class.' instance, a callable, or null, '.(is_object($loggerOrCallback) ? get_class($loggerOrCallback) : gettype($loggerOrCallback)).' received.');
- }
- $this->signals = $signals;
- $this->loggerOrCallback = $loggerOrCallback;
- }
- private function trigger(string $signalName): void
- {
- $this->triggered = $signalName;
- if ($this->loggerOrCallback instanceof LoggerInterface) {
- $this->loggerOrCallback->info('Received '.$signalName);
- } elseif ($this->loggerOrCallback !== null) {
- ($this->loggerOrCallback)($signalName, $this);
- }
- }
- public function isTriggered(): bool
- {
- return $this->triggered !== null;
- }
- public function exitWithLastSignal(): void
- {
- $signal = $this->triggered ?? 'SIGINT';
- $signal = defined($signal) ? constant($signal) : 2;
- if (function_exists('posix_kill') && function_exists('posix_getpid')) {
- pcntl_signal($signal, SIG_DFL);
- posix_kill(posix_getpid(), $signal);
- }
- exit(128 + $signal);
- }
- public function reset(): void
- {
- $this->triggered = null;
- }
- public function __destruct()
- {
- $this->unregister();
- }
- public static function create(?array $signals = null, $loggerOrCallback = null): self
- {
- if ($signals === null) {
- $signals = [self::SIGINT, self::SIGTERM];
- }
- $signals = array_map(function ($signal) {
- if (is_int($signal)) {
- return self::getSignalName($signal);
- } elseif (!in_array($signal, self::ALL_SIGNALS, true)) {
- throw new \InvalidArgumentException('$signals must be an array of SIG* constants or self::SIG* constants, got '.var_export($signal, true));
- }
- return $signal;
- }, (array) $signals);
- $handler = new self($signals, $loggerOrCallback);
- if (PHP_VERSION_ID >= 80000) {
- array_unshift(self::$handlers, WeakReference::create($handler));
- } else {
- array_unshift(self::$handlers, $handler);
- }
- if (function_exists('sapi_windows_set_ctrl_handler') && PHP_SAPI === 'cli' && (in_array(self::SIGINT, $signals, true) || in_array(self::SIGBREAK, $signals, true))) {
- if (null === self::$windowsHandler) {
- self::$windowsHandler = Closure::fromCallable([self::class, 'handleWindowsSignal']);
- sapi_windows_set_ctrl_handler(self::$windowsHandler);
- }
- }
- if (function_exists('pcntl_signal') && function_exists('pcntl_async_signals')) {
- pcntl_async_signals(true);
- self::registerPcntlHandler($signals);
- }
- return $handler;
- }
- public function unregister(): void
- {
- $signals = $this->signals;
- $index = false;
- foreach (self::$handlers as $key => $handler) {
- if (($handler instanceof WeakReference && $handler->get() === $this) || $handler === $this) {
- $index = $key;
- break;
- }
- }
- if ($index === false) {
- return;
- }
- unset(self::$handlers[$index]);
- if (self::$windowsHandler !== null && (in_array(self::SIGINT, $signals, true) || in_array(self::SIGBREAK, $signals, true))) {
- if (self::getHandlerFor(self::SIGINT) === null && self::getHandlerFor(self::SIGBREAK) === null) {
- sapi_windows_set_ctrl_handler(self::$windowsHandler, false);
- self::$windowsHandler = null;
- }
- }
- if (function_exists('pcntl_signal')) {
- foreach ($signals as $signal) {
- if (!defined($signal)) {
- continue;
- }
- if (self::getHandlerFor($signal) !== null) {
- continue;
- }
- pcntl_signal(constant($signal), SIG_DFL);
- }
- }
- }
- public static function unregisterAll(): void
- {
- if (self::$windowsHandler !== null) {
- sapi_windows_set_ctrl_handler(self::$windowsHandler, false);
- self::$windowsHandler = null;
- }
- foreach (self::$handlers as $key => $handler) {
- if ($handler instanceof WeakReference) {
- $handler = $handler->get();
- if ($handler === null) {
- unset(self::$handlers[$key]);
- continue;
- }
- }
- $handler->unregister();
- }
- }
- private static function registerPcntlHandler(array $signals): void
- {
- static $callable;
- if ($callable === null) {
- $callable = Closure::fromCallable([self::class, 'handlePcntlSignal']);
- }
- foreach ($signals as $signal) {
- if (!defined($signal)) {
- continue;
- }
- pcntl_signal(constant($signal), $callable);
- }
- }
- private static function handleWindowsSignal(int $event): void
- {
- if (PHP_WINDOWS_EVENT_CTRL_C === $event) {
- self::callHandlerFor(self::SIGINT);
- } elseif (PHP_WINDOWS_EVENT_CTRL_BREAK === $event) {
- self::callHandlerFor(self::SIGBREAK);
- }
- }
- private static function handlePcntlSignal(int $signal): void
- {
- self::callHandlerFor(self::getSignalName($signal));
- }
- private static function callHandlerFor(string $signal): void
- {
- $handler = self::getHandlerFor($signal);
- if ($handler !== null) {
- $handler->trigger($signal);
- }
- }
- private static function getHandlerFor(string $signal): ?self
- {
- foreach (self::$handlers as $key => $handler) {
- if ($handler instanceof WeakReference) {
- $handler = $handler->get();
- if ($handler === null) {
- unset(self::$handlers[$key]);
- continue;
- }
- }
- if (in_array($signal, $handler->signals, true)) {
- return $handler;
- }
- }
- return null;
- }
- private static function getSignalName(int $signo): string
- {
- static $signals = null;
- if ($signals === null) {
- $signals = [];
- foreach (self::ALL_SIGNALS as $value) {
- if (defined($value)) {
- $signals[constant($value)] = $value;
- }
- }
- }
- if (isset($signals[$signo])) {
- return $signals[$signo];
- }
- throw new \InvalidArgumentException('Unknown signal #'.$signo);
- }
- }
- <?php
- namespace Symfony\Component\Console;
- use Symfony\Component\Console\Command\Command;
- use Symfony\Component\Console\Command\CompleteCommand;
- use Symfony\Component\Console\Command\DumpCompletionCommand;
- use Symfony\Component\Console\Command\HelpCommand;
- use Symfony\Component\Console\Command\LazyCommand;
- use Symfony\Component\Console\Command\ListCommand;
- use Symfony\Component\Console\Command\SignalableCommandInterface;
- use Symfony\Component\Console\CommandLoader\CommandLoaderInterface;
- use Symfony\Component\Console\Completion\CompletionInput;
- use Symfony\Component\Console\Completion\CompletionSuggestions;
- use Symfony\Component\Console\Event\ConsoleCommandEvent;
- use Symfony\Component\Console\Event\ConsoleErrorEvent;
- use Symfony\Component\Console\Event\ConsoleSignalEvent;
- use Symfony\Component\Console\Event\ConsoleTerminateEvent;
- use Symfony\Component\Console\Exception\CommandNotFoundException;
- use Symfony\Component\Console\Exception\ExceptionInterface;
- use Symfony\Component\Console\Exception\LogicException;
- use Symfony\Component\Console\Exception\NamespaceNotFoundException;
- use Symfony\Component\Console\Exception\RuntimeException;
- use Symfony\Component\Console\Formatter\OutputFormatter;
- use Symfony\Component\Console\Helper\DebugFormatterHelper;
- use Symfony\Component\Console\Helper\FormatterHelper;
- use Symfony\Component\Console\Helper\Helper;
- use Symfony\Component\Console\Helper\HelperSet;
- use Symfony\Component\Console\Helper\ProcessHelper;
- use Symfony\Component\Console\Helper\QuestionHelper;
- use Symfony\Component\Console\Input\ArgvInput;
- use Symfony\Component\Console\Input\ArrayInput;
- use Symfony\Component\Console\Input\InputArgument;
- use Symfony\Component\Console\Input\InputAwareInterface;
- use Symfony\Component\Console\Input\InputDefinition;
- use Symfony\Component\Console\Input\InputInterface;
- use Symfony\Component\Console\Input\InputOption;
- use Symfony\Component\Console\Output\ConsoleOutput;
- use Symfony\Component\Console\Output\ConsoleOutputInterface;
- use Symfony\Component\Console\Output\OutputInterface;
- use Symfony\Component\Console\SignalRegistry\SignalRegistry;
- use Symfony\Component\Console\Style\SymfonyStyle;
- use Symfony\Component\ErrorHandler\ErrorHandler;
- use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
- use Symfony\Contracts\Service\ResetInterface;
- class Application implements ResetInterface
- {
- private $commands = [];
- private $wantHelps = false;
- private $runningCommand;
- private $name;
- private $version;
- private $commandLoader;
- private $catchExceptions = true;
- private $autoExit = true;
- private $definition;
- private $helperSet;
- private $dispatcher;
- private $terminal;
- private $defaultCommand;
- private $singleCommand = false;
- private $initialized;
- private $signalRegistry;
- private $signalsToDispatchEvent = [];
- public function __construct(string $name = 'UNKNOWN', string $version = 'UNKNOWN')
- {
- $this->name = $name;
- $this->version = $version;
- $this->terminal = new Terminal();
- $this->defaultCommand = 'list';
- if (\defined('SIGINT') && SignalRegistry::isSupported()) {
- $this->signalRegistry = new SignalRegistry();
- $this->signalsToDispatchEvent = [\SIGINT, \SIGTERM, \SIGUSR1, \SIGUSR2];
- }
- }
- public function setDispatcher(EventDispatcherInterface $dispatcher)
- {
- $this->dispatcher = $dispatcher;
- }
- public function setCommandLoader(CommandLoaderInterface $commandLoader)
- {
- $this->commandLoader = $commandLoader;
- }
- public function getSignalRegistry(): SignalRegistry
- {
- if (!$this->signalRegistry) {
- 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.');
- }
- return $this->signalRegistry;
- }
- public function setSignalsToDispatchEvent(int ...$signalsToDispatchEvent)
- {
- $this->signalsToDispatchEvent = $signalsToDispatchEvent;
- }
- public function run(InputInterface $input = null, OutputInterface $output = null)
- {
- if (\function_exists('putenv')) {
- @putenv('LINES='.$this->terminal->getHeight());
- @putenv('COLUMNS='.$this->terminal->getWidth());
- }
- if (null === $input) {
- $input = new ArgvInput();
- }
- if (null === $output) {
- $output = new ConsoleOutput();
- }
- $renderException = function (\Throwable $e) use ($output) {
- if ($output instanceof ConsoleOutputInterface) {
- $this->renderThrowable($e, $output->getErrorOutput());
- } else {
- $this->renderThrowable($e, $output);
- }
- };
- if ($phpHandler = set_exception_handler($renderException)) {
- restore_exception_handler();
- if (!\is_array($phpHandler) || !$phpHandler[0] instanceof ErrorHandler) {
- $errorHandler = true;
- } elseif ($errorHandler = $phpHandler[0]->setExceptionHandler($renderException)) {
- $phpHandler[0]->setExceptionHandler($errorHandler);
- }
- }
- $this->configureIO($input, $output);
- try {
- $exitCode = $this->doRun($input, $output);
- } catch (\Exception $e) {
- if (!$this->catchExceptions) {
- throw $e;
- }
- $renderException($e);
- $exitCode = $e->getCode();
- if (is_numeric($exitCode)) {
- $exitCode = (int) $exitCode;
- if ($exitCode <= 0) {
- $exitCode = 1;
- }
- } else {
- $exitCode = 1;
- }
- } finally {
- if (!$phpHandler) {
- if (set_exception_handler($renderException) === $renderException) {
- restore_exception_handler();
- }
- restore_exception_handler();
- } elseif (!$errorHandler) {
- $finalHandler = $phpHandler[0]->setExceptionHandler(null);
- if ($finalHandler !== $renderException) {
- $phpHandler[0]->setExceptionHandler($finalHandler);
- }
- }
- }
- if ($this->autoExit) {
- if ($exitCode > 255) {
- $exitCode = 255;
- }
- exit($exitCode);
- }
- return $exitCode;
- }
- public function doRun(InputInterface $input, OutputInterface $output)
- {
- if (true === $input->hasParameterOption(['--version', '-V'], true)) {
- $output->writeln($this->getLongVersion());
- return 0;
- }
- try {
- $input->bind($this->getDefinition());
- } catch (ExceptionInterface $e) {
- }
- $name = $this->getCommandName($input);
- if (true === $input->hasParameterOption(['--help', '-h'], true)) {
- if (!$name) {
- $name = 'help';
- $input = new ArrayInput(['command_name' => $this->defaultCommand]);
- } else {
- $this->wantHelps = true;
- }
- }
- if (!$name) {
- $name = $this->defaultCommand;
- $definition = $this->getDefinition();
- $definition->setArguments(array_merge(
- $definition->getArguments(),
- [
- 'command' => new InputArgument('command', InputArgument::OPTIONAL, $definition->getArgument('command')->getDescription(), $name),
- ]
- ));
- }
- try {
- $this->runningCommand = null;
- $command = $this->find($name);
- } catch (\Throwable $e) {
- if (!($e instanceof CommandNotFoundException && !$e instanceof NamespaceNotFoundException) || 1 !== \count($alternatives = $e->getAlternatives()) || !$input->isInteractive()) {
- if (null !== $this->dispatcher) {
- $event = new ConsoleErrorEvent($input, $output, $e);
- $this->dispatcher->dispatch($event, ConsoleEvents::ERROR);
- if (0 === $event->getExitCode()) {
- return 0;
- }
- $e = $event->getError();
- }
- throw $e;
- }
- $alternative = $alternatives[0];
- $style = new SymfonyStyle($input, $output);
- $style->block(sprintf("\nCommand \"%s\" is not defined.\n", $name), null, 'error');
- if (!$style->confirm(sprintf('Do you want to run "%s" instead? ', $alternative), false)) {
- if (null !== $this->dispatcher) {
- $event = new ConsoleErrorEvent($input, $output, $e);
- $this->dispatcher->dispatch($event, ConsoleEvents::ERROR);
- return $event->getExitCode();
- }
- return 1;
- }
- $command = $this->find($alternative);
- }
- if ($command instanceof LazyCommand) {
- $command = $command->getCommand();
- }
- $this->runningCommand = $command;
- $exitCode = $this->doRunCommand($command, $input, $output);
- $this->runningCommand = null;
- return $exitCode;
- }
- public function reset()
- {
- }
- public function setHelperSet(HelperSet $helperSet)
- {
- $this->helperSet = $helperSet;
- }
- public function getHelperSet()
- {
- if (!$this->helperSet) {
- $this->helperSet = $this->getDefaultHelperSet();
- }
- return $this->helperSet;
- }
- public function setDefinition(InputDefinition $definition)
- {
- $this->definition = $definition;
- }
- public function getDefinition()
- {
- if (!$this->definition) {
- $this->definition = $this->getDefaultInputDefinition();
- }
- if ($this->singleCommand) {
- $inputDefinition = $this->definition;
- $inputDefinition->setArguments();
- return $inputDefinition;
- }
- return $this->definition;
- }
- public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void
- {
- if (
- CompletionInput::TYPE_ARGUMENT_VALUE === $input->getCompletionType()
- && 'command' === $input->getCompletionName()
- ) {
- $commandNames = [];
- foreach ($this->all() as $name => $command) {
- if ($command->isHidden() || $command->getName() !== $name) {
- continue;
- }
- $commandNames[] = $command->getName();
- foreach ($command->getAliases() as $name) {
- $commandNames[] = $name;
- }
- }
- $suggestions->suggestValues(array_filter($commandNames));
- return;
- }
- if (CompletionInput::TYPE_OPTION_NAME === $input->getCompletionType()) {
- $suggestions->suggestOptions($this->getDefinition()->getOptions());
- return;
- }
- }
- public function getHelp()
- {
- return $this->getLongVersion();
- }
- public function areExceptionsCaught()
- {
- return $this->catchExceptions;
- }
- public function setCatchExceptions(bool $boolean)
- {
- $this->catchExceptions = $boolean;
- }
- public function isAutoExitEnabled()
- {
- return $this->autoExit;
- }
- public function setAutoExit(bool $boolean)
- {
- $this->autoExit = $boolean;
- }
- public function getName()
- {
- return $this->name;
- }
- public function setName(string $name)
- {
- $this->name = $name;
- }
- public function getVersion()
- {
- return $this->version;
- }
- public function setVersion(string $version)
- {
- $this->version = $version;
- }
- public function getLongVersion()
- {
- if ('UNKNOWN' !== $this->getName()) {
- if ('UNKNOWN' !== $this->getVersion()) {
- return sprintf('%s <info>%s</info>', $this->getName(), $this->getVersion());
- }
- return $this->getName();
- }
- return 'Console Tool';
- }
- public function register(string $name)
- {
- return $this->add(new Command($name));
- }
- public function addCommands(array $commands)
- {
- foreach ($commands as $command) {
- $this->add($command);
- }
- }
- public function add(Command $command)
- {
- $this->init();
- $command->setApplication($this);
- if (!$command->isEnabled()) {
- $command->setApplication(null);
- return null;
- }
- if (!$command instanceof LazyCommand) {
- $command->getDefinition();
- }
- if (!$command->getName()) {
- throw new LogicException(sprintf('The command defined in "%s" cannot have an empty name.', get_debug_type($command)));
- }
- $this->commands[$command->getName()] = $command;
- foreach ($command->getAliases() as $alias) {
- $this->commands[$alias] = $command;
- }
- return $command;
- }
- public function get(string $name)
- {
- $this->init();
- if (!$this->has($name)) {
- throw new CommandNotFoundException(sprintf('The command "%s" does not exist.', $name));
- }
- if (!isset($this->commands[$name])) {
- 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));
- }
- $command = $this->commands[$name];
- if ($this->wantHelps) {
- $this->wantHelps = false;
- $helpCommand = $this->get('help');
- $helpCommand->setCommand($command);
- return $helpCommand;
- }
- return $command;
- }
- public function has(string $name)
- {
- $this->init();
- return isset($this->commands[$name]) || ($this->commandLoader && $this->commandLoader->has($name) && $this->add($this->commandLoader->get($name)));
- }
- public function getNamespaces()
- {
- $namespaces = [];
- foreach ($this->all() as $command) {
- if ($command->isHidden()) {
- continue;
- }
- $namespaces[] = $this->extractAllNamespaces($command->getName());
- foreach ($command->getAliases() as $alias) {
- $namespaces[] = $this->extractAllNamespaces($alias);
- }
- }
- return array_values(array_unique(array_filter(array_merge([], ...$namespaces))));
- }
- public function findNamespace(string $namespace)
- {
- $allNamespaces = $this->getNamespaces();
- $expr = implode('[^:]*:', array_map('preg_quote', explode(':', $namespace))).'[^:]*';
- $namespaces = preg_grep('{^'.$expr.'}', $allNamespaces);
- if (empty($namespaces)) {
- $message = sprintf('There are no commands defined in the "%s" namespace.', $namespace);
- if ($alternatives = $this->findAlternatives($namespace, $allNamespaces)) {
- if (1 == \count($alternatives)) {
- $message .= "\n\nDid you mean this?\n ";
- } else {
- $message .= "\n\nDid you mean one of these?\n ";
- }
- $message .= implode("\n ", $alternatives);
- }
- throw new NamespaceNotFoundException($message, $alternatives);
- }
- $exact = \in_array($namespace, $namespaces, true);
- if (\count($namespaces) > 1 && !$exact) {
- 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));
- }
- return $exact ? $namespace : reset($namespaces);
- }
- public function find(string $name)
- {
- $this->init();
- $aliases = [];
- foreach ($this->commands as $command) {
- foreach ($command->getAliases() as $alias) {
- if (!$this->has($alias)) {
- $this->commands[$alias] = $command;
- }
- }
- }
- if ($this->has($name)) {
- return $this->get($name);
- }
- $allCommands = $this->commandLoader ? array_merge($this->commandLoader->getNames(), array_keys($this->commands)) : array_keys($this->commands);
- $expr = implode('[^:]*:', array_map('preg_quote', explode(':', $name))).'[^:]*';
- $commands = preg_grep('{^'.$expr.'}', $allCommands);
- if (empty($commands)) {
- $commands = preg_grep('{^'.$expr.'}i', $allCommands);
- }
- if (empty($commands) || \count(preg_grep('{^'.$expr.'$}i', $commands)) < 1) {
- if (false !== $pos = strrpos($name, ':')) {
- $this->findNamespace(substr($name, 0, $pos));
- }
- $message = sprintf('Command "%s" is not defined.', $name);
- if ($alternatives = $this->findAlternatives($name, $allCommands)) {
- $alternatives = array_filter($alternatives, function ($name) {
- return !$this->get($name)->isHidden();
- });
- if (1 == \count($alternatives)) {
- $message .= "\n\nDid you mean this?\n ";
- } else {
- $message .= "\n\nDid you mean one of these?\n ";
- }
- $message .= implode("\n ", $alternatives);
- }
- throw new CommandNotFoundException($message, array_values($alternatives));
- }
- if (\count($commands) > 1) {
- $commandList = $this->commandLoader ? array_merge(array_flip($this->commandLoader->getNames()), $this->commands) : $this->commands;
- $commands = array_unique(array_filter($commands, function ($nameOrAlias) use (&$commandList, $commands, &$aliases) {
- if (!$commandList[$nameOrAlias] instanceof Command) {
- $commandList[$nameOrAlias] = $this->commandLoader->get($nameOrAlias);
- }
- $commandName = $commandList[$nameOrAlias]->getName();
- $aliases[$nameOrAlias] = $commandName;
- return $commandName === $nameOrAlias || !\in_array($commandName, $commands);
- }));
- }
- if (\count($commands) > 1) {
- $usableWidth = $this->terminal->getWidth() - 10;
- $abbrevs = array_values($commands);
- $maxLen = 0;
- foreach ($abbrevs as $abbrev) {
- $maxLen = max(Helper::width($abbrev), $maxLen);
- }
- $abbrevs = array_map(function ($cmd) use ($commandList, $usableWidth, $maxLen, &$commands) {
- if ($commandList[$cmd]->isHidden()) {
- unset($commands[array_search($cmd, $commands)]);
- return false;
- }
- $abbrev = str_pad($cmd, $maxLen, ' ').' '.$commandList[$cmd]->getDescription();
- return Helper::width($abbrev) > $usableWidth ? Helper::substr($abbrev, 0, $usableWidth - 3).'...' : $abbrev;
- }, array_values($commands));
- if (\count($commands) > 1) {
- $suggestions = $this->getAbbreviationSuggestions(array_filter($abbrevs));
- throw new CommandNotFoundException(sprintf("Command \"%s\" is ambiguous.\nDid you mean one of these?\n%s.", $name, $suggestions), array_values($commands));
- }
- }
- $command = $this->get(reset($commands));
- if ($command->isHidden()) {
- throw new CommandNotFoundException(sprintf('The command "%s" does not exist.', $name));
- }
- return $command;
- }
- public function all(string $namespace = null)
- {
- $this->init();
- if (null === $namespace) {
- if (!$this->commandLoader) {
- return $this->commands;
- }
- $commands = $this->commands;
- foreach ($this->commandLoader->getNames() as $name) {
- if (!isset($commands[$name]) && $this->has($name)) {
- $commands[$name] = $this->get($name);
- }
- }
- return $commands;
- }
- $commands = [];
- foreach ($this->commands as $name => $command) {
- if ($namespace === $this->extractNamespace($name, substr_count($namespace, ':') + 1)) {
- $commands[$name] = $command;
- }
- }
- if ($this->commandLoader) {
- foreach ($this->commandLoader->getNames() as $name) {
- if (!isset($commands[$name]) && $namespace === $this->extractNamespace($name, substr_count($namespace, ':') + 1) && $this->has($name)) {
- $commands[$name] = $this->get($name);
- }
- }
- }
- return $commands;
- }
- public static function getAbbreviations(array $names)
- {
- $abbrevs = [];
- foreach ($names as $name) {
- for ($len = \strlen($name); $len > 0; --$len) {
- $abbrev = substr($name, 0, $len);
- $abbrevs[$abbrev][] = $name;
- }
- }
- return $abbrevs;
- }
- public function renderThrowable(\Throwable $e, OutputInterface $output): void
- {
- $output->writeln('', OutputInterface::VERBOSITY_QUIET);
- $this->doRenderThrowable($e, $output);
- if (null !== $this->runningCommand) {
- $output->writeln(sprintf('<info>%s</info>', OutputFormatter::escape(sprintf($this->runningCommand->getSynopsis(), $this->getName()))), OutputInterface::VERBOSITY_QUIET);
- $output->writeln('', OutputInterface::VERBOSITY_QUIET);
- }
- }
- protected function doRenderThrowable(\Throwable $e, OutputInterface $output): void
- {
- do {
- $message = trim($e->getMessage());
- if ('' === $message || OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) {
- $class = get_debug_type($e);
- $title = sprintf(' [%s%s] ', $class, 0 !== ($code = $e->getCode()) ? ' ('.$code.')' : '');
- $len = Helper::width($title);
- } else {
- $len = 0;
- }
- if (str_contains($message, "@anonymous\0")) {
- $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) {
- return class_exists($m[0], false) ? (get_parent_class($m[0]) ?: key(class_implements($m[0])) ?: 'class').'@anonymous' : $m[0];
- }, $message);
- }
- $width = $this->terminal->getWidth() ? $this->terminal->getWidth() - 1 : \PHP_INT_MAX;
- $lines = [];
- foreach ('' !== $message ? preg_split('/\r?\n/', $message) : [] as $line) {
- foreach ($this->splitStringByWidth($line, $width - 4) as $line) {
- $lineLength = Helper::width($line) + 4;
- $lines[] = [$line, $lineLength];
- $len = max($lineLength, $len);
- }
- }
- $messages = [];
- if (!$e instanceof ExceptionInterface || OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) {
- $messages[] = sprintf('<comment>%s</comment>', OutputFormatter::escape(sprintf('In %s line %s:', basename($e->getFile()) ?: 'n/a', $e->getLine() ?: 'n/a')));
- }
- $messages[] = $emptyLine = sprintf('<error>%s</error>', str_repeat(' ', $len));
- if ('' === $message || OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) {
- $messages[] = sprintf('<error>%s%s</error>', $title, str_repeat(' ', max(0, $len - Helper::width($title))));
- }
- foreach ($lines as $line) {
- $messages[] = sprintf('<error> %s %s</error>', OutputFormatter::escape($line[0]), str_repeat(' ', $len - $line[1]));
- }
- $messages[] = $emptyLine;
- $messages[] = '';
- $output->writeln($messages, OutputInterface::VERBOSITY_QUIET);
- if (OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) {
- $output->writeln('<comment>Exception trace:</comment>', OutputInterface::VERBOSITY_QUIET);
- $trace = $e->getTrace();
- array_unshift($trace, [
- 'function' => '',
- 'file' => $e->getFile() ?: 'n/a',
- 'line' => $e->getLine() ?: 'n/a',
- 'args' => [],
- ]);
- for ($i = 0, $count = \count($trace); $i < $count; ++$i) {
- $class = $trace[$i]['class'] ?? '';
- $type = $trace[$i]['type'] ?? '';
- $function = $trace[$i]['function'] ?? '';
- $file = $trace[$i]['file'] ?? 'n/a';
- $line = $trace[$i]['line'] ?? 'n/a';
- $output->writeln(sprintf(' %s%s at <info>%s:%s</info>', $class, $function ? $type.$function.'()' : '', $file, $line), OutputInterface::VERBOSITY_QUIET);
- }
- $output->writeln('', OutputInterface::VERBOSITY_QUIET);
- }
- } while ($e = $e->getPrevious());
- }
- protected function configureIO(InputInterface $input, OutputInterface $output)
- {
- if (true === $input->hasParameterOption(['--ansi'], true)) {
- $output->setDecorated(true);
- } elseif (true === $input->hasParameterOption(['--no-ansi'], true)) {
- $output->setDecorated(false);
- }
- if (true === $input->hasParameterOption(['--no-interaction', '-n'], true)) {
- $input->setInteractive(false);
- }
- switch ($shellVerbosity = (int) getenv('SHELL_VERBOSITY')) {
- case -1: $output->setVerbosity(OutputInterface::VERBOSITY_QUIET); break;
- case 1: $output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE); break;
- case 2: $output->setVerbosity(OutputInterface::VERBOSITY_VERY_VERBOSE); break;
- case 3: $output->setVerbosity(OutputInterface::VERBOSITY_DEBUG); break;
- default: $shellVerbosity = 0; break;
- }
- if (true === $input->hasParameterOption(['--quiet', '-q'], true)) {
- $output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
- $shellVerbosity = -1;
- } else {
- if ($input->hasParameterOption('-vvv', true) || $input->hasParameterOption('--verbose=3', true) || 3 === $input->getParameterOption('--verbose', false, true)) {
- $output->setVerbosity(OutputInterface::VERBOSITY_DEBUG);
- $shellVerbosity = 3;
- } elseif ($input->hasParameterOption('-vv', true) || $input->hasParameterOption('--verbose=2', true) || 2 === $input->getParameterOption('--verbose', false, true)) {
- $output->setVerbosity(OutputInterface::VERBOSITY_VERY_VERBOSE);
- $shellVerbosity = 2;
- } elseif ($input->hasParameterOption('-v', true) || $input->hasParameterOption('--verbose=1', true) || $input->hasParameterOption('--verbose', true) || $input->getParameterOption('--verbose', false, true)) {
- $output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE);
- $shellVerbosity = 1;
- }
- }
- if (-1 === $shellVerbosity) {
- $input->setInteractive(false);
- }
- if (\function_exists('putenv')) {
- @putenv('SHELL_VERBOSITY='.$shellVerbosity);
- }
- $_ENV['SHELL_VERBOSITY'] = $shellVerbosity;
- $_SERVER['SHELL_VERBOSITY'] = $shellVerbosity;
- }
- protected function doRunCommand(Command $command, InputInterface $input, OutputInterface $output)
- {
- foreach ($command->getHelperSet() as $helper) {
- if ($helper instanceof InputAwareInterface) {
- $helper->setInput($input);
- }
- }
- if ($command instanceof SignalableCommandInterface && ($this->signalsToDispatchEvent || $command->getSubscribedSignals())) {
- if (!$this->signalRegistry) {
- 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.');
- }
- if (Terminal::hasSttyAvailable()) {
- $sttyMode = shell_exec('stty -g');
- foreach ([\SIGINT, \SIGTERM] as $signal) {
- $this->signalRegistry->register($signal, static function () use ($sttyMode) {
- shell_exec('stty '.$sttyMode);
- });
- }
- }
- if ($this->dispatcher) {
- foreach ($this->signalsToDispatchEvent as $signal) {
- $event = new ConsoleSignalEvent($command, $input, $output, $signal);
- $this->signalRegistry->register($signal, function ($signal, $hasNext) use ($event) {
- $this->dispatcher->dispatch($event, ConsoleEvents::SIGNAL);
- if (!$hasNext) {
- if (!\in_array($signal, [\SIGUSR1, \SIGUSR2], true)) {
- exit(0);
- }
- }
- });
- }
- }
- foreach ($command->getSubscribedSignals() as $signal) {
- $this->signalRegistry->register($signal, [$command, 'handleSignal']);
- }
- }
- if (null === $this->dispatcher) {
- return $command->run($input, $output);
- }
- try {
- $command->mergeApplicationDefinition();
- $input->bind($command->getDefinition());
- } catch (ExceptionInterface $e) {
- }
- $event = new ConsoleCommandEvent($command, $input, $output);
- $e = null;
- try {
- $this->dispatcher->dispatch($event, ConsoleEvents::COMMAND);
- if ($event->commandShouldRun()) {
- $exitCode = $command->run($input, $output);
- } else {
- $exitCode = ConsoleCommandEvent::RETURN_CODE_DISABLED;
- }
- } catch (\Throwable $e) {
- $event = new ConsoleErrorEvent($input, $output, $e, $command);
- $this->dispatcher->dispatch($event, ConsoleEvents::ERROR);
- $e = $event->getError();
- if (0 === $exitCode = $event->getExitCode()) {
- $e = null;
- }
- }
- $event = new ConsoleTerminateEvent($command, $input, $output, $exitCode);
- $this->dispatcher->dispatch($event, ConsoleEvents::TERMINATE);
- if (null !== $e) {
- throw $e;
- }
- return $event->getExitCode();
- }
- protected function getCommandName(InputInterface $input)
- {
- return $this->singleCommand ? $this->defaultCommand : $input->getFirstArgument();
- }
- protected function getDefaultInputDefinition()
- {
- return new InputDefinition([
- new InputArgument('command', InputArgument::REQUIRED, 'The command to execute'),
- 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'),
- new InputOption('--quiet', '-q', InputOption::VALUE_NONE, 'Do not output any message'),
- 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'),
- new InputOption('--version', '-V', InputOption::VALUE_NONE, 'Display this application version'),
- new InputOption('--ansi', '', InputOption::VALUE_NEGATABLE, 'Force (or disable --no-ansi) ANSI output', null),
- new InputOption('--no-interaction', '-n', InputOption::VALUE_NONE, 'Do not ask any interactive question'),
- ]);
- }
- protected function getDefaultCommands()
- {
- return [new HelpCommand(), new ListCommand(), new CompleteCommand(), new DumpCompletionCommand()];
- }
- protected function getDefaultHelperSet()
- {
- return new HelperSet([
- new FormatterHelper(),
- new DebugFormatterHelper(),
- new ProcessHelper(),
- new QuestionHelper(),
- ]);
- }
- private function getAbbreviationSuggestions(array $abbrevs): string
- {
- return ' '.implode("\n ", $abbrevs);
- }
- public function extractNamespace(string $name, int $limit = null)
- {
- $parts = explode(':', $name, -1);
- return implode(':', null === $limit ? $parts : \array_slice($parts, 0, $limit));
- }
- private function findAlternatives(string $name, iterable $collection): array
- {
- $threshold = 1e3;
- $alternatives = [];
- $collectionParts = [];
- foreach ($collection as $item) {
- $collectionParts[$item] = explode(':', $item);
- }
- foreach (explode(':', $name) as $i => $subname) {
- foreach ($collectionParts as $collectionName => $parts) {
- $exists = isset($alternatives[$collectionName]);
- if (!isset($parts[$i]) && $exists) {
- $alternatives[$collectionName] += $threshold;
- continue;
- } elseif (!isset($parts[$i])) {
- continue;
- }
- $lev = levenshtein($subname, $parts[$i]);
- if ($lev <= \strlen($subname) / 3 || '' !== $subname && str_contains($parts[$i], $subname)) {
- $alternatives[$collectionName] = $exists ? $alternatives[$collectionName] + $lev : $lev;
- } elseif ($exists) {
- $alternatives[$collectionName] += $threshold;
- }
- }
- }
- foreach ($collection as $item) {
- $lev = levenshtein($name, $item);
- if ($lev <= \strlen($name) / 3 || str_contains($item, $name)) {
- $alternatives[$item] = isset($alternatives[$item]) ? $alternatives[$item] - $lev : $lev;
- }
- }
- $alternatives = array_filter($alternatives, function ($lev) use ($threshold) { return $lev < 2 * $threshold; });
- ksort($alternatives, \SORT_NATURAL | \SORT_FLAG_CASE);
- return array_keys($alternatives);
- }
- public function setDefaultCommand(string $commandName, bool $isSingleCommand = false)
- {
- $this->defaultCommand = explode('|', ltrim($commandName, '|'))[0];
- if ($isSingleCommand) {
- $this->find($commandName);
- $this->singleCommand = true;
- }
- return $this;
- }
- public function isSingleCommand(): bool
- {
- return $this->singleCommand;
- }
- private function splitStringByWidth(string $string, int $width): array
- {
- if (false === $encoding = mb_detect_encoding($string, null, true)) {
- return str_split($string, $width);
- }
- $utf8String = mb_convert_encoding($string, 'utf8', $encoding);
- $lines = [];
- $line = '';
- $offset = 0;
- while (preg_match('/.{1,10000}/u', $utf8String, $m, 0, $offset)) {
- $offset += \strlen($m[0]);
- foreach (preg_split('//u', $m[0]) as $char) {
- if (mb_strwidth($line.$char, 'utf8') <= $width) {
- $line .= $char;
- continue;
- }
- $lines[] = str_pad($line, $width);
- $line = $char;
- }
- }
- $lines[] = \count($lines) ? str_pad($line, $width) : $line;
- mb_convert_variables($encoding, 'utf8', $lines);
- return $lines;
- }
- private function extractAllNamespaces(string $name): array
- {
- $parts = explode(':', $name, -1);
- $namespaces = [];
- foreach ($parts as $part) {
- if (\count($namespaces)) {
- $namespaces[] = end($namespaces).':'.$part;
- } else {
- $namespaces[] = $part;
- }
- }
- return $namespaces;
- }
- private function init()
- {
- if ($this->initialized) {
- return;
- }
- $this->initialized = true;
- foreach ($this->getDefaultCommands() as $command) {
- $this->add($command);
- }
- }
- }
- <?php
- namespace Symfony\Component\Console\Attribute;
- #[\Attribute(\Attribute::TARGET_CLASS)]
- class AsCommand
- {
- public function __construct(
- public string $name,
- public ?string $description = null,
- array $aliases = [],
- bool $hidden = false,
- ) {
- if (!$hidden && !$aliases) {
- return;
- }
- $name = explode('|', $name);
- $name = array_merge($name, $aliases);
- if ($hidden && '' !== $name[0]) {
- array_unshift($name, '');
- }
- $this->name = implode('|', $name);
- }
- }
- <?php
- namespace Symfony\Component\Console\CI;
- use Symfony\Component\Console\Output\OutputInterface;
- class GithubActionReporter
- {
- private $output;
- private const ESCAPED_DATA = [
- '%' => '%25',
- "\r" => '%0D',
- "\n" => '%0A',
- ];
- private const ESCAPED_PROPERTIES = [
- '%' => '%25',
- "\r" => '%0D',
- "\n" => '%0A',
- ':' => '%3A',
- ',' => '%2C',
- ];
- public function __construct(OutputInterface $output)
- {
- $this->output = $output;
- }
- public static function isGithubActionEnvironment(): bool
- {
- return false !== getenv('GITHUB_ACTIONS');
- }
- public function error(string $message, string $file = null, int $line = null, int $col = null): void
- {
- $this->log('error', $message, $file, $line, $col);
- }
- public function warning(string $message, string $file = null, int $line = null, int $col = null): void
- {
- $this->log('warning', $message, $file, $line, $col);
- }
- public function debug(string $message, string $file = null, int $line = null, int $col = null): void
- {
- $this->log('debug', $message, $file, $line, $col);
- }
- private function log(string $type, string $message, string $file = null, int $line = null, int $col = null): void
- {
- $message = strtr($message, self::ESCAPED_DATA);
- if (!$file) {
- $this->output->writeln(sprintf('::%s::%s', $type, $message));
- return;
- }
- $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));
- }
- }
- <?php
- namespace Symfony\Component\Console;
- use Symfony\Component\Console\Exception\InvalidArgumentException;
- final class Color
- {
- private const COLORS = [
- 'black' => 0,
- 'red' => 1,
- 'green' => 2,
- 'yellow' => 3,
- 'blue' => 4,
- 'magenta' => 5,
- 'cyan' => 6,
- 'white' => 7,
- 'default' => 9,
- ];
- private const BRIGHT_COLORS = [
- 'gray' => 0,
- 'bright-red' => 1,
- 'bright-green' => 2,
- 'bright-yellow' => 3,
- 'bright-blue' => 4,
- 'bright-magenta' => 5,
- 'bright-cyan' => 6,
- 'bright-white' => 7,
- ];
- private const AVAILABLE_OPTIONS = [
- 'bold' => ['set' => 1, 'unset' => 22],
- 'underscore' => ['set' => 4, 'unset' => 24],
- 'blink' => ['set' => 5, 'unset' => 25],
- 'reverse' => ['set' => 7, 'unset' => 27],
- 'conceal' => ['set' => 8, 'unset' => 28],
- ];
- private $foreground;
- private $background;
- private $options = [];
- public function __construct(string $foreground = '', string $background = '', array $options = [])
- {
- $this->foreground = $this->parseColor($foreground);
- $this->background = $this->parseColor($background, true);
- foreach ($options as $option) {
- if (!isset(self::AVAILABLE_OPTIONS[$option])) {
- throw new InvalidArgumentException(sprintf('Invalid option specified: "%s". Expected one of (%s).', $option, implode(', ', array_keys(self::AVAILABLE_OPTIONS))));
- }
- $this->options[$option] = self::AVAILABLE_OPTIONS[$option];
- }
- }
- public function apply(string $text): string
- {
- return $this->set().$text.$this->unset();
- }
- public function set(): string
- {
- $setCodes = [];
- if ('' !== $this->foreground) {
- $setCodes[] = $this->foreground;
- }
- if ('' !== $this->background) {
- $setCodes[] = $this->background;
- }
- foreach ($this->options as $option) {
- $setCodes[] = $option['set'];
- }
- if (0 === \count($setCodes)) {
- return '';
- }
- return sprintf("\033[%sm", implode(';', $setCodes));
- }
- public function unset(): string
- {
- $unsetCodes = [];
- if ('' !== $this->foreground) {
- $unsetCodes[] = 39;
- }
- if ('' !== $this->background) {
- $unsetCodes[] = 49;
- }
- foreach ($this->options as $option) {
- $unsetCodes[] = $option['unset'];
- }
- if (0 === \count($unsetCodes)) {
- return '';
- }
- return sprintf("\033[%sm", implode(';', $unsetCodes));
- }
- private function parseColor(string $color, bool $background = false): string
- {
- if ('' === $color) {
- return '';
- }
- if ('#' === $color[0]) {
- $color = substr($color, 1);
- if (3 === \strlen($color)) {
- $color = $color[0].$color[0].$color[1].$color[1].$color[2].$color[2];
- }
- if (6 !== \strlen($color)) {
- throw new InvalidArgumentException(sprintf('Invalid "%s" color.', $color));
- }
- return ($background ? '4' : '3').$this->convertHexColorToAnsi(hexdec($color));
- }
- if (isset(self::COLORS[$color])) {
- return ($background ? '4' : '3').self::COLORS[$color];
- }
- if (isset(self::BRIGHT_COLORS[$color])) {
- return ($background ? '10' : '9').self::BRIGHT_COLORS[$color];
- }
- throw new InvalidArgumentException(sprintf('Invalid "%s" color; expected one of (%s).', $color, implode(', ', array_merge(array_keys(self::COLORS), array_keys(self::BRIGHT_COLORS)))));
- }
- private function convertHexColorToAnsi(int $color): string
- {
- $r = ($color >> 16) & 255;
- $g = ($color >> 8) & 255;
- $b = $color & 255;
- if ('truecolor' !== getenv('COLORTERM')) {
- return (string) $this->degradeHexColorToAnsi($r, $g, $b);
- }
- return sprintf('8;2;%d;%d;%d', $r, $g, $b);
- }
- private function degradeHexColorToAnsi(int $r, int $g, int $b): int
- {
- if (0 === round($this->getSaturation($r, $g, $b) / 50)) {
- return 0;
- }
- return (round($b / 255) << 2) | (round($g / 255) << 1) | round($r / 255);
- }
- private function getSaturation(int $r, int $g, int $b): int
- {
- $r = $r / 255;
- $g = $g / 255;
- $b = $b / 255;
- $v = max($r, $g, $b);
- if (0 === $diff = $v - min($r, $g, $b)) {
- return 0;
- }
- return (int) $diff * 100 / $v;
- }
- }
- <?php
- namespace Symfony\Component\Console\Command;
- use Symfony\Component\Console\Application;
- use Symfony\Component\Console\Attribute\AsCommand;
- use Symfony\Component\Console\Completion\CompletionInput;
- use Symfony\Component\Console\Completion\CompletionSuggestions;
- use Symfony\Component\Console\Exception\ExceptionInterface;
- use Symfony\Component\Console\Exception\InvalidArgumentException;
- use Symfony\Component\Console\Exception\LogicException;
- use Symfony\Component\Console\Helper\HelperSet;
- use Symfony\Component\Console\Input\InputArgument;
- use Symfony\Component\Console\Input\InputDefinition;
- use Symfony\Component\Console\Input\InputInterface;
- use Symfony\Component\Console\Input\InputOption;
- use Symfony\Component\Console\Output\OutputInterface;
- class Command
- {
- public const SUCCESS = 0;
- public const FAILURE = 1;
- public const INVALID = 2;
- protected static $defaultName;
- protected static $defaultDescription;
- private $application;
- private $name;
- private $processTitle;
- private $aliases = [];
- private $definition;
- private $hidden = false;
- private $help = '';
- private $description = '';
- private $fullDefinition;
- private $ignoreValidationErrors = false;
- private $code;
- private $synopsis = [];
- private $usages = [];
- private $helperSet;
- public static function getDefaultName()
- {
- $class = static::class;
- if (\PHP_VERSION_ID >= 80000 && $attribute = (new \ReflectionClass($class))->getAttributes(AsCommand::class)) {
- return $attribute[0]->newInstance()->name;
- }
- $r = new \ReflectionProperty($class, 'defaultName');
- return $class === $r->class ? static::$defaultName : null;
- }
- public static function getDefaultDescription(): ?string
- {
- $class = static::class;
- if (\PHP_VERSION_ID >= 80000 && $attribute = (new \ReflectionClass($class))->getAttributes(AsCommand::class)) {
- return $attribute[0]->newInstance()->description;
- }
- $r = new \ReflectionProperty($class, 'defaultDescription');
- return $class === $r->class ? static::$defaultDescription : null;
- }
- public function __construct(string $name = null)
- {
- $this->definition = new InputDefinition();
- if (null === $name && null !== $name = static::getDefaultName()) {
- $aliases = explode('|', $name);
- if ('' === $name = array_shift($aliases)) {
- $this->setHidden(true);
- $name = array_shift($aliases);
- }
- $this->setAliases($aliases);
- }
- if (null !== $name) {
- $this->setName($name);
- }
- if ('' === $this->description) {
- $this->setDescription(static::getDefaultDescription() ?? '');
- }
- $this->configure();
- }
- public function ignoreValidationErrors()
- {
- $this->ignoreValidationErrors = true;
- }
- public function setApplication(Application $application = null)
- {
- $this->application = $application;
- if ($application) {
- $this->setHelperSet($application->getHelperSet());
- } else {
- $this->helperSet = null;
- }
- $this->fullDefinition = null;
- }
- public function setHelperSet(HelperSet $helperSet)
- {
- $this->helperSet = $helperSet;
- }
- public function getHelperSet()
- {
- return $this->helperSet;
- }
- public function getApplication()
- {
- return $this->application;
- }
- public function isEnabled()
- {
- return true;
- }
- protected function configure()
- {
- }
- protected function execute(InputInterface $input, OutputInterface $output)
- {
- throw new LogicException('You must override the execute() method in the concrete command class.');
- }
- protected function interact(InputInterface $input, OutputInterface $output)
- {
- }
- protected function initialize(InputInterface $input, OutputInterface $output)
- {
- }
- public function run(InputInterface $input, OutputInterface $output)
- {
- $this->mergeApplicationDefinition();
- try {
- $input->bind($this->getDefinition());
- } catch (ExceptionInterface $e) {
- if (!$this->ignoreValidationErrors) {
- throw $e;
- }
- }
- $this->initialize($input, $output);
- if (null !== $this->processTitle) {
- if (\function_exists('cli_set_process_title')) {
- if (!@cli_set_process_title($this->processTitle)) {
- if ('Darwin' === \PHP_OS) {
- $output->writeln('<comment>Running "cli_set_process_title" as an unprivileged user is not supported on MacOS.</comment>', OutputInterface::VERBOSITY_VERY_VERBOSE);
- } else {
- cli_set_process_title($this->processTitle);
- }
- }
- } elseif (\function_exists('setproctitle')) {
- setproctitle($this->processTitle);
- } elseif (OutputInterface::VERBOSITY_VERY_VERBOSE === $output->getVerbosity()) {
- $output->writeln('<comment>Install the proctitle PECL to be able to change the process title.</comment>');
- }
- }
- if ($input->isInteractive()) {
- $this->interact($input, $output);
- }
- if ($input->hasArgument('command') && null === $input->getArgument('command')) {
- $input->setArgument('command', $this->getName());
- }
- $input->validate();
- if ($this->code) {
- $statusCode = ($this->code)($input, $output);
- } else {
- $statusCode = $this->execute($input, $output);
- if (!\is_int($statusCode)) {
- throw new \TypeError(sprintf('Return value of "%s::execute()" must be of the type int, "%s" returned.', static::class, get_debug_type($statusCode)));
- }
- }
- return is_numeric($statusCode) ? (int) $statusCode : 0;
- }
- public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void
- {
- }
- public function setCode(callable $code)
- {
- if ($code instanceof \Closure) {
- $r = new \ReflectionFunction($code);
- if (null === $r->getClosureThis()) {
- set_error_handler(static function () {});
- try {
- if ($c = \Closure::bind($code, $this)) {
- $code = $c;
- }
- } finally {
- restore_error_handler();
- }
- }
- }
- $this->code = $code;
- return $this;
- }
- public function mergeApplicationDefinition(bool $mergeArgs = true)
- {
- if (null === $this->application) {
- return;
- }
- $this->fullDefinition = new InputDefinition();
- $this->fullDefinition->setOptions($this->definition->getOptions());
- $this->fullDefinition->addOptions($this->application->getDefinition()->getOptions());
- if ($mergeArgs) {
- $this->fullDefinition->setArguments($this->application->getDefinition()->getArguments());
- $this->fullDefinition->addArguments($this->definition->getArguments());
- } else {
- $this->fullDefinition->setArguments($this->definition->getArguments());
- }
- }
- public function setDefinition($definition)
- {
- if ($definition instanceof InputDefinition) {
- $this->definition = $definition;
- } else {
- $this->definition->setDefinition($definition);
- }
- $this->fullDefinition = null;
- return $this;
- }
- public function getDefinition()
- {
- return $this->fullDefinition ?? $this->getNativeDefinition();
- }
- public function getNativeDefinition()
- {
- if (null === $this->definition) {
- throw new LogicException(sprintf('Command class "%s" is not correctly initialized. You probably forgot to call the parent constructor.', static::class));
- }
- return $this->definition;
- }
- public function addArgument(string $name, int $mode = null, string $description = '', $default = null)
- {
- $this->definition->addArgument(new InputArgument($name, $mode, $description, $default));
- if (null !== $this->fullDefinition) {
- $this->fullDefinition->addArgument(new InputArgument($name, $mode, $description, $default));
- }
- return $this;
- }
- public function addOption(string $name, $shortcut = null, int $mode = null, string $description = '', $default = null)
- {
- $this->definition->addOption(new InputOption($name, $shortcut, $mode, $description, $default));
- if (null !== $this->fullDefinition) {
- $this->fullDefinition->addOption(new InputOption($name, $shortcut, $mode, $description, $default));
- }
- return $this;
- }
- public function setName(string $name)
- {
- $this->validateName($name);
- $this->name = $name;
- return $this;
- }
- public function setProcessTitle(string $title)
- {
- $this->processTitle = $title;
- return $this;
- }
- public function getName()
- {
- return $this->name;
- }
- public function setHidden(bool $hidden )
- {
- $this->hidden = $hidden;
- return $this;
- }
- public function isHidden()
- {
- return $this->hidden;
- }
- public function setDescription(string $description)
- {
- $this->description = $description;
- return $this;
- }
- public function getDescription()
- {
- return $this->description;
- }
- public function setHelp(string $help)
- {
- $this->help = $help;
- return $this;
- }
- public function getHelp()
- {
- return $this->help;
- }
- public function getProcessedHelp()
- {
- $name = $this->name;
- $isSingleCommand = $this->application && $this->application->isSingleCommand();
- $placeholders = [
- '%command.name%',
- '%command.full_name%',
- ];
- $replacements = [
- $name,
- $isSingleCommand ? $_SERVER['PHP_SELF'] : $_SERVER['PHP_SELF'].' '.$name,
- ];
- return str_replace($placeholders, $replacements, $this->getHelp() ?: $this->getDescription());
- }
- public function setAliases(iterable $aliases)
- {
- $list = [];
- foreach ($aliases as $alias) {
- $this->validateName($alias);
- $list[] = $alias;
- }
- $this->aliases = \is_array($aliases) ? $aliases : $list;
- return $this;
- }
- public function getAliases()
- {
- return $this->aliases;
- }
- public function getSynopsis(bool $short = false)
- {
- $key = $short ? 'short' : 'long';
- if (!isset($this->synopsis[$key])) {
- $this->synopsis[$key] = trim(sprintf('%s %s', $this->name, $this->definition->getSynopsis($short)));
- }
- return $this->synopsis[$key];
- }
- public function addUsage(string $usage)
- {
- if (!str_starts_with($usage, $this->name)) {
- $usage = sprintf('%s %s', $this->name, $usage);
- }
- $this->usages[] = $usage;
- return $this;
- }
- public function getUsages()
- {
- return $this->usages;
- }
- public function getHelper(string $name)
- {
- if (null === $this->helperSet) {
- 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));
- }
- return $this->helperSet->get($name);
- }
- private function validateName(string $name)
- {
- if (!preg_match('/^[^\:]++(\:[^\:]++)*$/', $name)) {
- throw new InvalidArgumentException(sprintf('Command name "%s" is invalid.', $name));
- }
- }
- }
- <?php
- namespace Symfony\Component\Console\Command;
- use Symfony\Component\Console\Completion\CompletionInput;
- use Symfony\Component\Console\Completion\CompletionSuggestions;
- use Symfony\Component\Console\Completion\Output\BashCompletionOutput;
- use Symfony\Component\Console\Completion\Output\CompletionOutputInterface;
- use Symfony\Component\Console\Exception\CommandNotFoundException;
- use Symfony\Component\Console\Exception\ExceptionInterface;
- use Symfony\Component\Console\Input\InputInterface;
- use Symfony\Component\Console\Input\InputOption;
- use Symfony\Component\Console\Output\OutputInterface;
- final class CompleteCommand extends Command
- {
- protected static $defaultName = '|_complete';
- protected static $defaultDescription = 'Internal command to provide shell completion suggestions';
- private $completionOutputs;
- private $isDebug = false;
- public function __construct(array $completionOutputs = [])
- {
- $this->completionOutputs = $completionOutputs + ['bash' => BashCompletionOutput::class];
- parent::__construct();
- }
- protected function configure(): void
- {
- $this
- ->addOption('shell', 's', InputOption::VALUE_REQUIRED, 'The shell type ("'.implode('", "', array_keys($this->completionOutputs)).'")')
- ->addOption('input', 'i', InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'An array of input tokens (e.g. COMP_WORDS or argv)')
- ->addOption('current', 'c', InputOption::VALUE_REQUIRED, 'The index of the "input" array that the cursor is in (e.g. COMP_CWORD)')
- ->addOption('symfony', 'S', InputOption::VALUE_REQUIRED, 'The version of the completion script')
- ;
- }
- protected function initialize(InputInterface $input, OutputInterface $output)
- {
- $this->isDebug = filter_var(getenv('SYMFONY_COMPLETION_DEBUG'), \FILTER_VALIDATE_BOOLEAN);
- }
- protected function execute(InputInterface $input, OutputInterface $output): int
- {
- try {
- $shell = $input->getOption('shell');
- if (!$shell) {
- throw new \RuntimeException('The "--shell" option must be set.');
- }
- if (!$completionOutput = $this->completionOutputs[$shell] ?? false) {
- throw new \RuntimeException(sprintf('Shell completion is not supported for your shell: "%s" (supported: "%s").', $shell, implode('", "', array_keys($this->completionOutputs))));
- }
- $completionInput = $this->createCompletionInput($input);
- $suggestions = new CompletionSuggestions();
- $this->log([
- '',
- '<comment>'.date('Y-m-d H:i:s').'</>',
- '<info>Input:</> <comment>("|" indicates the cursor position)</>',
- ' '.(string) $completionInput,
- '<info>Command:</>',
- ' '.(string) implode(' ', $_SERVER['argv']),
- '<info>Messages:</>',
- ]);
- $command = $this->findCommand($completionInput, $output);
- if (null === $command) {
- $this->log(' No command found, completing using the Application class.');
- $this->getApplication()->complete($completionInput, $suggestions);
- } elseif (
- $completionInput->mustSuggestArgumentValuesFor('command')
- && $command->getName() !== $completionInput->getCompletionValue()
- && !\in_array($completionInput->getCompletionValue(), $command->getAliases(), true)
- ) {
- $this->log(' No command found, completing using the Application class.');
- $suggestions->suggestValues(array_filter(array_merge([$command->getName()], $command->getAliases())));
- } else {
- $command->mergeApplicationDefinition();
- $completionInput->bind($command->getDefinition());
- if (CompletionInput::TYPE_OPTION_NAME === $completionInput->getCompletionType()) {
- $this->log(' Completing option names for the <comment>'.\get_class($command instanceof LazyCommand ? $command->getCommand() : $command).'</> command.');
- $suggestions->suggestOptions($command->getDefinition()->getOptions());
- } else {
- $this->log([
- ' Completing using the <comment>'.\get_class($command instanceof LazyCommand ? $command->getCommand() : $command).'</> class.',
- ' Completing <comment>'.$completionInput->getCompletionType().'</> for <comment>'.$completionInput->getCompletionName().'</>',
- ]);
- if (null !== $compval = $completionInput->getCompletionValue()) {
- $this->log(' Current value: <comment>'.$compval.'</>');
- }
- $command->complete($completionInput, $suggestions);
- }
- }
- $completionOutput = new $completionOutput();
- $this->log('<info>Suggestions:</>');
- if ($options = $suggestions->getOptionSuggestions()) {
- $this->log(' --'.implode(' --', array_map(function ($o) { return $o->getName(); }, $options)));
- } elseif ($values = $suggestions->getValueSuggestions()) {
- $this->log(' '.implode(' ', $values));
- } else {
- $this->log(' <comment>No suggestions were provided</>');
- }
- $completionOutput->write($suggestions, $output);
- } catch (\Throwable $e) {
- $this->log([
- '<error>Error!</error>',
- (string) $e,
- ]);
- if ($output->isDebug()) {
- throw $e;
- }
- return self::FAILURE;
- }
- return self::SUCCESS;
- }
- private function createCompletionInput(InputInterface $input): CompletionInput
- {
- $currentIndex = $input->getOption('current');
- if (!$currentIndex || !ctype_digit($currentIndex)) {
- throw new \RuntimeException('The "--current" option must be set and it must be an integer.');
- }
- $completionInput = CompletionInput::fromTokens($input->getOption('input'), (int) $currentIndex);
- try {
- $completionInput->bind($this->getApplication()->getDefinition());
- } catch (ExceptionInterface $e) {
- }
- return $completionInput;
- }
- private function findCommand(CompletionInput $completionInput, OutputInterface $output): ?Command
- {
- try {
- $inputName = $completionInput->getFirstArgument();
- if (null === $inputName) {
- return null;
- }
- return $this->getApplication()->find($inputName);
- } catch (CommandNotFoundException $e) {
- }
- return null;
- }
- private function log($messages): void
- {
- if (!$this->isDebug) {
- return;
- }
- $commandName = basename($_SERVER['argv'][0]);
- file_put_contents(sys_get_temp_dir().'/sf_'.$commandName.'.log', implode(\PHP_EOL, (array) $messages).\PHP_EOL, \FILE_APPEND);
- }
- }
- <?php
- namespace Symfony\Component\Console\Command;
- use Symfony\Component\Console\Completion\CompletionInput;
- use Symfony\Component\Console\Completion\CompletionSuggestions;
- use Symfony\Component\Console\Input\InputArgument;
- use Symfony\Component\Console\Input\InputInterface;
- use Symfony\Component\Console\Input\InputOption;
- use Symfony\Component\Console\Output\ConsoleOutputInterface;
- use Symfony\Component\Console\Output\OutputInterface;
- use Symfony\Component\Process\Process;
- final class DumpCompletionCommand extends Command
- {
- protected static $defaultName = 'completion';
- protected static $defaultDescription = 'Dump the shell completion script';
- public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void
- {
- if ($input->mustSuggestArgumentValuesFor('shell')) {
- $suggestions->suggestValues($this->getSupportedShells());
- }
- }
- protected function configure()
- {
- $fullCommand = $_SERVER['PHP_SELF'];
- $commandName = basename($fullCommand);
- $fullCommand = @realpath($fullCommand) ?: $fullCommand;
- $this
- ->setHelp(<<<EOH
- The <info>%command.name%</> command dumps the shell completion script required
- to use shell autocompletion (currently only bash completion is supported).
- <comment>Static installation
- -------------------</>
- Dump the script to a global completion file and restart your shell:
- <info>%command.full_name% bash | sudo tee /etc/bash_completion.d/{$commandName}</>
- Or dump the script to a local file and source it:
- <info>%command.full_name% bash > completion.sh</>
- <comment># source the file whenever you use the project</>
- <info>source completion.sh</>
- <comment># or add this line at the end of your "~/.bashrc" file:</>
- <info>source /path/to/completion.sh</>
- <comment>Dynamic installation
- --------------------</>
- Add this to the end of your shell configuration file (e.g. <info>"~/.bashrc"</>):
- <info>eval "$({$fullCommand} completion bash)"</>
- EOH
- )
- ->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')
- ->addOption('debug', null, InputOption::VALUE_NONE, 'Tail the completion debug log')
- ;
- }
- protected function execute(InputInterface $input, OutputInterface $output): int
- {
- $commandName = basename($_SERVER['argv'][0]);
- if ($input->getOption('debug')) {
- $this->tailDebugLog($commandName, $output);
- return self::SUCCESS;
- }
- $shell = $input->getArgument('shell') ?? self::guessShell();
- $completionFile = __DIR__.'/../Resources/completion.'.$shell;
- if (!file_exists($completionFile)) {
- $supportedShells = $this->getSupportedShells();
- ($output instanceof ConsoleOutputInterface ? $output->getErrorOutput() : $output)
- ->writeln(sprintf('<error>Detected shell "%s", which is not supported by Symfony shell completion (supported shells: "%s").</>', $shell, implode('", "', $supportedShells)));
- return self::INVALID;
- }
- $output->write(str_replace(['{{ COMMAND_NAME }}', '{{ VERSION }}'], [$commandName, $this->getApplication()->getVersion()], file_get_contents($completionFile)));
- return self::SUCCESS;
- }
- private static function guessShell(): string
- {
- return basename($_SERVER['SHELL'] ?? '');
- }
- private function tailDebugLog(string $commandName, OutputInterface $output): void
- {
- $debugFile = sys_get_temp_dir().'/sf_'.$commandName.'.log';
- if (!file_exists($debugFile)) {
- touch($debugFile);
- }
- $process = new Process(['tail', '-f', $debugFile], null, null, null, 0);
- $process->run(function (string $type, string $line) use ($output): void {
- $output->write($line);
- });
- }
- private function getSupportedShells(): array
- {
- return array_map(function ($f) {
- return pathinfo($f, \PATHINFO_EXTENSION);
- }, glob(__DIR__.'/../Resources/completion.*'));
- }
- }
- <?php
- namespace Symfony\Component\Console\Command;
- use Symfony\Component\Console\Completion\CompletionInput;
- use Symfony\Component\Console\Completion\CompletionSuggestions;
- use Symfony\Component\Console\Descriptor\ApplicationDescription;
- use Symfony\Component\Console\Helper\DescriptorHelper;
- use Symfony\Component\Console\Input\InputArgument;
- use Symfony\Component\Console\Input\InputInterface;
- use Symfony\Component\Console\Input\InputOption;
- use Symfony\Component\Console\Output\OutputInterface;
- class HelpCommand extends Command
- {
- private $command;
- protected function configure()
- {
- $this->ignoreValidationErrors();
- $this
- ->setName('help')
- ->setDefinition([
- new InputArgument('command_name', InputArgument::OPTIONAL, 'The command name', 'help'),
- new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt'),
- new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command help'),
- ])
- ->setDescription('Display help for a command')
- ->setHelp(<<<'EOF'
- The <info>%command.name%</info> command displays help for a given command:
- <info>%command.full_name% list</info>
- You can also output the help in other formats by using the <comment>--format</comment> option:
- <info>%command.full_name% --format=xml list</info>
- To display the list of available commands, please use the <info>list</info> command.
- EOF
- )
- ;
- }
- public function setCommand(Command $command)
- {
- $this->command = $command;
- }
- protected function execute(InputInterface $input, OutputInterface $output)
- {
- if (null === $this->command) {
- $this->command = $this->getApplication()->find($input->getArgument('command_name'));
- }
- $helper = new DescriptorHelper();
- $helper->describe($output, $this->command, [
- 'format' => $input->getOption('format'),
- 'raw_text' => $input->getOption('raw'),
- ]);
- $this->command = null;
- return 0;
- }
- public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void
- {
- if ($input->mustSuggestArgumentValuesFor('command_name')) {
- $descriptor = new ApplicationDescription($this->getApplication());
- $suggestions->suggestValues(array_keys($descriptor->getCommands()));
- return;
- }
- if ($input->mustSuggestOptionValuesFor('format')) {
- $helper = new DescriptorHelper();
- $suggestions->suggestValues($helper->getFormats());
- }
- }
- }
- <?php
- namespace Symfony\Component\Console\Command;
- use Symfony\Component\Console\Application;
- use Symfony\Component\Console\Completion\CompletionInput;
- use Symfony\Component\Console\Completion\CompletionSuggestions;
- use Symfony\Component\Console\Helper\HelperSet;
- use Symfony\Component\Console\Input\InputDefinition;
- use Symfony\Component\Console\Input\InputInterface;
- use Symfony\Component\Console\Output\OutputInterface;
- final class LazyCommand extends Command
- {
- private $command;
- private $isEnabled;
- public function __construct(string $name, array $aliases, string $description, bool $isHidden, \Closure $commandFactory, ?bool $isEnabled = true)
- {
- $this->setName($name)
- ->setAliases($aliases)
- ->setHidden($isHidden)
- ->setDescription($description);
- $this->command = $commandFactory;
- $this->isEnabled = $isEnabled;
- }
- public function ignoreValidationErrors(): void
- {
- $this->getCommand()->ignoreValidationErrors();
- }
- public function setApplication(Application $application = null): void
- {
- if ($this->command instanceof parent) {
- $this->command->setApplication($application);
- }
- parent::setApplication($application);
- }
- public function setHelperSet(HelperSet $helperSet): void
- {
- if ($this->command instanceof parent) {
- $this->command->setHelperSet($helperSet);
- }
- parent::setHelperSet($helperSet);
- }
- public function isEnabled(): bool
- {
- return $this->isEnabled ?? $this->getCommand()->isEnabled();
- }
- public function run(InputInterface $input, OutputInterface $output): int
- {
- return $this->getCommand()->run($input, $output);
- }
- public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void
- {
- $this->getCommand()->complete($input, $suggestions);
- }
- public function setCode(callable $code): self
- {
- $this->getCommand()->setCode($code);
- return $this;
- }
- public function mergeApplicationDefinition(bool $mergeArgs = true): void
- {
- $this->getCommand()->mergeApplicationDefinition($mergeArgs);
- }
- public function setDefinition($definition): self
- {
- $this->getCommand()->setDefinition($definition);
- return $this;
- }
- public function getDefinition(): InputDefinition
- {
- return $this->getCommand()->getDefinition();
- }
- public function getNativeDefinition(): InputDefinition
- {
- return $this->getCommand()->getNativeDefinition();
- }
- public function addArgument(string $name, int $mode = null, string $description = '', $default = null): self
- {
- $this->getCommand()->addArgument($name, $mode, $description, $default);
- return $this;
- }
- public function addOption(string $name, $shortcut = null, int $mode = null, string $description = '', $default = null): self
- {
- $this->getCommand()->addOption($name, $shortcut, $mode, $description, $default);
- return $this;
- }
- public function setProcessTitle(string $title): self
- {
- $this->getCommand()->setProcessTitle($title);
- return $this;
- }
- public function setHelp(string $help): self
- {
- $this->getCommand()->setHelp($help);
- return $this;
- }
- public function getHelp(): string
- {
- return $this->getCommand()->getHelp();
- }
- public function getProcessedHelp(): string
- {
- return $this->getCommand()->getProcessedHelp();
- }
- public function getSynopsis(bool $short = false): string
- {
- return $this->getCommand()->getSynopsis($short);
- }
- public function addUsage(string $usage): self
- {
- $this->getCommand()->addUsage($usage);
- return $this;
- }
- public function getUsages(): array
- {
- return $this->getCommand()->getUsages();
- }
- public function getHelper(string $name)
- {
- return $this->getCommand()->getHelper($name);
- }
- public function getCommand(): parent
- {
- if (!$this->command instanceof \Closure) {
- return $this->command;
- }
- $command = $this->command = ($this->command)();
- $command->setApplication($this->getApplication());
- if (null !== $this->getHelperSet()) {
- $command->setHelperSet($this->getHelperSet());
- }
- $command->setName($this->getName())
- ->setAliases($this->getAliases())
- ->setHidden($this->isHidden())
- ->setDescription($this->getDescription());
- $command->getDefinition();
- return $command;
- }
- }
- <?php
- namespace Symfony\Component\Console\Command;
- use Symfony\Component\Console\Completion\CompletionInput;
- use Symfony\Component\Console\Completion\CompletionSuggestions;
- use Symfony\Component\Console\Descriptor\ApplicationDescription;
- use Symfony\Component\Console\Helper\DescriptorHelper;
- use Symfony\Component\Console\Input\InputArgument;
- use Symfony\Component\Console\Input\InputInterface;
- use Symfony\Component\Console\Input\InputOption;
- use Symfony\Component\Console\Output\OutputInterface;
- class ListCommand extends Command
- {
- protected function configure()
- {
- $this
- ->setName('list')
- ->setDefinition([
- new InputArgument('namespace', InputArgument::OPTIONAL, 'The namespace name'),
- new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command list'),
- new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt'),
- new InputOption('short', null, InputOption::VALUE_NONE, 'To skip describing commands\' arguments'),
- ])
- ->setDescription('List commands')
- ->setHelp(<<<'EOF'
- The <info>%command.name%</info> command lists all commands:
- <info>%command.full_name%</info>
- You can also display the commands for a specific namespace:
- <info>%command.full_name% test</info>
- You can also output the information in other formats by using the <comment>--format</comment> option:
- <info>%command.full_name% --format=xml</info>
- It's also possible to get raw list of commands (useful for embedding command runner):
- <info>%command.full_name% --raw</info>
- EOF
- )
- ;
- }
- protected function execute(InputInterface $input, OutputInterface $output)
- {
- $helper = new DescriptorHelper();
- $helper->describe($output, $this->getApplication(), [
- 'format' => $input->getOption('format'),
- 'raw_text' => $input->getOption('raw'),
- 'namespace' => $input->getArgument('namespace'),
- 'short' => $input->getOption('short'),
- ]);
- return 0;
- }
- public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void
- {
- if ($input->mustSuggestArgumentValuesFor('namespace')) {
- $descriptor = new ApplicationDescription($this->getApplication());
- $suggestions->suggestValues(array_keys($descriptor->getNamespaces()));
- return;
- }
- if ($input->mustSuggestOptionValuesFor('format')) {
- $helper = new DescriptorHelper();
- $suggestions->suggestValues($helper->getFormats());
- }
- }
- }
- <?php
- namespace Symfony\Component\Console\Command;
- use Symfony\Component\Console\Exception\LogicException;
- use Symfony\Component\Lock\LockFactory;
- use Symfony\Component\Lock\LockInterface;
- use Symfony\Component\Lock\Store\FlockStore;
- use Symfony\Component\Lock\Store\SemaphoreStore;
- trait LockableTrait
- {
- private $lock;
- private function lock(string $name = null, bool $blocking = false): bool
- {
- if (!class_exists(SemaphoreStore::class)) {
- throw new LogicException('To enable the locking feature you must install the symfony/lock component.');
- }
- if (null !== $this->lock) {
- throw new LogicException('A lock is already in place.');
- }
- if (SemaphoreStore::isSupported()) {
- $store = new SemaphoreStore();
- } else {
- $store = new FlockStore();
- }
- $this->lock = (new LockFactory($store))->createLock($name ?: $this->getName());
- if (!$this->lock->acquire($blocking)) {
- $this->lock = null;
- return false;
- }
- return true;
- }
- private function release()
- {
- if ($this->lock) {
- $this->lock->release();
- $this->lock = null;
- }
- }
- }
- <?php
- namespace Symfony\Component\Console\Command;
- interface SignalableCommandInterface
- {
- public function getSubscribedSignals(): array;
- public function handleSignal(int $signal): void;
- }
- <?php
- namespace Symfony\Component\Console\CommandLoader;
- use Symfony\Component\Console\Command\Command;
- use Symfony\Component\Console\Exception\CommandNotFoundException;
- interface CommandLoaderInterface
- {
- public function get(string $name);
- public function has(string $name);
- public function getNames();
- }
- <?php
- namespace Symfony\Component\Console\CommandLoader;
- use Psr\Container\ContainerInterface;
- use Symfony\Component\Console\Exception\CommandNotFoundException;
- class ContainerCommandLoader implements CommandLoaderInterface
- {
- private $container;
- private $commandMap;
- public function __construct(ContainerInterface $container, array $commandMap)
- {
- $this->container = $container;
- $this->commandMap = $commandMap;
- }
- public function get(string $name)
- {
- if (!$this->has($name)) {
- throw new CommandNotFoundException(sprintf('Command "%s" does not exist.', $name));
- }
- return $this->container->get($this->commandMap[$name]);
- }
- public function has(string $name)
- {
- return isset($this->commandMap[$name]) && $this->container->has($this->commandMap[$name]);
- }
- public function getNames()
- {
- return array_keys($this->commandMap);
- }
- }
- <?php
- namespace Symfony\Component\Console\CommandLoader;
- use Symfony\Component\Console\Exception\CommandNotFoundException;
- class FactoryCommandLoader implements CommandLoaderInterface
- {
- private $factories;
- public function __construct(array $factories)
- {
- $this->factories = $factories;
- }
- public function has(string $name)
- {
- return isset($this->factories[$name]);
- }
- public function get(string $name)
- {
- if (!isset($this->factories[$name])) {
- throw new CommandNotFoundException(sprintf('Command "%s" does not exist.', $name));
- }
- $factory = $this->factories[$name];
- return $factory();
- }
- public function getNames()
- {
- return array_keys($this->factories);
- }
- }
- <?php
- namespace Symfony\Component\Console\Completion;
- use Symfony\Component\Console\Exception\RuntimeException;
- use Symfony\Component\Console\Input\ArgvInput;
- use Symfony\Component\Console\Input\InputDefinition;
- use Symfony\Component\Console\Input\InputOption;
- final class CompletionInput extends ArgvInput
- {
- public const TYPE_ARGUMENT_VALUE = 'argument_value';
- public const TYPE_OPTION_VALUE = 'option_value';
- public const TYPE_OPTION_NAME = 'option_name';
- public const TYPE_NONE = 'none';
- private $tokens;
- private $currentIndex;
- private $completionType;
- private $completionName = null;
- private $completionValue = '';
- public static function fromString(string $inputStr, int $currentIndex): self
- {
- preg_match_all('/(?<=^|\s)([\'"]?)(.+?)(?<!\\\\)\1(?=$|\s)/', $inputStr, $tokens);
- return self::fromTokens($tokens[0], $currentIndex);
- }
- public static function fromTokens(array $tokens, int $currentIndex): self
- {
- $input = new self($tokens);
- $input->tokens = $tokens;
- $input->currentIndex = $currentIndex;
- return $input;
- }
- public function bind(InputDefinition $definition): void
- {
- parent::bind($definition);
- $relevantToken = $this->getRelevantToken();
- if ('-' === $relevantToken[0]) {
- [$optionToken, $optionValue] = explode('=', $relevantToken, 2) + ['', ''];
- $option = $this->getOptionFromToken($optionToken);
- if (null === $option && !$this->isCursorFree()) {
- $this->completionType = self::TYPE_OPTION_NAME;
- $this->completionValue = $relevantToken;
- return;
- }
- if (null !== $option && $option->acceptValue()) {
- $this->completionType = self::TYPE_OPTION_VALUE;
- $this->completionName = $option->getName();
- $this->completionValue = $optionValue ?: (!str_starts_with($optionToken, '--') ? substr($optionToken, 2) : '');
- return;
- }
- }
- $previousToken = $this->tokens[$this->currentIndex - 1];
- if ('-' === $previousToken[0] && '' !== trim($previousToken, '-')) {
- $previousOption = $this->getOptionFromToken($previousToken);
- if (null !== $previousOption && $previousOption->acceptValue()) {
- $this->completionType = self::TYPE_OPTION_VALUE;
- $this->completionName = $previousOption->getName();
- $this->completionValue = $relevantToken;
- return;
- }
- }
- $this->completionType = self::TYPE_ARGUMENT_VALUE;
- foreach ($this->definition->getArguments() as $argumentName => $argument) {
- if (!isset($this->arguments[$argumentName])) {
- break;
- }
- $argumentValue = $this->arguments[$argumentName];
- $this->completionName = $argumentName;
- if (\is_array($argumentValue)) {
- $this->completionValue = $argumentValue ? $argumentValue[array_key_last($argumentValue)] : null;
- } else {
- $this->completionValue = $argumentValue;
- }
- }
- if ($this->currentIndex >= \count($this->tokens)) {
- if (!isset($this->arguments[$argumentName]) || $this->definition->getArgument($argumentName)->isArray()) {
- $this->completionName = $argumentName;
- $this->completionValue = '';
- } else {
- $this->completionType = self::TYPE_NONE;
- $this->completionName = null;
- $this->completionValue = '';
- }
- }
- }
- public function getCompletionType(): string
- {
- return $this->completionType;
- }
- public function getCompletionName(): ?string
- {
- return $this->completionName;
- }
- public function getCompletionValue(): string
- {
- return $this->completionValue;
- }
- public function mustSuggestOptionValuesFor(string $optionName): bool
- {
- return self::TYPE_OPTION_VALUE === $this->getCompletionType() && $optionName === $this->getCompletionName();
- }
- public function mustSuggestArgumentValuesFor(string $argumentName): bool
- {
- return self::TYPE_ARGUMENT_VALUE === $this->getCompletionType() && $argumentName === $this->getCompletionName();
- }
- protected function parseToken(string $token, bool $parseOptions): bool
- {
- try {
- return parent::parseToken($token, $parseOptions);
- } catch (RuntimeException $e) {
- }
- return $parseOptions;
- }
- private function getOptionFromToken(string $optionToken): ?InputOption
- {
- $optionName = ltrim($optionToken, '-');
- if (!$optionName) {
- return null;
- }
- if ('-' === ($optionToken[1] ?? ' ')) {
- return $this->definition->hasOption($optionName) ? $this->definition->getOption($optionName) : null;
- }
- return $this->definition->hasShortcut($optionName[0]) ? $this->definition->getOptionForShortcut($optionName[0]) : null;
- }
- private function getRelevantToken(): string
- {
- return $this->tokens[$this->isCursorFree() ? $this->currentIndex - 1 : $this->currentIndex];
- }
- private function isCursorFree(): bool
- {
- $nrOfTokens = \count($this->tokens);
- if ($this->currentIndex > $nrOfTokens) {
- throw new \LogicException('Current index is invalid, it must be the number of input tokens or one more.');
- }
- return $this->currentIndex >= $nrOfTokens;
- }
- public function __toString()
- {
- $str = '';
- foreach ($this->tokens as $i => $token) {
- $str .= $token;
- if ($this->currentIndex === $i) {
- $str .= '|';
- }
- $str .= ' ';
- }
- if ($this->currentIndex > $i) {
- $str .= '|';
- }
- return rtrim($str);
- }
- }
- <?php
- namespace Symfony\Component\Console\Completion;
- use Symfony\Component\Console\Input\InputOption;
- final class CompletionSuggestions
- {
- private $valueSuggestions = [];
- private $optionSuggestions = [];
- public function suggestValue($value): self
- {
- $this->valueSuggestions[] = !$value instanceof Suggestion ? new Suggestion($value) : $value;
- return $this;
- }
- public function suggestValues(array $values): self
- {
- foreach ($values as $value) {
- $this->suggestValue($value);
- }
- return $this;
- }
- public function suggestOption(InputOption $option): self
- {
- $this->optionSuggestions[] = $option;
- return $this;
- }
- public function suggestOptions(array $options): self
- {
- foreach ($options as $option) {
- $this->suggestOption($option);
- }
- return $this;
- }
- public function getOptionSuggestions(): array
- {
- return $this->optionSuggestions;
- }
- public function getValueSuggestions(): array
- {
- return $this->valueSuggestions;
- }
- }
- <?php
- namespace Symfony\Component\Console\Completion\Output;
- use Symfony\Component\Console\Completion\CompletionSuggestions;
- use Symfony\Component\Console\Output\OutputInterface;
- class BashCompletionOutput implements CompletionOutputInterface
- {
- public function write(CompletionSuggestions $suggestions, OutputInterface $output): void
- {
- $values = $suggestions->getValueSuggestions();
- foreach ($suggestions->getOptionSuggestions() as $option) {
- $values[] = '--'.$option->getName();
- if ($option->isNegatable()) {
- $values[] = '--no-'.$option->getName();
- }
- }
- $output->writeln(implode("\n", $values));
- }
- }
- <?php
- namespace Symfony\Component\Console\Completion\Output;
- use Symfony\Component\Console\Completion\CompletionSuggestions;
- use Symfony\Component\Console\Output\OutputInterface;
- interface CompletionOutputInterface
- {
- public function write(CompletionSuggestions $suggestions, OutputInterface $output): void;
- }
- <?php
- namespace Symfony\Component\Console\Completion;
- class Suggestion
- {
- private $value;
- public function __construct(string $value)
- {
- $this->value = $value;
- }
- public function getValue(): string
- {
- return $this->value;
- }
- public function __toString(): string
- {
- return $this->getValue();
- }
- }
- <?php
- namespace Symfony\Component\Console;
- use Symfony\Component\Console\Event\ConsoleCommandEvent;
- use Symfony\Component\Console\Event\ConsoleErrorEvent;
- use Symfony\Component\Console\Event\ConsoleSignalEvent;
- use Symfony\Component\Console\Event\ConsoleTerminateEvent;
- final class ConsoleEvents
- {
- public const COMMAND = 'console.command';
- public const SIGNAL = 'console.signal';
- public const TERMINATE = 'console.terminate';
- public const ERROR = 'console.error';
- public const ALIASES = [
- ConsoleCommandEvent::class => self::COMMAND,
- ConsoleErrorEvent::class => self::ERROR,
- ConsoleSignalEvent::class => self::SIGNAL,
- ConsoleTerminateEvent::class => self::TERMINATE,
- ];
- }
- <?php
- namespace Symfony\Component\Console;
- use Symfony\Component\Console\Output\OutputInterface;
- final class Cursor
- {
- private $output;
- private $input;
- public function __construct(OutputInterface $output, $input = null)
- {
- $this->output = $output;
- $this->input = $input ?? (\defined('STDIN') ? \STDIN : fopen('php://input', 'r+'));
- }
- public function moveUp(int $lines = 1): self
- {
- $this->output->write(sprintf("\x1b[%dA", $lines));
- return $this;
- }
- public function moveDown(int $lines = 1): self
- {
- $this->output->write(sprintf("\x1b[%dB", $lines));
- return $this;
- }
- public function moveRight(int $columns = 1): self
- {
- $this->output->write(sprintf("\x1b[%dC", $columns));
- return $this;
- }
- public function moveLeft(int $columns = 1): self
- {
- $this->output->write(sprintf("\x1b[%dD", $columns));
- return $this;
- }
- public function moveToColumn(int $column): self
- {
- $this->output->write(sprintf("\x1b[%dG", $column));
- return $this;
- }
- public function moveToPosition(int $column, int $row): self
- {
- $this->output->write(sprintf("\x1b[%d;%dH", $row + 1, $column));
- return $this;
- }
- public function savePosition(): self
- {
- $this->output->write("\x1b7");
- return $this;
- }
- public function restorePosition(): self
- {
- $this->output->write("\x1b8");
- return $this;
- }
- public function hide(): self
- {
- $this->output->write("\x1b[?25l");
- return $this;
- }
- public function show(): self
- {
- $this->output->write("\x1b[?25h\x1b[?0c");
- return $this;
- }
- public function clearLine(): self
- {
- $this->output->write("\x1b[2K");
- return $this;
- }
- public function clearLineAfter(): self
- {
- $this->output->write("\x1b[K");
- return $this;
- }
- public function clearOutput(): self
- {
- $this->output->write("\x1b[0J");
- return $this;
- }
- public function clearScreen(): self
- {
- $this->output->write("\x1b[2J");
- return $this;
- }
- public function getCurrentPosition(): array
- {
- static $isTtySupported;
- if (null === $isTtySupported && \function_exists('proc_open')) {
- $isTtySupported = (bool) @proc_open('echo 1 >/dev/null', [['file', '/dev/tty', 'r'], ['file', '/dev/tty', 'w'], ['file', '/dev/tty', 'w']], $pipes);
- }
- if (!$isTtySupported) {
- return [1, 1];
- }
- $sttyMode = shell_exec('stty -g');
- shell_exec('stty -icanon -echo');
- @fwrite($this->input, "\033[6n");
- $code = trim(fread($this->input, 1024));
- shell_exec(sprintf('stty %s', $sttyMode));
- sscanf($code, "\033[%d;%dR", $row, $col);
- return [$col, $row];
- }
- }
- <?php
- namespace Symfony\Component\Console\DependencyInjection;
- use Symfony\Component\Console\Command\Command;
- use Symfony\Component\Console\Command\LazyCommand;
- use Symfony\Component\Console\CommandLoader\ContainerCommandLoader;
- use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument;
- use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
- use Symfony\Component\DependencyInjection\Compiler\ServiceLocatorTagPass;
- use Symfony\Component\DependencyInjection\ContainerBuilder;
- use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
- use Symfony\Component\DependencyInjection\Reference;
- use Symfony\Component\DependencyInjection\TypedReference;
- class AddConsoleCommandPass implements CompilerPassInterface
- {
- private $commandLoaderServiceId;
- private $commandTag;
- private $noPreloadTag;
- private $privateTagName;
- public function __construct(string $commandLoaderServiceId = 'console.command_loader', string $commandTag = 'console.command', string $noPreloadTag = 'container.no_preload', string $privateTagName = 'container.private')
- {
- if (0 < \func_num_args()) {
- trigger_deprecation('symfony/console', '5.3', 'Configuring "%s" is deprecated.', __CLASS__);
- }
- $this->commandLoaderServiceId = $commandLoaderServiceId;
- $this->commandTag = $commandTag;
- $this->noPreloadTag = $noPreloadTag;
- $this->privateTagName = $privateTagName;
- }
- public function process(ContainerBuilder $container)
- {
- $commandServices = $container->findTaggedServiceIds($this->commandTag, true);
- $lazyCommandMap = [];
- $lazyCommandRefs = [];
- $serviceIds = [];
- foreach ($commandServices as $id => $tags) {
- $definition = $container->getDefinition($id);
- $definition->addTag($this->noPreloadTag);
- $class = $container->getParameterBag()->resolveValue($definition->getClass());
- if (isset($tags[0]['command'])) {
- $aliases = $tags[0]['command'];
- } else {
- if (!$r = $container->getReflectionClass($class)) {
- throw new InvalidArgumentException(sprintf('Class "%s" used for service "%s" cannot be found.', $class, $id));
- }
- if (!$r->isSubclassOf(Command::class)) {
- throw new InvalidArgumentException(sprintf('The service "%s" tagged "%s" must be a subclass of "%s".', $id, $this->commandTag, Command::class));
- }
- $aliases = str_replace('%', '%%', $class::getDefaultName() ?? '');
- }
- $aliases = explode('|', $aliases ?? '');
- $commandName = array_shift($aliases);
- if ($isHidden = '' === $commandName) {
- $commandName = array_shift($aliases);
- }
- if (null === $commandName) {
- if (!$definition->isPublic() || $definition->isPrivate() || $definition->hasTag($this->privateTagName)) {
- $commandId = 'console.command.public_alias.'.$id;
- $container->setAlias($commandId, $id)->setPublic(true);
- $id = $commandId;
- }
- $serviceIds[] = $id;
- continue;
- }
- $description = $tags[0]['description'] ?? null;
- unset($tags[0]);
- $lazyCommandMap[$commandName] = $id;
- $lazyCommandRefs[$id] = new TypedReference($id, $class);
- foreach ($aliases as $alias) {
- $lazyCommandMap[$alias] = $id;
- }
- foreach ($tags as $tag) {
- if (isset($tag['command'])) {
- $aliases[] = $tag['command'];
- $lazyCommandMap[$tag['command']] = $id;
- }
- $description = $description ?? $tag['description'] ?? null;
- }
- $definition->addMethodCall('setName', [$commandName]);
- if ($aliases) {
- $definition->addMethodCall('setAliases', [$aliases]);
- }
- if ($isHidden) {
- $definition->addMethodCall('setHidden', [true]);
- }
- if (!$description) {
- if (!$r = $container->getReflectionClass($class)) {
- throw new InvalidArgumentException(sprintf('Class "%s" used for service "%s" cannot be found.', $class, $id));
- }
- if (!$r->isSubclassOf(Command::class)) {
- throw new InvalidArgumentException(sprintf('The service "%s" tagged "%s" must be a subclass of "%s".', $id, $this->commandTag, Command::class));
- }
- $description = str_replace('%', '%%', $class::getDefaultDescription() ?? '');
- }
- if ($description) {
- $definition->addMethodCall('setDescription', [$description]);
- $container->register('.'.$id.'.lazy', LazyCommand::class)
- ->setArguments([$commandName, $aliases, $description, $isHidden, new ServiceClosureArgument($lazyCommandRefs[$id])]);
- $lazyCommandRefs[$id] = new Reference('.'.$id.'.lazy');
- }
- }
- $container
- ->register($this->commandLoaderServiceId, ContainerCommandLoader::class)
- ->setPublic(true)
- ->addTag($this->noPreloadTag)
- ->setArguments([ServiceLocatorTagPass::register($container, $lazyCommandRefs), $lazyCommandMap]);
- $container->setParameter('console.command.ids', $serviceIds);
- }
- }
- <?php
- namespace Symfony\Component\Console\Descriptor;
- use Symfony\Component\Console\Application;
- use Symfony\Component\Console\Command\Command;
- use Symfony\Component\Console\Exception\CommandNotFoundException;
- class ApplicationDescription
- {
- public const GLOBAL_NAMESPACE = '_global';
- private $application;
- private $namespace;
- private $showHidden;
- private $namespaces;
- private $commands;
- private $aliases;
- public function __construct(Application $application, string $namespace = null, bool $showHidden = false)
- {
- $this->application = $application;
- $this->namespace = $namespace;
- $this->showHidden = $showHidden;
- }
- public function getNamespaces(): array
- {
- if (null === $this->namespaces) {
- $this->inspectApplication();
- }
- return $this->namespaces;
- }
- public function getCommands(): array
- {
- if (null === $this->commands) {
- $this->inspectApplication();
- }
- return $this->commands;
- }
- public function getCommand(string $name): Command
- {
- if (!isset($this->commands[$name]) && !isset($this->aliases[$name])) {
- throw new CommandNotFoundException(sprintf('Command "%s" does not exist.', $name));
- }
- return $this->commands[$name] ?? $this->aliases[$name];
- }
- private function inspectApplication()
- {
- $this->commands = [];
- $this->namespaces = [];
- $all = $this->application->all($this->namespace ? $this->application->findNamespace($this->namespace) : null);
- foreach ($this->sortCommands($all) as $namespace => $commands) {
- $names = [];
- foreach ($commands as $name => $command) {
- if (!$command->getName() || (!$this->showHidden && $command->isHidden())) {
- continue;
- }
- if ($command->getName() === $name) {
- $this->commands[$name] = $command;
- } else {
- $this->aliases[$name] = $command;
- }
- $names[] = $name;
- }
- $this->namespaces[$namespace] = ['id' => $namespace, 'commands' => $names];
- }
- }
- private function sortCommands(array $commands): array
- {
- $namespacedCommands = [];
- $globalCommands = [];
- $sortedCommands = [];
- foreach ($commands as $name => $command) {
- $key = $this->application->extractNamespace($name, 1);
- if (\in_array($key, ['', self::GLOBAL_NAMESPACE], true)) {
- $globalCommands[$name] = $command;
- } else {
- $namespacedCommands[$key][$name] = $command;
- }
- }
- if ($globalCommands) {
- ksort($globalCommands);
- $sortedCommands[self::GLOBAL_NAMESPACE] = $globalCommands;
- }
- if ($namespacedCommands) {
- ksort($namespacedCommands);
- foreach ($namespacedCommands as $key => $commandsSet) {
- ksort($commandsSet);
- $sortedCommands[$key] = $commandsSet;
- }
- }
- return $sortedCommands;
- }
- }
- <?php
- namespace Symfony\Component\Console\Descriptor;
- use Symfony\Component\Console\Application;
- use Symfony\Component\Console\Command\Command;
- use Symfony\Component\Console\Exception\InvalidArgumentException;
- use Symfony\Component\Console\Input\InputArgument;
- use Symfony\Component\Console\Input\InputDefinition;
- use Symfony\Component\Console\Input\InputOption;
- use Symfony\Component\Console\Output\OutputInterface;
- abstract class Descriptor implements DescriptorInterface
- {
- protected $output;
- public function describe(OutputInterface $output, object $object, array $options = [])
- {
- $this->output = $output;
- switch (true) {
- case $object instanceof InputArgument:
- $this->describeInputArgument($object, $options);
- break;
- case $object instanceof InputOption:
- $this->describeInputOption($object, $options);
- break;
- case $object instanceof InputDefinition:
- $this->describeInputDefinition($object, $options);
- break;
- case $object instanceof Command:
- $this->describeCommand($object, $options);
- break;
- case $object instanceof Application:
- $this->describeApplication($object, $options);
- break;
- default:
- throw new InvalidArgumentException(sprintf('Object of type "%s" is not describable.', get_debug_type($object)));
- }
- }
- protected function write(string $content, bool $decorated = false)
- {
- $this->output->write($content, false, $decorated ? OutputInterface::OUTPUT_NORMAL : OutputInterface::OUTPUT_RAW);
- }
- abstract protected function describeInputArgument(InputArgument $argument, array $options = []);
- abstract protected function describeInputOption(InputOption $option, array $options = []);
- abstract protected function describeInputDefinition(InputDefinition $definition, array $options = []);
- abstract protected function describeCommand(Command $command, array $options = []);
- abstract protected function describeApplication(Application $application, array $options = []);
- }
- <?php
- namespace Symfony\Component\Console\Descriptor;
- use Symfony\Component\Console\Output\OutputInterface;
- interface DescriptorInterface
- {
- public function describe(OutputInterface $output, object $object, array $options = []);
- }
- <?php
- namespace Symfony\Component\Console\Descriptor;
- use Symfony\Component\Console\Application;
- use Symfony\Component\Console\Command\Command;
- use Symfony\Component\Console\Input\InputArgument;
- use Symfony\Component\Console\Input\InputDefinition;
- use Symfony\Component\Console\Input\InputOption;
- class JsonDescriptor extends Descriptor
- {
- protected function describeInputArgument(InputArgument $argument, array $options = [])
- {
- $this->writeData($this->getInputArgumentData($argument), $options);
- }
- protected function describeInputOption(InputOption $option, array $options = [])
- {
- $this->writeData($this->getInputOptionData($option), $options);
- if ($option->isNegatable()) {
- $this->writeData($this->getInputOptionData($option, true), $options);
- }
- }
- protected function describeInputDefinition(InputDefinition $definition, array $options = [])
- {
- $this->writeData($this->getInputDefinitionData($definition), $options);
- }
- protected function describeCommand(Command $command, array $options = [])
- {
- $this->writeData($this->getCommandData($command, $options['short'] ?? false), $options);
- }
- protected function describeApplication(Application $application, array $options = [])
- {
- $describedNamespace = $options['namespace'] ?? null;
- $description = new ApplicationDescription($application, $describedNamespace, true);
- $commands = [];
- foreach ($description->getCommands() as $command) {
- $commands[] = $this->getCommandData($command, $options['short'] ?? false);
- }
- $data = [];
- if ('UNKNOWN' !== $application->getName()) {
- $data['application']['name'] = $application->getName();
- if ('UNKNOWN' !== $application->getVersion()) {
- $data['application']['version'] = $application->getVersion();
- }
- }
- $data['commands'] = $commands;
- if ($describedNamespace) {
- $data['namespace'] = $describedNamespace;
- } else {
- $data['namespaces'] = array_values($description->getNamespaces());
- }
- $this->writeData($data, $options);
- }
- private function writeData(array $data, array $options)
- {
- $flags = $options['json_encoding'] ?? 0;
- $this->write(json_encode($data, $flags));
- }
- private function getInputArgumentData(InputArgument $argument): array
- {
- return [
- 'name' => $argument->getName(),
- 'is_required' => $argument->isRequired(),
- 'is_array' => $argument->isArray(),
- 'description' => preg_replace('/\s*[\r\n]\s*/', ' ', $argument->getDescription()),
- 'default' => \INF === $argument->getDefault() ? 'INF' : $argument->getDefault(),
- ];
- }
- private function getInputOptionData(InputOption $option, bool $negated = false): array
- {
- return $negated ? [
- 'name' => '--no-'.$option->getName(),
- 'shortcut' => '',
- 'accept_value' => false,
- 'is_value_required' => false,
- 'is_multiple' => false,
- 'description' => 'Negate the "--'.$option->getName().'" option',
- 'default' => false,
- ] : [
- 'name' => '--'.$option->getName(),
- 'shortcut' => $option->getShortcut() ? '-'.str_replace('|', '|-', $option->getShortcut()) : '',
- 'accept_value' => $option->acceptValue(),
- 'is_value_required' => $option->isValueRequired(),
- 'is_multiple' => $option->isArray(),
- 'description' => preg_replace('/\s*[\r\n]\s*/', ' ', $option->getDescription()),
- 'default' => \INF === $option->getDefault() ? 'INF' : $option->getDefault(),
- ];
- }
- private function getInputDefinitionData(InputDefinition $definition): array
- {
- $inputArguments = [];
- foreach ($definition->getArguments() as $name => $argument) {
- $inputArguments[$name] = $this->getInputArgumentData($argument);
- }
- $inputOptions = [];
- foreach ($definition->getOptions() as $name => $option) {
- $inputOptions[$name] = $this->getInputOptionData($option);
- if ($option->isNegatable()) {
- $inputOptions['no-'.$name] = $this->getInputOptionData($option, true);
- }
- }
- return ['arguments' => $inputArguments, 'options' => $inputOptions];
- }
- private function getCommandData(Command $command, bool $short = false): array
- {
- $data = [
- 'name' => $command->getName(),
- 'description' => $command->getDescription(),
- ];
- if ($short) {
- $data += [
- 'usage' => $command->getAliases(),
- ];
- } else {
- $command->mergeApplicationDefinition(false);
- $data += [
- 'usage' => array_merge([$command->getSynopsis()], $command->getUsages(), $command->getAliases()),
- 'help' => $command->getProcessedHelp(),
- 'definition' => $this->getInputDefinitionData($command->getDefinition()),
- ];
- }
- $data['hidden'] = $command->isHidden();
- return $data;
- }
- }
- <?php
- namespace Symfony\Component\Console\Descriptor;
- use Symfony\Component\Console\Application;
- use Symfony\Component\Console\Command\Command;
- use Symfony\Component\Console\Helper\Helper;
- use Symfony\Component\Console\Input\InputArgument;
- use Symfony\Component\Console\Input\InputDefinition;
- use Symfony\Component\Console\Input\InputOption;
- use Symfony\Component\Console\Output\OutputInterface;
- class MarkdownDescriptor extends Descriptor
- {
- public function describe(OutputInterface $output, object $object, array $options = [])
- {
- $decorated = $output->isDecorated();
- $output->setDecorated(false);
- parent::describe($output, $object, $options);
- $output->setDecorated($decorated);
- }
- protected function write(string $content, bool $decorated = true)
- {
- parent::write($content, $decorated);
- }
- protected function describeInputArgument(InputArgument $argument, array $options = [])
- {
- $this->write(
- '#### `'.($argument->getName() ?: '<none>')."`\n\n"
- .($argument->getDescription() ? preg_replace('/\s*[\r\n]\s*/', "\n", $argument->getDescription())."\n\n" : '')
- .'* Is required: '.($argument->isRequired() ? 'yes' : 'no')."\n"
- .'* Is array: '.($argument->isArray() ? 'yes' : 'no')."\n"
- .'* Default: `'.str_replace("\n", '', var_export($argument->getDefault(), true)).'`'
- );
- }
- protected function describeInputOption(InputOption $option, array $options = [])
- {
- $name = '--'.$option->getName();
- if ($option->isNegatable()) {
- $name .= '|--no-'.$option->getName();
- }
- if ($option->getShortcut()) {
- $name .= '|-'.str_replace('|', '|-', $option->getShortcut()).'';
- }
- $this->write(
- '#### `'.$name.'`'."\n\n"
- .($option->getDescription() ? preg_replace('/\s*[\r\n]\s*/', "\n", $option->getDescription())."\n\n" : '')
- .'* Accept value: '.($option->acceptValue() ? 'yes' : 'no')."\n"
- .'* Is value required: '.($option->isValueRequired() ? 'yes' : 'no')."\n"
- .'* Is multiple: '.($option->isArray() ? 'yes' : 'no')."\n"
- .'* Is negatable: '.($option->isNegatable() ? 'yes' : 'no')."\n"
- .'* Default: `'.str_replace("\n", '', var_export($option->getDefault(), true)).'`'
- );
- }
- protected function describeInputDefinition(InputDefinition $definition, array $options = [])
- {
- if ($showArguments = \count($definition->getArguments()) > 0) {
- $this->write('### Arguments');
- foreach ($definition->getArguments() as $argument) {
- $this->write("\n\n");
- if (null !== $describeInputArgument = $this->describeInputArgument($argument)) {
- $this->write($describeInputArgument);
- }
- }
- }
- if (\count($definition->getOptions()) > 0) {
- if ($showArguments) {
- $this->write("\n\n");
- }
- $this->write('### Options');
- foreach ($definition->getOptions() as $option) {
- $this->write("\n\n");
- if (null !== $describeInputOption = $this->describeInputOption($option)) {
- $this->write($describeInputOption);
- }
- }
- }
- }
- protected function describeCommand(Command $command, array $options = [])
- {
- if ($options['short'] ?? false) {
- $this->write(
- '`'.$command->getName()."`\n"
- .str_repeat('-', Helper::width($command->getName()) + 2)."\n\n"
- .($command->getDescription() ? $command->getDescription()."\n\n" : '')
- .'### Usage'."\n\n"
- .array_reduce($command->getAliases(), function ($carry, $usage) {
- return $carry.'* `'.$usage.'`'."\n";
- })
- );
- return;
- }
- $command->mergeApplicationDefinition(false);
- $this->write(
- '`'.$command->getName()."`\n"
- .str_repeat('-', Helper::width($command->getName()) + 2)."\n\n"
- .($command->getDescription() ? $command->getDescription()."\n\n" : '')
- .'### Usage'."\n\n"
- .array_reduce(array_merge([$command->getSynopsis()], $command->getAliases(), $command->getUsages()), function ($carry, $usage) {
- return $carry.'* `'.$usage.'`'."\n";
- })
- );
- if ($help = $command->getProcessedHelp()) {
- $this->write("\n");
- $this->write($help);
- }
- $definition = $command->getDefinition();
- if ($definition->getOptions() || $definition->getArguments()) {
- $this->write("\n\n");
- $this->describeInputDefinition($definition);
- }
- }
- protected function describeApplication(Application $application, array $options = [])
- {
- $describedNamespace = $options['namespace'] ?? null;
- $description = new ApplicationDescription($application, $describedNamespace);
- $title = $this->getApplicationTitle($application);
- $this->write($title."\n".str_repeat('=', Helper::width($title)));
- foreach ($description->getNamespaces() as $namespace) {
- if (ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) {
- $this->write("\n\n");
- $this->write('**'.$namespace['id'].':**');
- }
- $this->write("\n\n");
- $this->write(implode("\n", array_map(function ($commandName) use ($description) {
- return sprintf('* [`%s`](#%s)', $commandName, str_replace(':', '', $description->getCommand($commandName)->getName()));
- }, $namespace['commands'])));
- }
- foreach ($description->getCommands() as $command) {
- $this->write("\n\n");
- if (null !== $describeCommand = $this->describeCommand($command, $options)) {
- $this->write($describeCommand);
- }
- }
- }
- private function getApplicationTitle(Application $application): string
- {
- if ('UNKNOWN' !== $application->getName()) {
- if ('UNKNOWN' !== $application->getVersion()) {
- return sprintf('%s %s', $application->getName(), $application->getVersion());
- }
- return $application->getName();
- }
- return 'Console Tool';
- }
- }
- <?php
- namespace Symfony\Component\Console\Descriptor;
- use Symfony\Component\Console\Application;
- use Symfony\Component\Console\Command\Command;
- use Symfony\Component\Console\Formatter\OutputFormatter;
- use Symfony\Component\Console\Helper\Helper;
- use Symfony\Component\Console\Input\InputArgument;
- use Symfony\Component\Console\Input\InputDefinition;
- use Symfony\Component\Console\Input\InputOption;
- class TextDescriptor extends Descriptor
- {
- protected function describeInputArgument(InputArgument $argument, array $options = [])
- {
- if (null !== $argument->getDefault() && (!\is_array($argument->getDefault()) || \count($argument->getDefault()))) {
- $default = sprintf('<comment> [default: %s]</comment>', $this->formatDefaultValue($argument->getDefault()));
- } else {
- $default = '';
- }
- $totalWidth = $options['total_width'] ?? Helper::width($argument->getName());
- $spacingWidth = $totalWidth - \strlen($argument->getName());
- $this->writeText(sprintf(' <info>%s</info> %s%s%s',
- $argument->getName(),
- str_repeat(' ', $spacingWidth),
- preg_replace('/\s*[\r\n]\s*/', "\n".str_repeat(' ', $totalWidth + 4), $argument->getDescription()),
- $default
- ), $options);
- }
- protected function describeInputOption(InputOption $option, array $options = [])
- {
- if ($option->acceptValue() && null !== $option->getDefault() && (!\is_array($option->getDefault()) || \count($option->getDefault()))) {
- $default = sprintf('<comment> [default: %s]</comment>', $this->formatDefaultValue($option->getDefault()));
- } else {
- $default = '';
- }
- $value = '';
- if ($option->acceptValue()) {
- $value = '='.strtoupper($option->getName());
- if ($option->isValueOptional()) {
- $value = '['.$value.']';
- }
- }
- $totalWidth = $options['total_width'] ?? $this->calculateTotalWidthForOptions([$option]);
- $synopsis = sprintf('%s%s',
- $option->getShortcut() ? sprintf('-%s, ', $option->getShortcut()) : ' ',
- sprintf($option->isNegatable() ? '--%1$s|--no-%1$s' : '--%1$s%2$s', $option->getName(), $value)
- );
- $spacingWidth = $totalWidth - Helper::width($synopsis);
- $this->writeText(sprintf(' <info>%s</info> %s%s%s%s',
- $synopsis,
- str_repeat(' ', $spacingWidth),
- preg_replace('/\s*[\r\n]\s*/', "\n".str_repeat(' ', $totalWidth + 4), $option->getDescription()),
- $default,
- $option->isArray() ? '<comment> (multiple values allowed)</comment>' : ''
- ), $options);
- }
- protected function describeInputDefinition(InputDefinition $definition, array $options = [])
- {
- $totalWidth = $this->calculateTotalWidthForOptions($definition->getOptions());
- foreach ($definition->getArguments() as $argument) {
- $totalWidth = max($totalWidth, Helper::width($argument->getName()));
- }
- if ($definition->getArguments()) {
- $this->writeText('<comment>Arguments:</comment>', $options);
- $this->writeText("\n");
- foreach ($definition->getArguments() as $argument) {
- $this->describeInputArgument($argument, array_merge($options, ['total_width' => $totalWidth]));
- $this->writeText("\n");
- }
- }
- if ($definition->getArguments() && $definition->getOptions()) {
- $this->writeText("\n");
- }
- if ($definition->getOptions()) {
- $laterOptions = [];
- $this->writeText('<comment>Options:</comment>', $options);
- foreach ($definition->getOptions() as $option) {
- if (\strlen($option->getShortcut() ?? '') > 1) {
- $laterOptions[] = $option;
- continue;
- }
- $this->writeText("\n");
- $this->describeInputOption($option, array_merge($options, ['total_width' => $totalWidth]));
- }
- foreach ($laterOptions as $option) {
- $this->writeText("\n");
- $this->describeInputOption($option, array_merge($options, ['total_width' => $totalWidth]));
- }
- }
- }
- protected function describeCommand(Command $command, array $options = [])
- {
- $command->mergeApplicationDefinition(false);
- if ($description = $command->getDescription()) {
- $this->writeText('<comment>Description:</comment>', $options);
- $this->writeText("\n");
- $this->writeText(' '.$description);
- $this->writeText("\n\n");
- }
- $this->writeText('<comment>Usage:</comment>', $options);
- foreach (array_merge([$command->getSynopsis(true)], $command->getAliases(), $command->getUsages()) as $usage) {
- $this->writeText("\n");
- $this->writeText(' '.OutputFormatter::escape($usage), $options);
- }
- $this->writeText("\n");
- $definition = $command->getDefinition();
- if ($definition->getOptions() || $definition->getArguments()) {
- $this->writeText("\n");
- $this->describeInputDefinition($definition, $options);
- $this->writeText("\n");
- }
- $help = $command->getProcessedHelp();
- if ($help && $help !== $description) {
- $this->writeText("\n");
- $this->writeText('<comment>Help:</comment>', $options);
- $this->writeText("\n");
- $this->writeText(' '.str_replace("\n", "\n ", $help), $options);
- $this->writeText("\n");
- }
- }
- protected function describeApplication(Application $application, array $options = [])
- {
- $describedNamespace = $options['namespace'] ?? null;
- $description = new ApplicationDescription($application, $describedNamespace);
- if (isset($options['raw_text']) && $options['raw_text']) {
- $width = $this->getColumnWidth($description->getCommands());
- foreach ($description->getCommands() as $command) {
- $this->writeText(sprintf("%-{$width}s %s", $command->getName(), $command->getDescription()), $options);
- $this->writeText("\n");
- }
- } else {
- if ('' != $help = $application->getHelp()) {
- $this->writeText("$help\n\n", $options);
- }
- $this->writeText("<comment>Usage:</comment>\n", $options);
- $this->writeText(" command [options] [arguments]\n\n", $options);
- $this->describeInputDefinition(new InputDefinition($application->getDefinition()->getOptions()), $options);
- $this->writeText("\n");
- $this->writeText("\n");
- $commands = $description->getCommands();
- $namespaces = $description->getNamespaces();
- if ($describedNamespace && $namespaces) {
- $describedNamespaceInfo = reset($namespaces);
- foreach ($describedNamespaceInfo['commands'] as $name) {
- $commands[$name] = $description->getCommand($name);
- }
- }
- $width = $this->getColumnWidth(array_merge(...array_values(array_map(function ($namespace) use ($commands) {
- return array_intersect($namespace['commands'], array_keys($commands));
- }, array_values($namespaces)))));
- if ($describedNamespace) {
- $this->writeText(sprintf('<comment>Available commands for the "%s" namespace:</comment>', $describedNamespace), $options);
- } else {
- $this->writeText('<comment>Available commands:</comment>', $options);
- }
- foreach ($namespaces as $namespace) {
- $namespace['commands'] = array_filter($namespace['commands'], function ($name) use ($commands) {
- return isset($commands[$name]);
- });
- if (!$namespace['commands']) {
- continue;
- }
- if (!$describedNamespace && ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) {
- $this->writeText("\n");
- $this->writeText(' <comment>'.$namespace['id'].'</comment>', $options);
- }
- foreach ($namespace['commands'] as $name) {
- $this->writeText("\n");
- $spacingWidth = $width - Helper::width($name);
- $command = $commands[$name];
- $commandAliases = $name === $command->getName() ? $this->getCommandAliasesText($command) : '';
- $this->writeText(sprintf(' <info>%s</info>%s%s', $name, str_repeat(' ', $spacingWidth), $commandAliases.$command->getDescription()), $options);
- }
- }
- $this->writeText("\n");
- }
- }
- private function writeText(string $content, array $options = [])
- {
- $this->write(
- isset($options['raw_text']) && $options['raw_text'] ? strip_tags($content) : $content,
- isset($options['raw_output']) ? !$options['raw_output'] : true
- );
- }
- private function getCommandAliasesText(Command $command): string
- {
- $text = '';
- $aliases = $command->getAliases();
- if ($aliases) {
- $text = '['.implode('|', $aliases).'] ';
- }
- return $text;
- }
- private function formatDefaultValue($default): string
- {
- if (\INF === $default) {
- return 'INF';
- }
- if (\is_string($default)) {
- $default = OutputFormatter::escape($default);
- } elseif (\is_array($default)) {
- foreach ($default as $key => $value) {
- if (\is_string($value)) {
- $default[$key] = OutputFormatter::escape($value);
- }
- }
- }
- return str_replace('\\\\', '\\', json_encode($default, \JSON_UNESCAPED_SLASHES | \JSON_UNESCAPED_UNICODE));
- }
- private function getColumnWidth(array $commands): int
- {
- $widths = [];
- foreach ($commands as $command) {
- if ($command instanceof Command) {
- $widths[] = Helper::width($command->getName());
- foreach ($command->getAliases() as $alias) {
- $widths[] = Helper::width($alias);
- }
- } else {
- $widths[] = Helper::width($command);
- }
- }
- return $widths ? max($widths) + 2 : 0;
- }
- private function calculateTotalWidthForOptions(array $options): int
- {
- $totalWidth = 0;
- foreach ($options as $option) {
- $nameLength = 1 + max(Helper::width($option->getShortcut()), 1) + 4 + Helper::width($option->getName());
- if ($option->isNegatable()) {
- $nameLength += 6 + Helper::width($option->getName());
- } elseif ($option->acceptValue()) {
- $valueLength = 1 + Helper::width($option->getName());
- $valueLength += $option->isValueOptional() ? 2 : 0;
- $nameLength += $valueLength;
- }
- $totalWidth = max($totalWidth, $nameLength);
- }
- return $totalWidth;
- }
- }
- <?php
- namespace Symfony\Component\Console\Descriptor;
- use Symfony\Component\Console\Application;
- use Symfony\Component\Console\Command\Command;
- use Symfony\Component\Console\Input\InputArgument;
- use Symfony\Component\Console\Input\InputDefinition;
- use Symfony\Component\Console\Input\InputOption;
- class XmlDescriptor extends Descriptor
- {
- public function getInputDefinitionDocument(InputDefinition $definition): \DOMDocument
- {
- $dom = new \DOMDocument('1.0', 'UTF-8');
- $dom->appendChild($definitionXML = $dom->createElement('definition'));
- $definitionXML->appendChild($argumentsXML = $dom->createElement('arguments'));
- foreach ($definition->getArguments() as $argument) {
- $this->appendDocument($argumentsXML, $this->getInputArgumentDocument($argument));
- }
- $definitionXML->appendChild($optionsXML = $dom->createElement('options'));
- foreach ($definition->getOptions() as $option) {
- $this->appendDocument($optionsXML, $this->getInputOptionDocument($option));
- }
- return $dom;
- }
- public function getCommandDocument(Command $command, bool $short = false): \DOMDocument
- {
- $dom = new \DOMDocument('1.0', 'UTF-8');
- $dom->appendChild($commandXML = $dom->createElement('command'));
- $commandXML->setAttribute('id', $command->getName());
- $commandXML->setAttribute('name', $command->getName());
- $commandXML->setAttribute('hidden', $command->isHidden() ? 1 : 0);
- $commandXML->appendChild($usagesXML = $dom->createElement('usages'));
- $commandXML->appendChild($descriptionXML = $dom->createElement('description'));
- $descriptionXML->appendChild($dom->createTextNode(str_replace("\n", "\n ", $command->getDescription())));
- if ($short) {
- foreach ($command->getAliases() as $usage) {
- $usagesXML->appendChild($dom->createElement('usage', $usage));
- }
- } else {
- $command->mergeApplicationDefinition(false);
- foreach (array_merge([$command->getSynopsis()], $command->getAliases(), $command->getUsages()) as $usage) {
- $usagesXML->appendChild($dom->createElement('usage', $usage));
- }
- $commandXML->appendChild($helpXML = $dom->createElement('help'));
- $helpXML->appendChild($dom->createTextNode(str_replace("\n", "\n ", $command->getProcessedHelp())));
- $definitionXML = $this->getInputDefinitionDocument($command->getDefinition());
- $this->appendDocument($commandXML, $definitionXML->getElementsByTagName('definition')->item(0));
- }
- return $dom;
- }
- public function getApplicationDocument(Application $application, string $namespace = null, bool $short = false): \DOMDocument
- {
- $dom = new \DOMDocument('1.0', 'UTF-8');
- $dom->appendChild($rootXml = $dom->createElement('symfony'));
- if ('UNKNOWN' !== $application->getName()) {
- $rootXml->setAttribute('name', $application->getName());
- if ('UNKNOWN' !== $application->getVersion()) {
- $rootXml->setAttribute('version', $application->getVersion());
- }
- }
- $rootXml->appendChild($commandsXML = $dom->createElement('commands'));
- $description = new ApplicationDescription($application, $namespace, true);
- if ($namespace) {
- $commandsXML->setAttribute('namespace', $namespace);
- }
- foreach ($description->getCommands() as $command) {
- $this->appendDocument($commandsXML, $this->getCommandDocument($command, $short));
- }
- if (!$namespace) {
- $rootXml->appendChild($namespacesXML = $dom->createElement('namespaces'));
- foreach ($description->getNamespaces() as $namespaceDescription) {
- $namespacesXML->appendChild($namespaceArrayXML = $dom->createElement('namespace'));
- $namespaceArrayXML->setAttribute('id', $namespaceDescription['id']);
- foreach ($namespaceDescription['commands'] as $name) {
- $namespaceArrayXML->appendChild($commandXML = $dom->createElement('command'));
- $commandXML->appendChild($dom->createTextNode($name));
- }
- }
- }
- return $dom;
- }
- protected function describeInputArgument(InputArgument $argument, array $options = [])
- {
- $this->writeDocument($this->getInputArgumentDocument($argument));
- }
- protected function describeInputOption(InputOption $option, array $options = [])
- {
- $this->writeDocument($this->getInputOptionDocument($option));
- }
- protected function describeInputDefinition(InputDefinition $definition, array $options = [])
- {
- $this->writeDocument($this->getInputDefinitionDocument($definition));
- }
- protected function describeCommand(Command $command, array $options = [])
- {
- $this->writeDocument($this->getCommandDocument($command, $options['short'] ?? false));
- }
- protected function describeApplication(Application $application, array $options = [])
- {
- $this->writeDocument($this->getApplicationDocument($application, $options['namespace'] ?? null, $options['short'] ?? false));
- }
- private function appendDocument(\DOMNode $parentNode, \DOMNode $importedParent)
- {
- foreach ($importedParent->childNodes as $childNode) {
- $parentNode->appendChild($parentNode->ownerDocument->importNode($childNode, true));
- }
- }
- private function writeDocument(\DOMDocument $dom)
- {
- $dom->formatOutput = true;
- $this->write($dom->saveXML());
- }
- private function getInputArgumentDocument(InputArgument $argument): \DOMDocument
- {
- $dom = new \DOMDocument('1.0', 'UTF-8');
- $dom->appendChild($objectXML = $dom->createElement('argument'));
- $objectXML->setAttribute('name', $argument->getName());
- $objectXML->setAttribute('is_required', $argument->isRequired() ? 1 : 0);
- $objectXML->setAttribute('is_array', $argument->isArray() ? 1 : 0);
- $objectXML->appendChild($descriptionXML = $dom->createElement('description'));
- $descriptionXML->appendChild($dom->createTextNode($argument->getDescription()));
- $objectXML->appendChild($defaultsXML = $dom->createElement('defaults'));
- $defaults = \is_array($argument->getDefault()) ? $argument->getDefault() : (\is_bool($argument->getDefault()) ? [var_export($argument->getDefault(), true)] : ($argument->getDefault() ? [$argument->getDefault()] : []));
- foreach ($defaults as $default) {
- $defaultsXML->appendChild($defaultXML = $dom->createElement('default'));
- $defaultXML->appendChild($dom->createTextNode($default));
- }
- return $dom;
- }
- private function getInputOptionDocument(InputOption $option): \DOMDocument
- {
- $dom = new \DOMDocument('1.0', 'UTF-8');
- $dom->appendChild($objectXML = $dom->createElement('option'));
- $objectXML->setAttribute('name', '--'.$option->getName());
- $pos = strpos($option->getShortcut() ?? '', '|');
- if (false !== $pos) {
- $objectXML->setAttribute('shortcut', '-'.substr($option->getShortcut(), 0, $pos));
- $objectXML->setAttribute('shortcuts', '-'.str_replace('|', '|-', $option->getShortcut()));
- } else {
- $objectXML->setAttribute('shortcut', $option->getShortcut() ? '-'.$option->getShortcut() : '');
- }
- $objectXML->setAttribute('accept_value', $option->acceptValue() ? 1 : 0);
- $objectXML->setAttribute('is_value_required', $option->isValueRequired() ? 1 : 0);
- $objectXML->setAttribute('is_multiple', $option->isArray() ? 1 : 0);
- $objectXML->appendChild($descriptionXML = $dom->createElement('description'));
- $descriptionXML->appendChild($dom->createTextNode($option->getDescription()));
- if ($option->acceptValue()) {
- $defaults = \is_array($option->getDefault()) ? $option->getDefault() : (\is_bool($option->getDefault()) ? [var_export($option->getDefault(), true)] : ($option->getDefault() ? [$option->getDefault()] : []));
- $objectXML->appendChild($defaultsXML = $dom->createElement('defaults'));
- if (!empty($defaults)) {
- foreach ($defaults as $default) {
- $defaultsXML->appendChild($defaultXML = $dom->createElement('default'));
- $defaultXML->appendChild($dom->createTextNode($default));
- }
- }
- }
- if ($option->isNegatable()) {
- $dom->appendChild($objectXML = $dom->createElement('option'));
- $objectXML->setAttribute('name', '--no-'.$option->getName());
- $objectXML->setAttribute('shortcut', '');
- $objectXML->setAttribute('accept_value', 0);
- $objectXML->setAttribute('is_value_required', 0);
- $objectXML->setAttribute('is_multiple', 0);
- $objectXML->appendChild($descriptionXML = $dom->createElement('description'));
- $descriptionXML->appendChild($dom->createTextNode('Negate the "--'.$option->getName().'" option'));
- }
- return $dom;
- }
- }
- <?php
- namespace Symfony\Component\Console\Event;
- final class ConsoleCommandEvent extends ConsoleEvent
- {
- public const RETURN_CODE_DISABLED = 113;
- private $commandShouldRun = true;
- public function disableCommand(): bool
- {
- return $this->commandShouldRun = false;
- }
- public function enableCommand(): bool
- {
- return $this->commandShouldRun = true;
- }
- public function commandShouldRun(): bool
- {
- return $this->commandShouldRun;
- }
- }
- <?php
- namespace Symfony\Component\Console\Event;
- use Symfony\Component\Console\Command\Command;
- use Symfony\Component\Console\Input\InputInterface;
- use Symfony\Component\Console\Output\OutputInterface;
- final class ConsoleErrorEvent extends ConsoleEvent
- {
- private $error;
- private $exitCode;
- public function __construct(InputInterface $input, OutputInterface $output, \Throwable $error, Command $command = null)
- {
- parent::__construct($command, $input, $output);
- $this->error = $error;
- }
- public function getError(): \Throwable
- {
- return $this->error;
- }
- public function setError(\Throwable $error): void
- {
- $this->error = $error;
- }
- public function setExitCode(int $exitCode): void
- {
- $this->exitCode = $exitCode;
- $r = new \ReflectionProperty($this->error, 'code');
- $r->setAccessible(true);
- $r->setValue($this->error, $this->exitCode);
- }
- public function getExitCode(): int
- {
- return $this->exitCode ?? (\is_int($this->error->getCode()) && 0 !== $this->error->getCode() ? $this->error->getCode() : 1);
- }
- }
- <?php
- namespace Symfony\Component\Console\Event;
- use Symfony\Component\Console\Command\Command;
- use Symfony\Component\Console\Input\InputInterface;
- use Symfony\Component\Console\Output\OutputInterface;
- use Symfony\Contracts\EventDispatcher\Event;
- class ConsoleEvent extends Event
- {
- protected $command;
- private $input;
- private $output;
- public function __construct(?Command $command, InputInterface $input, OutputInterface $output)
- {
- $this->command = $command;
- $this->input = $input;
- $this->output = $output;
- }
- public function getCommand()
- {
- return $this->command;
- }
- public function getInput()
- {
- return $this->input;
- }
- public function getOutput()
- {
- return $this->output;
- }
- }
- <?php
- namespace Symfony\Component\Console\Event;
- use Symfony\Component\Console\Command\Command;
- use Symfony\Component\Console\Input\InputInterface;
- use Symfony\Component\Console\Output\OutputInterface;
- final class ConsoleSignalEvent extends ConsoleEvent
- {
- private $handlingSignal;
- public function __construct(Command $command, InputInterface $input, OutputInterface $output, int $handlingSignal)
- {
- parent::__construct($command, $input, $output);
- $this->handlingSignal = $handlingSignal;
- }
- public function getHandlingSignal(): int
- {
- return $this->handlingSignal;
- }
- }
- <?php
- namespace Symfony\Component\Console\Event;
- use Symfony\Component\Console\Command\Command;
- use Symfony\Component\Console\Input\InputInterface;
- use Symfony\Component\Console\Output\OutputInterface;
- final class ConsoleTerminateEvent extends ConsoleEvent
- {
- private $exitCode;
- public function __construct(Command $command, InputInterface $input, OutputInterface $output, int $exitCode)
- {
- parent::__construct($command, $input, $output);
- $this->setExitCode($exitCode);
- }
- public function setExitCode(int $exitCode): void
- {
- $this->exitCode = $exitCode;
- }
- public function getExitCode(): int
- {
- return $this->exitCode;
- }
- }
- <?php
- namespace Symfony\Component\Console\EventListener;
- use Psr\Log\LoggerInterface;
- use Symfony\Component\Console\ConsoleEvents;
- use Symfony\Component\Console\Event\ConsoleErrorEvent;
- use Symfony\Component\Console\Event\ConsoleEvent;
- use Symfony\Component\Console\Event\ConsoleTerminateEvent;
- use Symfony\Component\EventDispatcher\EventSubscriberInterface;
- class ErrorListener implements EventSubscriberInterface
- {
- private $logger;
- public function __construct(LoggerInterface $logger = null)
- {
- $this->logger = $logger;
- }
- public function onConsoleError(ConsoleErrorEvent $event)
- {
- if (null === $this->logger) {
- return;
- }
- $error = $event->getError();
- if (!$inputString = $this->getInputString($event)) {
- $this->logger->critical('An error occurred while using the console. Message: "{message}"', ['exception' => $error, 'message' => $error->getMessage()]);
- return;
- }
- $this->logger->critical('Error thrown while running command "{command}". Message: "{message}"', ['exception' => $error, 'command' => $inputString, 'message' => $error->getMessage()]);
- }
- public function onConsoleTerminate(ConsoleTerminateEvent $event)
- {
- if (null === $this->logger) {
- return;
- }
- $exitCode = $event->getExitCode();
- if (0 === $exitCode) {
- return;
- }
- if (!$inputString = $this->getInputString($event)) {
- $this->logger->debug('The console exited with code "{code}"', ['code' => $exitCode]);
- return;
- }
- $this->logger->debug('Command "{command}" exited with code "{code}"', ['command' => $inputString, 'code' => $exitCode]);
- }
- public static function getSubscribedEvents()
- {
- return [
- ConsoleEvents::ERROR => ['onConsoleError', -128],
- ConsoleEvents::TERMINATE => ['onConsoleTerminate', -128],
- ];
- }
- private static function getInputString(ConsoleEvent $event): ?string
- {
- $commandName = $event->getCommand() ? $event->getCommand()->getName() : null;
- $input = $event->getInput();
- if (method_exists($input, '__toString')) {
- if ($commandName) {
- return str_replace(["'$commandName'", "\"$commandName\""], $commandName, (string) $input);
- }
- return (string) $input;
- }
- return $commandName;
- }
- }
- <?php
- namespace Symfony\Component\Console\Exception;
- class CommandNotFoundException extends \InvalidArgumentException implements ExceptionInterface
- {
- private $alternatives;
- public function __construct(string $message, array $alternatives = [], int $code = 0, \Throwable $previous = null)
- {
- parent::__construct($message, $code, $previous);
- $this->alternatives = $alternatives;
- }
- public function getAlternatives()
- {
- return $this->alternatives;
- }
- }
- <?php
- namespace Symfony\Component\Console\Exception;
- interface ExceptionInterface extends \Throwable
- {
- }
- <?php
- namespace Symfony\Component\Console\Exception;
- class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
- {
- }
- <?php
- namespace Symfony\Component\Console\Exception;
- class InvalidOptionException extends \InvalidArgumentException implements ExceptionInterface
- {
- }
- <?php
- namespace Symfony\Component\Console\Exception;
- class LogicException extends \LogicException implements ExceptionInterface
- {
- }
- <?php
- namespace Symfony\Component\Console\Exception;
- class MissingInputException extends RuntimeException implements ExceptionInterface
- {
- }
- <?php
- namespace Symfony\Component\Console\Exception;
- class NamespaceNotFoundException extends CommandNotFoundException
- {
- }
- <?php
- namespace Symfony\Component\Console\Exception;
- class RuntimeException extends \RuntimeException implements ExceptionInterface
- {
- }
- <?php
- namespace Symfony\Component\Console\Formatter;
- final class NullOutputFormatter implements OutputFormatterInterface
- {
- private $style;
- public function format(?string $message): ?string
- {
- return null;
- }
- public function getStyle(string $name): OutputFormatterStyleInterface
- {
- return $this->style ?? $this->style = new NullOutputFormatterStyle();
- }
- public function hasStyle(string $name): bool
- {
- return false;
- }
- public function isDecorated(): bool
- {
- return false;
- }
- public function setDecorated(bool $decorated): void
- {
- }
- public function setStyle(string $name, OutputFormatterStyleInterface $style): void
- {
- }
- }
- <?php
- namespace Symfony\Component\Console\Formatter;
- final class NullOutputFormatterStyle implements OutputFormatterStyleInterface
- {
- public function apply(string $text): string
- {
- return $text;
- }
- public function setBackground(string $color = null): void
- {
- }
- public function setForeground(string $color = null): void
- {
- }
- public function setOption(string $option): void
- {
- }
- public function setOptions(array $options): void
- {
- }
- public function unsetOption(string $option): void
- {
- }
- }
- <?php
- namespace Symfony\Component\Console\Formatter;
- use Symfony\Component\Console\Exception\InvalidArgumentException;
- class OutputFormatter implements WrappableOutputFormatterInterface
- {
- private $decorated;
- private $styles = [];
- private $styleStack;
- public function __clone()
- {
- $this->styleStack = clone $this->styleStack;
- foreach ($this->styles as $key => $value) {
- $this->styles[$key] = clone $value;
- }
- }
- public static function escape(string $text)
- {
- $text = preg_replace('/([^\\\\]|^)([<>])/', '$1\\\\$2', $text);
- return self::escapeTrailingBackslash($text);
- }
- public static function escapeTrailingBackslash(string $text): string
- {
- if (str_ends_with($text, '\\')) {
- $len = \strlen($text);
- $text = rtrim($text, '\\');
- $text = str_replace("\0", '', $text);
- $text .= str_repeat("\0", $len - \strlen($text));
- }
- return $text;
- }
- public function __construct(bool $decorated = false, array $styles = [])
- {
- $this->decorated = $decorated;
- $this->setStyle('error', new OutputFormatterStyle('white', 'red'));
- $this->setStyle('info', new OutputFormatterStyle('green'));
- $this->setStyle('comment', new OutputFormatterStyle('yellow'));
- $this->setStyle('question', new OutputFormatterStyle('black', 'cyan'));
- foreach ($styles as $name => $style) {
- $this->setStyle($name, $style);
- }
- $this->styleStack = new OutputFormatterStyleStack();
- }
- public function setDecorated(bool $decorated)
- {
- $this->decorated = $decorated;
- }
- public function isDecorated()
- {
- return $this->decorated;
- }
- public function setStyle(string $name, OutputFormatterStyleInterface $style)
- {
- $this->styles[strtolower($name)] = $style;
- }
- public function hasStyle(string $name)
- {
- return isset($this->styles[strtolower($name)]);
- }
- public function getStyle(string $name)
- {
- if (!$this->hasStyle($name)) {
- throw new InvalidArgumentException(sprintf('Undefined style: "%s".', $name));
- }
- return $this->styles[strtolower($name)];
- }
- public function format(?string $message)
- {
- return $this->formatAndWrap($message, 0);
- }
- public function formatAndWrap(?string $message, int $width)
- {
- if (null === $message) {
- return '';
- }
- $offset = 0;
- $output = '';
- $openTagRegex = '[a-z](?:[^\\\\<>]*+ | \\\\.)*';
- $closeTagRegex = '[a-z][^<>]*+';
- $currentLineLength = 0;
- preg_match_all("#<(($openTagRegex) | /($closeTagRegex)?)>#ix", $message, $matches, \PREG_OFFSET_CAPTURE);
- foreach ($matches[0] as $i => $match) {
- $pos = $match[1];
- $text = $match[0];
- if (0 != $pos && '\\' == $message[$pos - 1]) {
- continue;
- }
- $output .= $this->applyCurrentStyle(substr($message, $offset, $pos - $offset), $output, $width, $currentLineLength);
- $offset = $pos + \strlen($text);
- if ($open = '/' != $text[1]) {
- $tag = $matches[1][$i][0];
- } else {
- $tag = $matches[3][$i][0] ?? '';
- }
- if (!$open && !$tag) {
- $this->styleStack->pop();
- } elseif (null === $style = $this->createStyleFromString($tag)) {
- $output .= $this->applyCurrentStyle($text, $output, $width, $currentLineLength);
- } elseif ($open) {
- $this->styleStack->push($style);
- } else {
- $this->styleStack->pop($style);
- }
- }
- $output .= $this->applyCurrentStyle(substr($message, $offset), $output, $width, $currentLineLength);
- return strtr($output, ["\0" => '\\', '\\<' => '<', '\\>' => '>']);
- }
- public function getStyleStack()
- {
- return $this->styleStack;
- }
- private function createStyleFromString(string $string): ?OutputFormatterStyleInterface
- {
- if (isset($this->styles[$string])) {
- return $this->styles[$string];
- }
- if (!preg_match_all('/([^=]+)=([^;]+)(;|$)/', $string, $matches, \PREG_SET_ORDER)) {
- return null;
- }
- $style = new OutputFormatterStyle();
- foreach ($matches as $match) {
- array_shift($match);
- $match[0] = strtolower($match[0]);
- if ('fg' == $match[0]) {
- $style->setForeground(strtolower($match[1]));
- } elseif ('bg' == $match[0]) {
- $style->setBackground(strtolower($match[1]));
- } elseif ('href' === $match[0]) {
- $url = preg_replace('{\\\\([<>])}', '$1', $match[1]);
- $style->setHref($url);
- } elseif ('options' === $match[0]) {
- preg_match_all('([^,;]+)', strtolower($match[1]), $options);
- $options = array_shift($options);
- foreach ($options as $option) {
- $style->setOption($option);
- }
- } else {
- return null;
- }
- }
- return $style;
- }
- private function applyCurrentStyle(string $text, string $current, int $width, int &$currentLineLength): string
- {
- if ('' === $text) {
- return '';
- }
- if (!$width) {
- return $this->isDecorated() ? $this->styleStack->getCurrent()->apply($text) : $text;
- }
- if (!$currentLineLength && '' !== $current) {
- $text = ltrim($text);
- }
- if ($currentLineLength) {
- $prefix = substr($text, 0, $i = $width - $currentLineLength)."\n";
- $text = substr($text, $i);
- } else {
- $prefix = '';
- }
- preg_match('~(\\n)$~', $text, $matches);
- $text = $prefix.preg_replace('~([^\\n]{'.$width.'})\\ *~', "\$1\n", $text);
- $text = rtrim($text, "\n").($matches[1] ?? '');
- if (!$currentLineLength && '' !== $current && "\n" !== substr($current, -1)) {
- $text = "\n".$text;
- }
- $lines = explode("\n", $text);
- foreach ($lines as $line) {
- $currentLineLength += \strlen($line);
- if ($width <= $currentLineLength) {
- $currentLineLength = 0;
- }
- }
- if ($this->isDecorated()) {
- foreach ($lines as $i => $line) {
- $lines[$i] = $this->styleStack->getCurrent()->apply($line);
- }
- }
- return implode("\n", $lines);
- }
- }
- <?php
- namespace Symfony\Component\Console\Formatter;
- interface OutputFormatterInterface
- {
- public function setDecorated(bool $decorated);
- public function isDecorated();
- public function setStyle(string $name, OutputFormatterStyleInterface $style);
- public function hasStyle(string $name);
- public function getStyle(string $name);
- public function format(?string $message);
- }
- <?php
- namespace Symfony\Component\Console\Formatter;
- use Symfony\Component\Console\Color;
- class OutputFormatterStyle implements OutputFormatterStyleInterface
- {
- private $color;
- private $foreground;
- private $background;
- private $options;
- private $href;
- private $handlesHrefGracefully;
- public function __construct(string $foreground = null, string $background = null, array $options = [])
- {
- $this->color = new Color($this->foreground = $foreground ?: '', $this->background = $background ?: '', $this->options = $options);
- }
- public function setForeground(string $color = null)
- {
- $this->color = new Color($this->foreground = $color ?: '', $this->background, $this->options);
- }
- public function setBackground(string $color = null)
- {
- $this->color = new Color($this->foreground, $this->background = $color ?: '', $this->options);
- }
- public function setHref(string $url): void
- {
- $this->href = $url;
- }
- public function setOption(string $option)
- {
- $this->options[] = $option;
- $this->color = new Color($this->foreground, $this->background, $this->options);
- }
- public function unsetOption(string $option)
- {
- $pos = array_search($option, $this->options);
- if (false !== $pos) {
- unset($this->options[$pos]);
- }
- $this->color = new Color($this->foreground, $this->background, $this->options);
- }
- public function setOptions(array $options)
- {
- $this->color = new Color($this->foreground, $this->background, $this->options = $options);
- }
- public function apply(string $text)
- {
- if (null === $this->handlesHrefGracefully) {
- $this->handlesHrefGracefully = 'JetBrains-JediTerm' !== getenv('TERMINAL_EMULATOR')
- && (!getenv('KONSOLE_VERSION') || (int) getenv('KONSOLE_VERSION') > 201100);
- }
- if (null !== $this->href && $this->handlesHrefGracefully) {
- $text = "\033]8;;$this->href\033\\$text\033]8;;\033\\";
- }
- return $this->color->apply($text);
- }
- }
- <?php
- namespace Symfony\Component\Console\Formatter;
- interface OutputFormatterStyleInterface
- {
- public function setForeground(string $color = null);
- public function setBackground(string $color = null);
- public function setOption(string $option);
- public function unsetOption(string $option);
- public function setOptions(array $options);
- public function apply(string $text);
- }
- <?php
- namespace Symfony\Component\Console\Formatter;
- use Symfony\Component\Console\Exception\InvalidArgumentException;
- use Symfony\Contracts\Service\ResetInterface;
- class OutputFormatterStyleStack implements ResetInterface
- {
- private $styles;
- private $emptyStyle;
- public function __construct(OutputFormatterStyleInterface $emptyStyle = null)
- {
- $this->emptyStyle = $emptyStyle ?? new OutputFormatterStyle();
- $this->reset();
- }
- public function reset()
- {
- $this->styles = [];
- }
- public function push(OutputFormatterStyleInterface $style)
- {
- $this->styles[] = $style;
- }
- public function pop(OutputFormatterStyleInterface $style = null)
- {
- if (empty($this->styles)) {
- return $this->emptyStyle;
- }
- if (null === $style) {
- return array_pop($this->styles);
- }
- foreach (array_reverse($this->styles, true) as $index => $stackedStyle) {
- if ($style->apply('') === $stackedStyle->apply('')) {
- $this->styles = \array_slice($this->styles, 0, $index);
- return $stackedStyle;
- }
- }
- throw new InvalidArgumentException('Incorrectly nested style tag found.');
- }
- public function getCurrent()
- {
- if (empty($this->styles)) {
- return $this->emptyStyle;
- }
- return $this->styles[\count($this->styles) - 1];
- }
- public function setEmptyStyle(OutputFormatterStyleInterface $emptyStyle)
- {
- $this->emptyStyle = $emptyStyle;
- return $this;
- }
- public function getEmptyStyle()
- {
- return $this->emptyStyle;
- }
- }
- <?php
- namespace Symfony\Component\Console\Formatter;
- interface WrappableOutputFormatterInterface extends OutputFormatterInterface
- {
- public function formatAndWrap(?string $message, int $width);
- }
- <?php
- namespace Symfony\Component\Console\Helper;
- class DebugFormatterHelper extends Helper
- {
- private const COLORS = ['black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white', 'default'];
- private $started = [];
- private $count = -1;
- public function start(string $id, string $message, string $prefix = 'RUN')
- {
- $this->started[$id] = ['border' => ++$this->count % \count(self::COLORS)];
- return sprintf("%s<bg=blue;fg=white> %s </> <fg=blue>%s</>\n", $this->getBorder($id), $prefix, $message);
- }
- public function progress(string $id, string $buffer, bool $error = false, string $prefix = 'OUT', string $errorPrefix = 'ERR')
- {
- $message = '';
- if ($error) {
- if (isset($this->started[$id]['out'])) {
- $message .= "\n";
- unset($this->started[$id]['out']);
- }
- if (!isset($this->started[$id]['err'])) {
- $message .= sprintf('%s<bg=red;fg=white> %s </> ', $this->getBorder($id), $errorPrefix);
- $this->started[$id]['err'] = true;
- }
- $message .= str_replace("\n", sprintf("\n%s<bg=red;fg=white> %s </> ", $this->getBorder($id), $errorPrefix), $buffer);
- } else {
- if (isset($this->started[$id]['err'])) {
- $message .= "\n";
- unset($this->started[$id]['err']);
- }
- if (!isset($this->started[$id]['out'])) {
- $message .= sprintf('%s<bg=green;fg=white> %s </> ', $this->getBorder($id), $prefix);
- $this->started[$id]['out'] = true;
- }
- $message .= str_replace("\n", sprintf("\n%s<bg=green;fg=white> %s </> ", $this->getBorder($id), $prefix), $buffer);
- }
- return $message;
- }
- public function stop(string $id, string $message, bool $successful, string $prefix = 'RES')
- {
- $trailingEOL = isset($this->started[$id]['out']) || isset($this->started[$id]['err']) ? "\n" : '';
- if ($successful) {
- return sprintf("%s%s<bg=green;fg=white> %s </> <fg=green>%s</>\n", $trailingEOL, $this->getBorder($id), $prefix, $message);
- }
- $message = sprintf("%s%s<bg=red;fg=white> %s </> <fg=red>%s</>\n", $trailingEOL, $this->getBorder($id), $prefix, $message);
- unset($this->started[$id]['out'], $this->started[$id]['err']);
- return $message;
- }
- private function getBorder(string $id): string
- {
- return sprintf('<bg=%s> </>', self::COLORS[$this->started[$id]['border']]);
- }
- public function getName()
- {
- return 'debug_formatter';
- }
- }
- <?php
- namespace Symfony\Component\Console\Helper;
- use Symfony\Component\Console\Descriptor\DescriptorInterface;
- use Symfony\Component\Console\Descriptor\JsonDescriptor;
- use Symfony\Component\Console\Descriptor\MarkdownDescriptor;
- use Symfony\Component\Console\Descriptor\TextDescriptor;
- use Symfony\Component\Console\Descriptor\XmlDescriptor;
- use Symfony\Component\Console\Exception\InvalidArgumentException;
- use Symfony\Component\Console\Output\OutputInterface;
- class DescriptorHelper extends Helper
- {
- private $descriptors = [];
- public function __construct()
- {
- $this
- ->register('txt', new TextDescriptor())
- ->register('xml', new XmlDescriptor())
- ->register('json', new JsonDescriptor())
- ->register('md', new MarkdownDescriptor())
- ;
- }
- public function describe(OutputInterface $output, ?object $object, array $options = [])
- {
- $options = array_merge([
- 'raw_text' => false,
- 'format' => 'txt',
- ], $options);
- if (!isset($this->descriptors[$options['format']])) {
- throw new InvalidArgumentException(sprintf('Unsupported format "%s".', $options['format']));
- }
- $descriptor = $this->descriptors[$options['format']];
- $descriptor->describe($output, $object, $options);
- }
- public function register(string $format, DescriptorInterface $descriptor)
- {
- $this->descriptors[$format] = $descriptor;
- return $this;
- }
- public function getName()
- {
- return 'descriptor';
- }
- public function getFormats(): array
- {
- return array_keys($this->descriptors);
- }
- }
- <?php
- namespace Symfony\Component\Console\Helper;
- use Symfony\Component\Console\Output\OutputInterface;
- use Symfony\Component\VarDumper\Cloner\ClonerInterface;
- use Symfony\Component\VarDumper\Cloner\VarCloner;
- use Symfony\Component\VarDumper\Dumper\CliDumper;
- final class Dumper
- {
- private $output;
- private $dumper;
- private $cloner;
- private $handler;
- public function __construct(OutputInterface $output, CliDumper $dumper = null, ClonerInterface $cloner = null)
- {
- $this->output = $output;
- $this->dumper = $dumper;
- $this->cloner = $cloner;
- if (class_exists(CliDumper::class)) {
- $this->handler = function ($var): string {
- $dumper = $this->dumper ?? $this->dumper = new CliDumper(null, null, CliDumper::DUMP_LIGHT_ARRAY | CliDumper::DUMP_COMMA_SEPARATOR);
- $dumper->setColors($this->output->isDecorated());
- return rtrim($dumper->dump(($this->cloner ?? $this->cloner = new VarCloner())->cloneVar($var)->withRefHandles(false), true));
- };
- } else {
- $this->handler = function ($var): string {
- switch (true) {
- case null === $var:
- return 'null';
- case true === $var:
- return 'true';
- case false === $var:
- return 'false';
- case \is_string($var):
- return '"'.$var.'"';
- default:
- return rtrim(print_r($var, true));
- }
- };
- }
- }
- public function __invoke($var): string
- {
- return ($this->handler)($var);
- }
- }
- <?php
- namespace Symfony\Component\Console\Helper;
- use Symfony\Component\Console\Formatter\OutputFormatter;
- class FormatterHelper extends Helper
- {
- public function formatSection(string $section, string $message, string $style = 'info')
- {
- return sprintf('<%s>[%s]</%s> %s', $style, $section, $style, $message);
- }
- public function formatBlock($messages, string $style, bool $large = false)
- {
- if (!\is_array($messages)) {
- $messages = [$messages];
- }
- $len = 0;
- $lines = [];
- foreach ($messages as $message) {
- $message = OutputFormatter::escape($message);
- $lines[] = sprintf($large ? ' %s ' : ' %s ', $message);
- $len = max(self::width($message) + ($large ? 4 : 2), $len);
- }
- $messages = $large ? [str_repeat(' ', $len)] : [];
- for ($i = 0; isset($lines[$i]); ++$i) {
- $messages[] = $lines[$i].str_repeat(' ', $len - self::width($lines[$i]));
- }
- if ($large) {
- $messages[] = str_repeat(' ', $len);
- }
- for ($i = 0; isset($messages[$i]); ++$i) {
- $messages[$i] = sprintf('<%s>%s</%s>', $style, $messages[$i], $style);
- }
- return implode("\n", $messages);
- }
- public function truncate(string $message, int $length, string $suffix = '...')
- {
- $computedLength = $length - self::width($suffix);
- if ($computedLength > self::width($message)) {
- return $message;
- }
- return self::substr($message, 0, $length).$suffix;
- }
- public function getName()
- {
- return 'formatter';
- }
- }
- <?php
- namespace Symfony\Component\Console\Helper;
- use Symfony\Component\Console\Formatter\OutputFormatterInterface;
- use Symfony\Component\String\UnicodeString;
- abstract class Helper implements HelperInterface
- {
- protected $helperSet = null;
- public function setHelperSet(HelperSet $helperSet = null)
- {
- $this->helperSet = $helperSet;
- }
- public function getHelperSet()
- {
- return $this->helperSet;
- }
- public static function strlen(?string $string)
- {
- 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__);
- return self::width($string);
- }
- public static function width(?string $string): int
- {
- $string ?? $string = '';
- if (preg_match('//u', $string)) {
- return (new UnicodeString($string))->width(false);
- }
- if (false === $encoding = mb_detect_encoding($string, null, true)) {
- return \strlen($string);
- }
- return mb_strwidth($string, $encoding);
- }
- public static function length(?string $string): int
- {
- $string ?? $string = '';
- if (preg_match('//u', $string)) {
- return (new UnicodeString($string))->length();
- }
- if (false === $encoding = mb_detect_encoding($string, null, true)) {
- return \strlen($string);
- }
- return mb_strlen($string, $encoding);
- }
- public static function substr(?string $string, int $from, int $length = null)
- {
- $string ?? $string = '';
- if (false === $encoding = mb_detect_encoding($string, null, true)) {
- return substr($string, $from, $length);
- }
- return mb_substr($string, $from, $length, $encoding);
- }
- public static function formatTime($secs)
- {
- static $timeFormats = [
- [0, '< 1 sec'],
- [1, '1 sec'],
- [2, 'secs', 1],
- [60, '1 min'],
- [120, 'mins', 60],
- [3600, '1 hr'],
- [7200, 'hrs', 3600],
- [86400, '1 day'],
- [172800, 'days', 86400],
- ];
- foreach ($timeFormats as $index => $format) {
- if ($secs >= $format[0]) {
- if ((isset($timeFormats[$index + 1]) && $secs < $timeFormats[$index + 1][0])
- || $index == \count($timeFormats) - 1
- ) {
- if (2 == \count($format)) {
- return $format[1];
- }
- return floor($secs / $format[2]).' '.$format[1];
- }
- }
- }
- }
- public static function formatMemory(int $memory)
- {
- if ($memory >= 1024 * 1024 * 1024) {
- return sprintf('%.1f GiB', $memory / 1024 / 1024 / 1024);
- }
- if ($memory >= 1024 * 1024) {
- return sprintf('%.1f MiB', $memory / 1024 / 1024);
- }
- if ($memory >= 1024) {
- return sprintf('%d KiB', $memory / 1024);
- }
- return sprintf('%d B', $memory);
- }
- public static function strlenWithoutDecoration(OutputFormatterInterface $formatter, ?string $string)
- {
- trigger_deprecation('symfony/console', '5.3', 'Method "%s()" is deprecated and will be removed in Symfony 6.0. Use Helper::removeDecoration() instead.', __METHOD__);
- return self::width(self::removeDecoration($formatter, $string));
- }
- public static function removeDecoration(OutputFormatterInterface $formatter, ?string $string)
- {
- $isDecorated = $formatter->isDecorated();
- $formatter->setDecorated(false);
- $string = $formatter->format($string ?? '');
- $string = preg_replace("/\033\[[^m]*m/", '', $string ?? '');
- $formatter->setDecorated($isDecorated);
- return $string;
- }
- }
- <?php
- namespace Symfony\Component\Console\Helper;
- interface HelperInterface
- {
- public function setHelperSet(HelperSet $helperSet = null);
- public function getHelperSet();
- public function getName();
- }
- <?php
- namespace Symfony\Component\Console\Helper;
- use Symfony\Component\Console\Command\Command;
- use Symfony\Component\Console\Exception\InvalidArgumentException;
- class HelperSet implements \IteratorAggregate
- {
- private $helpers = [];
- private $command;
- public function __construct(array $helpers = [])
- {
- foreach ($helpers as $alias => $helper) {
- $this->set($helper, \is_int($alias) ? null : $alias);
- }
- }
- public function set(HelperInterface $helper, string $alias = null)
- {
- $this->helpers[$helper->getName()] = $helper;
- if (null !== $alias) {
- $this->helpers[$alias] = $helper;
- }
- $helper->setHelperSet($this);
- }
- public function has(string $name)
- {
- return isset($this->helpers[$name]);
- }
- public function get(string $name)
- {
- if (!$this->has($name)) {
- throw new InvalidArgumentException(sprintf('The helper "%s" is not defined.', $name));
- }
- return $this->helpers[$name];
- }
- public function setCommand(Command $command = null)
- {
- trigger_deprecation('symfony/console', '5.4', 'Method "%s()" is deprecated.', __METHOD__);
- $this->command = $command;
- }
- public function getCommand()
- {
- trigger_deprecation('symfony/console', '5.4', 'Method "%s()" is deprecated.', __METHOD__);
- return $this->command;
- }
- #[\ReturnTypeWillChange]
- public function getIterator()
- {
- return new \ArrayIterator($this->helpers);
- }
- }
- <?php
- namespace Symfony\Component\Console\Helper;
- use Symfony\Component\Console\Input\InputAwareInterface;
- use Symfony\Component\Console\Input\InputInterface;
- abstract class InputAwareHelper extends Helper implements InputAwareInterface
- {
- protected $input;
- public function setInput(InputInterface $input)
- {
- $this->input = $input;
- }
- }
- <?php
- namespace Symfony\Component\Console\Helper;
- use Symfony\Component\Console\Output\ConsoleOutputInterface;
- use Symfony\Component\Console\Output\OutputInterface;
- use Symfony\Component\Process\Exception\ProcessFailedException;
- use Symfony\Component\Process\Process;
- class ProcessHelper extends Helper
- {
- public function run(OutputInterface $output, $cmd, string $error = null, callable $callback = null, int $verbosity = OutputInterface::VERBOSITY_VERY_VERBOSE): Process
- {
- if (!class_exists(Process::class)) {
- throw new \LogicException('The ProcessHelper cannot be run as the Process component is not installed. Try running "compose require symfony/process".');
- }
- if ($output instanceof ConsoleOutputInterface) {
- $output = $output->getErrorOutput();
- }
- $formatter = $this->getHelperSet()->get('debug_formatter');
- if ($cmd instanceof Process) {
- $cmd = [$cmd];
- }
- if (!\is_array($cmd)) {
- 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)));
- }
- if (\is_string($cmd[0] ?? null)) {
- $process = new Process($cmd);
- $cmd = [];
- } elseif (($cmd[0] ?? null) instanceof Process) {
- $process = $cmd[0];
- unset($cmd[0]);
- } else {
- 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__));
- }
- if ($verbosity <= $output->getVerbosity()) {
- $output->write($formatter->start(spl_object_hash($process), $this->escapeString($process->getCommandLine())));
- }
- if ($output->isDebug()) {
- $callback = $this->wrapCallback($output, $process, $callback);
- }
- $process->run($callback, $cmd);
- if ($verbosity <= $output->getVerbosity()) {
- $message = $process->isSuccessful() ? 'Command ran successfully' : sprintf('%s Command did not run successfully', $process->getExitCode());
- $output->write($formatter->stop(spl_object_hash($process), $message, $process->isSuccessful()));
- }
- if (!$process->isSuccessful() && null !== $error) {
- $output->writeln(sprintf('<error>%s</error>', $this->escapeString($error)));
- }
- return $process;
- }
- public function mustRun(OutputInterface $output, $cmd, string $error = null, callable $callback = null): Process
- {
- $process = $this->run($output, $cmd, $error, $callback);
- if (!$process->isSuccessful()) {
- throw new ProcessFailedException($process);
- }
- return $process;
- }
- public function wrapCallback(OutputInterface $output, Process $process, callable $callback = null): callable
- {
- if ($output instanceof ConsoleOutputInterface) {
- $output = $output->getErrorOutput();
- }
- $formatter = $this->getHelperSet()->get('debug_formatter');
- return function ($type, $buffer) use ($output, $process, $callback, $formatter) {
- $output->write($formatter->progress(spl_object_hash($process), $this->escapeString($buffer), Process::ERR === $type));
- if (null !== $callback) {
- $callback($type, $buffer);
- }
- };
- }
- private function escapeString(string $str): string
- {
- return str_replace('<', '\\<', $str);
- }
- public function getName(): string
- {
- return 'process';
- }
- }
- <?php
- namespace Symfony\Component\Console\Helper;
- use Symfony\Component\Console\Cursor;
- use Symfony\Component\Console\Exception\LogicException;
- use Symfony\Component\Console\Output\ConsoleOutputInterface;
- use Symfony\Component\Console\Output\ConsoleSectionOutput;
- use Symfony\Component\Console\Output\OutputInterface;
- use Symfony\Component\Console\Terminal;
- final class ProgressBar
- {
- public const FORMAT_VERBOSE = 'verbose';
- public const FORMAT_VERY_VERBOSE = 'very_verbose';
- public const FORMAT_DEBUG = 'debug';
- public const FORMAT_NORMAL = 'normal';
- private const FORMAT_VERBOSE_NOMAX = 'verbose_nomax';
- private const FORMAT_VERY_VERBOSE_NOMAX = 'very_verbose_nomax';
- private const FORMAT_DEBUG_NOMAX = 'debug_nomax';
- private const FORMAT_NORMAL_NOMAX = 'normal_nomax';
- private $barWidth = 28;
- private $barChar;
- private $emptyBarChar = '-';
- private $progressChar = '>';
- private $format;
- private $internalFormat;
- private $redrawFreq = 1;
- private $writeCount;
- private $lastWriteTime;
- private $minSecondsBetweenRedraws = 0;
- private $maxSecondsBetweenRedraws = 1;
- private $output;
- private $step = 0;
- private $max;
- private $startTime;
- private $stepWidth;
- private $percent = 0.0;
- private $formatLineCount;
- private $messages = [];
- private $overwrite = true;
- private $terminal;
- private $previousMessage;
- private $cursor;
- private static $formatters;
- private static $formats;
- public function __construct(OutputInterface $output, int $max = 0, float $minSecondsBetweenRedraws = 1 / 25)
- {
- if ($output instanceof ConsoleOutputInterface) {
- $output = $output->getErrorOutput();
- }
- $this->output = $output;
- $this->setMaxSteps($max);
- $this->terminal = new Terminal();
- if (0 < $minSecondsBetweenRedraws) {
- $this->redrawFreq = null;
- $this->minSecondsBetweenRedraws = $minSecondsBetweenRedraws;
- }
- if (!$this->output->isDecorated()) {
- $this->overwrite = false;
- $this->redrawFreq = null;
- }
- $this->startTime = time();
- $this->cursor = new Cursor($output);
- }
- public static function setPlaceholderFormatterDefinition(string $name, callable $callable): void
- {
- if (!self::$formatters) {
- self::$formatters = self::initPlaceholderFormatters();
- }
- self::$formatters[$name] = $callable;
- }
- public static function getPlaceholderFormatterDefinition(string $name): ?callable
- {
- if (!self::$formatters) {
- self::$formatters = self::initPlaceholderFormatters();
- }
- return self::$formatters[$name] ?? null;
- }
- public static function setFormatDefinition(string $name, string $format): void
- {
- if (!self::$formats) {
- self::$formats = self::initFormats();
- }
- self::$formats[$name] = $format;
- }
- public static function getFormatDefinition(string $name): ?string
- {
- if (!self::$formats) {
- self::$formats = self::initFormats();
- }
- return self::$formats[$name] ?? null;
- }
- public function setMessage(string $message, string $name = 'message')
- {
- $this->messages[$name] = $message;
- }
- public function getMessage(string $name = 'message')
- {
- return $this->messages[$name];
- }
- public function getStartTime(): int
- {
- return $this->startTime;
- }
- public function getMaxSteps(): int
- {
- return $this->max;
- }
- public function getProgress(): int
- {
- return $this->step;
- }
- private function getStepWidth(): int
- {
- return $this->stepWidth;
- }
- public function getProgressPercent(): float
- {
- return $this->percent;
- }
- public function getBarOffset(): float
- {
- return floor($this->max ? $this->percent * $this->barWidth : (null === $this->redrawFreq ? (int) (min(5, $this->barWidth / 15) * $this->writeCount) : $this->step) % $this->barWidth);
- }
- public function getEstimated(): float
- {
- if (!$this->step) {
- return 0;
- }
- return round((time() - $this->startTime) / $this->step * $this->max);
- }
- public function getRemaining(): float
- {
- if (!$this->step) {
- return 0;
- }
- return round((time() - $this->startTime) / $this->step * ($this->max - $this->step));
- }
- public function setBarWidth(int $size)
- {
- $this->barWidth = max(1, $size);
- }
- public function getBarWidth(): int
- {
- return $this->barWidth;
- }
- public function setBarCharacter(string $char)
- {
- $this->barChar = $char;
- }
- public function getBarCharacter(): string
- {
- return $this->barChar ?? ($this->max ? '=' : $this->emptyBarChar);
- }
- public function setEmptyBarCharacter(string $char)
- {
- $this->emptyBarChar = $char;
- }
- public function getEmptyBarCharacter(): string
- {
- return $this->emptyBarChar;
- }
- public function setProgressCharacter(string $char)
- {
- $this->progressChar = $char;
- }
- public function getProgressCharacter(): string
- {
- return $this->progressChar;
- }
- public function setFormat(string $format)
- {
- $this->format = null;
- $this->internalFormat = $format;
- }
- public function setRedrawFrequency(?int $freq)
- {
- $this->redrawFreq = null !== $freq ? max(1, $freq) : null;
- }
- public function minSecondsBetweenRedraws(float $seconds): void
- {
- $this->minSecondsBetweenRedraws = $seconds;
- }
- public function maxSecondsBetweenRedraws(float $seconds): void
- {
- $this->maxSecondsBetweenRedraws = $seconds;
- }
- public function iterate(iterable $iterable, int $max = null): iterable
- {
- $this->start($max ?? (is_countable($iterable) ? \count($iterable) : 0));
- foreach ($iterable as $key => $value) {
- yield $key => $value;
- $this->advance();
- }
- $this->finish();
- }
- public function start(int $max = null)
- {
- $this->startTime = time();
- $this->step = 0;
- $this->percent = 0.0;
- if (null !== $max) {
- $this->setMaxSteps($max);
- }
- $this->display();
- }
- public function advance(int $step = 1)
- {
- $this->setProgress($this->step + $step);
- }
- public function setOverwrite(bool $overwrite)
- {
- $this->overwrite = $overwrite;
- }
- public function setProgress(int $step)
- {
- if ($this->max && $step > $this->max) {
- $this->max = $step;
- } elseif ($step < 0) {
- $step = 0;
- }
- $redrawFreq = $this->redrawFreq ?? (($this->max ?: 10) / 10);
- $prevPeriod = (int) ($this->step / $redrawFreq);
- $currPeriod = (int) ($step / $redrawFreq);
- $this->step = $step;
- $this->percent = $this->max ? (float) $this->step / $this->max : 0;
- $timeInterval = microtime(true) - $this->lastWriteTime;
- if ($this->max === $step) {
- $this->display();
- return;
- }
- if ($timeInterval < $this->minSecondsBetweenRedraws) {
- return;
- }
- if ($prevPeriod !== $currPeriod || $timeInterval >= $this->maxSecondsBetweenRedraws) {
- $this->display();
- }
- }
- public function setMaxSteps(int $max)
- {
- $this->format = null;
- $this->max = max(0, $max);
- $this->stepWidth = $this->max ? Helper::width((string) $this->max) : 4;
- }
- public function finish(): void
- {
- if (!$this->max) {
- $this->max = $this->step;
- }
- if ($this->step === $this->max && !$this->overwrite) {
- return;
- }
- $this->setProgress($this->max);
- }
- public function display(): void
- {
- if (OutputInterface::VERBOSITY_QUIET === $this->output->getVerbosity()) {
- return;
- }
- if (null === $this->format) {
- $this->setRealFormat($this->internalFormat ?: $this->determineBestFormat());
- }
- $this->overwrite($this->buildLine());
- }
- public function clear(): void
- {
- if (!$this->overwrite) {
- return;
- }
- if (null === $this->format) {
- $this->setRealFormat($this->internalFormat ?: $this->determineBestFormat());
- }
- $this->overwrite('');
- }
- private function setRealFormat(string $format)
- {
- if (!$this->max && null !== self::getFormatDefinition($format.'_nomax')) {
- $this->format = self::getFormatDefinition($format.'_nomax');
- } elseif (null !== self::getFormatDefinition($format)) {
- $this->format = self::getFormatDefinition($format);
- } else {
- $this->format = $format;
- }
- $this->formatLineCount = substr_count($this->format, "\n");
- }
- private function overwrite(string $message): void
- {
- if ($this->previousMessage === $message) {
- return;
- }
- $originalMessage = $message;
- if ($this->overwrite) {
- if (null !== $this->previousMessage) {
- if ($this->output instanceof ConsoleSectionOutput) {
- $messageLines = explode("\n", $message);
- $lineCount = \count($messageLines);
- foreach ($messageLines as $messageLine) {
- $messageLineLength = Helper::width(Helper::removeDecoration($this->output->getFormatter(), $messageLine));
- if ($messageLineLength > $this->terminal->getWidth()) {
- $lineCount += floor($messageLineLength / $this->terminal->getWidth());
- }
- }
- $this->output->clear($lineCount);
- } else {
- for ($i = 0; $i < $this->formatLineCount; ++$i) {
- $this->cursor->moveToColumn(1);
- $this->cursor->clearLine();
- $this->cursor->moveUp();
- }
- $this->cursor->moveToColumn(1);
- $this->cursor->clearLine();
- }
- }
- } elseif ($this->step > 0) {
- $message = \PHP_EOL.$message;
- }
- $this->previousMessage = $originalMessage;
- $this->lastWriteTime = microtime(true);
- $this->output->write($message);
- ++$this->writeCount;
- }
- private function determineBestFormat(): string
- {
- switch ($this->output->getVerbosity()) {
- case OutputInterface::VERBOSITY_VERBOSE:
- return $this->max ? self::FORMAT_VERBOSE : self::FORMAT_VERBOSE_NOMAX;
- case OutputInterface::VERBOSITY_VERY_VERBOSE:
- return $this->max ? self::FORMAT_VERY_VERBOSE : self::FORMAT_VERY_VERBOSE_NOMAX;
- case OutputInterface::VERBOSITY_DEBUG:
- return $this->max ? self::FORMAT_DEBUG : self::FORMAT_DEBUG_NOMAX;
- default:
- return $this->max ? self::FORMAT_NORMAL : self::FORMAT_NORMAL_NOMAX;
- }
- }
- private static function initPlaceholderFormatters(): array
- {
- return [
- 'bar' => function (self $bar, OutputInterface $output) {
- $completeBars = $bar->getBarOffset();
- $display = str_repeat($bar->getBarCharacter(), $completeBars);
- if ($completeBars < $bar->getBarWidth()) {
- $emptyBars = $bar->getBarWidth() - $completeBars - Helper::length(Helper::removeDecoration($output->getFormatter(), $bar->getProgressCharacter()));
- $display .= $bar->getProgressCharacter().str_repeat($bar->getEmptyBarCharacter(), $emptyBars);
- }
- return $display;
- },
- 'elapsed' => function (self $bar) {
- return Helper::formatTime(time() - $bar->getStartTime());
- },
- 'remaining' => function (self $bar) {
- if (!$bar->getMaxSteps()) {
- throw new LogicException('Unable to display the remaining time if the maximum number of steps is not set.');
- }
- return Helper::formatTime($bar->getRemaining());
- },
- 'estimated' => function (self $bar) {
- if (!$bar->getMaxSteps()) {
- throw new LogicException('Unable to display the estimated time if the maximum number of steps is not set.');
- }
- return Helper::formatTime($bar->getEstimated());
- },
- 'memory' => function (self $bar) {
- return Helper::formatMemory(memory_get_usage(true));
- },
- 'current' => function (self $bar) {
- return str_pad($bar->getProgress(), $bar->getStepWidth(), ' ', \STR_PAD_LEFT);
- },
- 'max' => function (self $bar) {
- return $bar->getMaxSteps();
- },
- 'percent' => function (self $bar) {
- return floor($bar->getProgressPercent() * 100);
- },
- ];
- }
- private static function initFormats(): array
- {
- return [
- self::FORMAT_NORMAL => ' %current%/%max% [%bar%] %percent:3s%%',
- self::FORMAT_NORMAL_NOMAX => ' %current% [%bar%]',
- self::FORMAT_VERBOSE => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%',
- self::FORMAT_VERBOSE_NOMAX => ' %current% [%bar%] %elapsed:6s%',
- self::FORMAT_VERY_VERBOSE => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s%',
- self::FORMAT_VERY_VERBOSE_NOMAX => ' %current% [%bar%] %elapsed:6s%',
- self::FORMAT_DEBUG => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s% %memory:6s%',
- self::FORMAT_DEBUG_NOMAX => ' %current% [%bar%] %elapsed:6s% %memory:6s%',
- ];
- }
- private function buildLine(): string
- {
- $regex = "{%([a-z\-_]+)(?:\:([^%]+))?%}i";
- $callback = function ($matches) {
- if ($formatter = $this::getPlaceholderFormatterDefinition($matches[1])) {
- $text = $formatter($this, $this->output);
- } elseif (isset($this->messages[$matches[1]])) {
- $text = $this->messages[$matches[1]];
- } else {
- return $matches[0];
- }
- if (isset($matches[2])) {
- $text = sprintf('%'.$matches[2], $text);
- }
- return $text;
- };
- $line = preg_replace_callback($regex, $callback, $this->format);
- $linesLength = array_map(function ($subLine) {
- return Helper::width(Helper::removeDecoration($this->output->getFormatter(), rtrim($subLine, "\r")));
- }, explode("\n", $line));
- $linesWidth = max($linesLength);
- $terminalWidth = $this->terminal->getWidth();
- if ($linesWidth <= $terminalWidth) {
- return $line;
- }
- $this->setBarWidth($this->barWidth - $linesWidth + $terminalWidth);
- return preg_replace_callback($regex, $callback, $this->format);
- }
- }
- <?php
- namespace Symfony\Component\Console\Helper;
- use Symfony\Component\Console\Exception\InvalidArgumentException;
- use Symfony\Component\Console\Exception\LogicException;
- use Symfony\Component\Console\Output\OutputInterface;
- class ProgressIndicator
- {
- private const FORMATS = [
- 'normal' => ' %indicator% %message%',
- 'normal_no_ansi' => ' %message%',
- 'verbose' => ' %indicator% %message% (%elapsed:6s%)',
- 'verbose_no_ansi' => ' %message% (%elapsed:6s%)',
- 'very_verbose' => ' %indicator% %message% (%elapsed:6s%, %memory:6s%)',
- 'very_verbose_no_ansi' => ' %message% (%elapsed:6s%, %memory:6s%)',
- ];
- private $output;
- private $startTime;
- private $format;
- private $message;
- private $indicatorValues;
- private $indicatorCurrent;
- private $indicatorChangeInterval;
- private $indicatorUpdateTime;
- private $started = false;
- private static $formatters;
- public function __construct(OutputInterface $output, string $format = null, int $indicatorChangeInterval = 100, array $indicatorValues = null)
- {
- $this->output = $output;
- if (null === $format) {
- $format = $this->determineBestFormat();
- }
- if (null === $indicatorValues) {
- $indicatorValues = ['-', '\\', '|', '/'];
- }
- $indicatorValues = array_values($indicatorValues);
- if (2 > \count($indicatorValues)) {
- throw new InvalidArgumentException('Must have at least 2 indicator value characters.');
- }
- $this->format = self::getFormatDefinition($format);
- $this->indicatorChangeInterval = $indicatorChangeInterval;
- $this->indicatorValues = $indicatorValues;
- $this->startTime = time();
- }
- public function setMessage(?string $message)
- {
- $this->message = $message;
- $this->display();
- }
- public function start(string $message)
- {
- if ($this->started) {
- throw new LogicException('Progress indicator already started.');
- }
- $this->message = $message;
- $this->started = true;
- $this->startTime = time();
- $this->indicatorUpdateTime = $this->getCurrentTimeInMilliseconds() + $this->indicatorChangeInterval;
- $this->indicatorCurrent = 0;
- $this->display();
- }
- public function advance()
- {
- if (!$this->started) {
- throw new LogicException('Progress indicator has not yet been started.');
- }
- if (!$this->output->isDecorated()) {
- return;
- }
- $currentTime = $this->getCurrentTimeInMilliseconds();
- if ($currentTime < $this->indicatorUpdateTime) {
- return;
- }
- $this->indicatorUpdateTime = $currentTime + $this->indicatorChangeInterval;
- ++$this->indicatorCurrent;
- $this->display();
- }
- public function finish(string $message)
- {
- if (!$this->started) {
- throw new LogicException('Progress indicator has not yet been started.');
- }
- $this->message = $message;
- $this->display();
- $this->output->writeln('');
- $this->started = false;
- }
- public static function getFormatDefinition(string $name)
- {
- return self::FORMATS[$name] ?? null;
- }
- public static function setPlaceholderFormatterDefinition(string $name, callable $callable)
- {
- if (!self::$formatters) {
- self::$formatters = self::initPlaceholderFormatters();
- }
- self::$formatters[$name] = $callable;
- }
- public static function getPlaceholderFormatterDefinition(string $name)
- {
- if (!self::$formatters) {
- self::$formatters = self::initPlaceholderFormatters();
- }
- return self::$formatters[$name] ?? null;
- }
- private function display()
- {
- if (OutputInterface::VERBOSITY_QUIET === $this->output->getVerbosity()) {
- return;
- }
- $this->overwrite(preg_replace_callback("{%([a-z\-_]+)(?:\:([^%]+))?%}i", function ($matches) {
- if ($formatter = self::getPlaceholderFormatterDefinition($matches[1])) {
- return $formatter($this);
- }
- return $matches[0];
- }, $this->format ?? ''));
- }
- private function determineBestFormat(): string
- {
- switch ($this->output->getVerbosity()) {
- case OutputInterface::VERBOSITY_VERBOSE:
- return $this->output->isDecorated() ? 'verbose' : 'verbose_no_ansi';
- case OutputInterface::VERBOSITY_VERY_VERBOSE:
- case OutputInterface::VERBOSITY_DEBUG:
- return $this->output->isDecorated() ? 'very_verbose' : 'very_verbose_no_ansi';
- default:
- return $this->output->isDecorated() ? 'normal' : 'normal_no_ansi';
- }
- }
- private function overwrite(string $message)
- {
- if ($this->output->isDecorated()) {
- $this->output->write("\x0D\x1B[2K");
- $this->output->write($message);
- } else {
- $this->output->writeln($message);
- }
- }
- private function getCurrentTimeInMilliseconds(): float
- {
- return round(microtime(true) * 1000);
- }
- private static function initPlaceholderFormatters(): array
- {
- return [
- 'indicator' => function (self $indicator) {
- return $indicator->indicatorValues[$indicator->indicatorCurrent % \count($indicator->indicatorValues)];
- },
- 'message' => function (self $indicator) {
- return $indicator->message;
- },
- 'elapsed' => function (self $indicator) {
- return Helper::formatTime(time() - $indicator->startTime);
- },
- 'memory' => function () {
- return Helper::formatMemory(memory_get_usage(true));
- },
- ];
- }
- }
- <?php
- namespace Symfony\Component\Console\Helper;
- use Symfony\Component\Console\Cursor;
- use Symfony\Component\Console\Exception\MissingInputException;
- use Symfony\Component\Console\Exception\RuntimeException;
- use Symfony\Component\Console\Formatter\OutputFormatter;
- use Symfony\Component\Console\Formatter\OutputFormatterStyle;
- use Symfony\Component\Console\Input\InputInterface;
- use Symfony\Component\Console\Input\StreamableInputInterface;
- use Symfony\Component\Console\Output\ConsoleOutputInterface;
- use Symfony\Component\Console\Output\ConsoleSectionOutput;
- use Symfony\Component\Console\Output\OutputInterface;
- use Symfony\Component\Console\Question\ChoiceQuestion;
- use Symfony\Component\Console\Question\Question;
- use Symfony\Component\Console\Terminal;
- use function Symfony\Component\String\s;
- class QuestionHelper extends Helper
- {
- private $inputStream;
- private static $stty = true;
- private static $stdinIsInteractive;
- public function ask(InputInterface $input, OutputInterface $output, Question $question)
- {
- if ($output instanceof ConsoleOutputInterface) {
- $output = $output->getErrorOutput();
- }
- if (!$input->isInteractive()) {
- return $this->getDefaultAnswer($question);
- }
- if ($input instanceof StreamableInputInterface && $stream = $input->getStream()) {
- $this->inputStream = $stream;
- }
- try {
- if (!$question->getValidator()) {
- return $this->doAsk($output, $question);
- }
- $interviewer = function () use ($output, $question) {
- return $this->doAsk($output, $question);
- };
- return $this->validateAttempts($interviewer, $output, $question);
- } catch (MissingInputException $exception) {
- $input->setInteractive(false);
- if (null === $fallbackOutput = $this->getDefaultAnswer($question)) {
- throw $exception;
- }
- return $fallbackOutput;
- }
- }
- public function getName()
- {
- return 'question';
- }
- public static function disableStty()
- {
- self::$stty = false;
- }
- private function doAsk(OutputInterface $output, Question $question)
- {
- $this->writePrompt($output, $question);
- $inputStream = $this->inputStream ?: \STDIN;
- $autocomplete = $question->getAutocompleterCallback();
- if (null === $autocomplete || !self::$stty || !Terminal::hasSttyAvailable()) {
- $ret = false;
- if ($question->isHidden()) {
- try {
- $hiddenResponse = $this->getHiddenResponse($output, $inputStream, $question->isTrimmable());
- $ret = $question->isTrimmable() ? trim($hiddenResponse) : $hiddenResponse;
- } catch (RuntimeException $e) {
- if (!$question->isHiddenFallback()) {
- throw $e;
- }
- }
- }
- if (false === $ret) {
- $ret = $this->readInput($inputStream, $question);
- if (false === $ret) {
- throw new MissingInputException('Aborted.');
- }
- if ($question->isTrimmable()) {
- $ret = trim($ret);
- }
- }
- } else {
- $autocomplete = $this->autocomplete($output, $question, $inputStream, $autocomplete);
- $ret = $question->isTrimmable() ? trim($autocomplete) : $autocomplete;
- }
- if ($output instanceof ConsoleSectionOutput) {
- $output->addContent($ret);
- }
- $ret = \strlen($ret) > 0 ? $ret : $question->getDefault();
- if ($normalizer = $question->getNormalizer()) {
- return $normalizer($ret);
- }
- return $ret;
- }
- private function getDefaultAnswer(Question $question)
- {
- $default = $question->getDefault();
- if (null === $default) {
- return $default;
- }
- if ($validator = $question->getValidator()) {
- return \call_user_func($question->getValidator(), $default);
- } elseif ($question instanceof ChoiceQuestion) {
- $choices = $question->getChoices();
- if (!$question->isMultiselect()) {
- return $choices[$default] ?? $default;
- }
- $default = explode(',', $default);
- foreach ($default as $k => $v) {
- $v = $question->isTrimmable() ? trim($v) : $v;
- $default[$k] = $choices[$v] ?? $v;
- }
- }
- return $default;
- }
- protected function writePrompt(OutputInterface $output, Question $question)
- {
- $message = $question->getQuestion();
- if ($question instanceof ChoiceQuestion) {
- $output->writeln(array_merge([
- $question->getQuestion(),
- ], $this->formatChoiceQuestionChoices($question, 'info')));
- $message = $question->getPrompt();
- }
- $output->write($message);
- }
- protected function formatChoiceQuestionChoices(ChoiceQuestion $question, string $tag)
- {
- $messages = [];
- $maxWidth = max(array_map([__CLASS__, 'width'], array_keys($choices = $question->getChoices())));
- foreach ($choices as $key => $value) {
- $padding = str_repeat(' ', $maxWidth - self::width($key));
- $messages[] = sprintf(" [<$tag>%s$padding</$tag>] %s", $key, $value);
- }
- return $messages;
- }
- protected function writeError(OutputInterface $output, \Exception $error)
- {
- if (null !== $this->getHelperSet() && $this->getHelperSet()->has('formatter')) {
- $message = $this->getHelperSet()->get('formatter')->formatBlock($error->getMessage(), 'error');
- } else {
- $message = '<error>'.$error->getMessage().'</error>';
- }
- $output->writeln($message);
- }
- private function autocomplete(OutputInterface $output, Question $question, $inputStream, callable $autocomplete): string
- {
- $cursor = new Cursor($output, $inputStream);
- $fullChoice = '';
- $ret = '';
- $i = 0;
- $ofs = -1;
- $matches = $autocomplete($ret);
- $numMatches = \count($matches);
- $sttyMode = shell_exec('stty -g');
- $isStdin = 'php://stdin' === (stream_get_meta_data($inputStream)['uri'] ?? null);
- $r = [$inputStream];
- $w = [];
- shell_exec('stty -icanon -echo');
- $output->getFormatter()->setStyle('hl', new OutputFormatterStyle('black', 'white'));
- while (!feof($inputStream)) {
- while ($isStdin && 0 === @stream_select($r, $w, $w, 0, 100)) {
- $r = [$inputStream];
- }
- $c = fread($inputStream, 1);
- if (false === $c || ('' === $ret && '' === $c && null === $question->getDefault())) {
- shell_exec('stty '.$sttyMode);
- throw new MissingInputException('Aborted.');
- } elseif ("\177" === $c) {
- if (0 === $numMatches && 0 !== $i) {
- --$i;
- $cursor->moveLeft(s($fullChoice)->slice(-1)->width(false));
- $fullChoice = self::substr($fullChoice, 0, $i);
- }
- if (0 === $i) {
- $ofs = -1;
- $matches = $autocomplete($ret);
- $numMatches = \count($matches);
- } else {
- $numMatches = 0;
- }
- $ret = self::substr($ret, 0, $i);
- } elseif ("\033" === $c) {
- $c .= fread($inputStream, 2);
- if (isset($c[2]) && ('A' === $c[2] || 'B' === $c[2])) {
- if ('A' === $c[2] && -1 === $ofs) {
- $ofs = 0;
- }
- if (0 === $numMatches) {
- continue;
- }
- $ofs += ('A' === $c[2]) ? -1 : 1;
- $ofs = ($numMatches + $ofs) % $numMatches;
- }
- } elseif (\ord($c) < 32) {
- if ("\t" === $c || "\n" === $c) {
- if ($numMatches > 0 && -1 !== $ofs) {
- $ret = (string) $matches[$ofs];
- $remainingCharacters = substr($ret, \strlen(trim($this->mostRecentlyEnteredValue($fullChoice))));
- $output->write($remainingCharacters);
- $fullChoice .= $remainingCharacters;
- $i = (false === $encoding = mb_detect_encoding($fullChoice, null, true)) ? \strlen($fullChoice) : mb_strlen($fullChoice, $encoding);
- $matches = array_filter(
- $autocomplete($ret),
- function ($match) use ($ret) {
- return '' === $ret || str_starts_with($match, $ret);
- }
- );
- $numMatches = \count($matches);
- $ofs = -1;
- }
- if ("\n" === $c) {
- $output->write($c);
- break;
- }
- $numMatches = 0;
- }
- continue;
- } else {
- if ("\x80" <= $c) {
- $c .= fread($inputStream, ["\xC0" => 1, "\xD0" => 1, "\xE0" => 2, "\xF0" => 3][$c & "\xF0"]);
- }
- $output->write($c);
- $ret .= $c;
- $fullChoice .= $c;
- ++$i;
- $tempRet = $ret;
- if ($question instanceof ChoiceQuestion && $question->isMultiselect()) {
- $tempRet = $this->mostRecentlyEnteredValue($fullChoice);
- }
- $numMatches = 0;
- $ofs = 0;
- foreach ($autocomplete($ret) as $value) {
- if (str_starts_with($value, $tempRet)) {
- $matches[$numMatches++] = $value;
- }
- }
- }
- $cursor->clearLineAfter();
- if ($numMatches > 0 && -1 !== $ofs) {
- $cursor->savePosition();
- $charactersEntered = \strlen(trim($this->mostRecentlyEnteredValue($fullChoice)));
- $output->write('<hl>'.OutputFormatter::escapeTrailingBackslash(substr($matches[$ofs], $charactersEntered)).'</hl>');
- $cursor->restorePosition();
- }
- }
- shell_exec('stty '.$sttyMode);
- return $fullChoice;
- }
- private function mostRecentlyEnteredValue(string $entered): string
- {
- if (!str_contains($entered, ',')) {
- return $entered;
- }
- $choices = explode(',', $entered);
- if ('' !== $lastChoice = trim($choices[\count($choices) - 1])) {
- return $lastChoice;
- }
- return $entered;
- }
- private function getHiddenResponse(OutputInterface $output, $inputStream, bool $trimmable = true): string
- {
- if ('\\' === \DIRECTORY_SEPARATOR) {
- $exe = __DIR__.'/../Resources/bin/hiddeninput.exe';
- if ('phar:' === substr(__FILE__, 0, 5)) {
- $tmpExe = sys_get_temp_dir().'/hiddeninput.exe';
- copy($exe, $tmpExe);
- $exe = $tmpExe;
- }
- $sExec = shell_exec('"'.$exe.'"');
- $value = $trimmable ? rtrim($sExec) : $sExec;
- $output->writeln('');
- if (isset($tmpExe)) {
- unlink($tmpExe);
- }
- return $value;
- }
- if (self::$stty && Terminal::hasSttyAvailable()) {
- $sttyMode = shell_exec('stty -g');
- shell_exec('stty -echo');
- } elseif ($this->isInteractiveInput($inputStream)) {
- throw new RuntimeException('Unable to hide the response.');
- }
- $value = fgets($inputStream, 4096);
- if (self::$stty && Terminal::hasSttyAvailable()) {
- shell_exec('stty '.$sttyMode);
- }
- if (false === $value) {
- throw new MissingInputException('Aborted.');
- }
- if ($trimmable) {
- $value = trim($value);
- }
- $output->writeln('');
- return $value;
- }
- private function validateAttempts(callable $interviewer, OutputInterface $output, Question $question)
- {
- $error = null;
- $attempts = $question->getMaxAttempts();
- while (null === $attempts || $attempts--) {
- if (null !== $error) {
- $this->writeError($output, $error);
- }
- try {
- return $question->getValidator()($interviewer());
- } catch (RuntimeException $e) {
- throw $e;
- } catch (\Exception $error) {
- }
- }
- throw $error;
- }
- private function isInteractiveInput($inputStream): bool
- {
- if ('php://stdin' !== (stream_get_meta_data($inputStream)['uri'] ?? null)) {
- return false;
- }
- if (null !== self::$stdinIsInteractive) {
- return self::$stdinIsInteractive;
- }
- if (\function_exists('stream_isatty')) {
- return self::$stdinIsInteractive = @stream_isatty(fopen('php://stdin', 'r'));
- }
- if (\function_exists('posix_isatty')) {
- return self::$stdinIsInteractive = @posix_isatty(fopen('php://stdin', 'r'));
- }
- if (!\function_exists('exec')) {
- return self::$stdinIsInteractive = true;
- }
- exec('stty 2> /dev/null', $output, $status);
- return self::$stdinIsInteractive = 1 !== $status;
- }
- private function readInput($inputStream, Question $question)
- {
- if (!$question->isMultiline()) {
- $cp = $this->setIOCodepage();
- $ret = fgets($inputStream, 4096);
- return $this->resetIOCodepage($cp, $ret);
- }
- $multiLineStreamReader = $this->cloneInputStream($inputStream);
- if (null === $multiLineStreamReader) {
- return false;
- }
- $ret = '';
- $cp = $this->setIOCodepage();
- while (false !== ($char = fgetc($multiLineStreamReader))) {
- if (\PHP_EOL === "{$ret}{$char}") {
- break;
- }
- $ret .= $char;
- }
- return $this->resetIOCodepage($cp, $ret);
- }
- private function setIOCodepage(): int
- {
- if (\function_exists('sapi_windows_cp_set')) {
- $cp = sapi_windows_cp_get();
- sapi_windows_cp_set(sapi_windows_cp_get('oem'));
- return $cp;
- }
- return 0;
- }
- private function resetIOCodepage(int $cp, $input)
- {
- if (0 !== $cp) {
- sapi_windows_cp_set($cp);
- if (false !== $input && '' !== $input) {
- $input = sapi_windows_cp_conv(sapi_windows_cp_get('oem'), $cp, $input);
- }
- }
- return $input;
- }
- private function cloneInputStream($inputStream)
- {
- $streamMetaData = stream_get_meta_data($inputStream);
- $seekable = $streamMetaData['seekable'] ?? false;
- $mode = $streamMetaData['mode'] ?? 'rb';
- $uri = $streamMetaData['uri'] ?? null;
- if (null === $uri) {
- return null;
- }
- $cloneStream = fopen($uri, $mode);
- if (true === $seekable && !\in_array($mode, ['r', 'rb', 'rt'])) {
- $offset = ftell($inputStream);
- rewind($inputStream);
- stream_copy_to_stream($inputStream, $cloneStream);
- fseek($inputStream, $offset);
- fseek($cloneStream, $offset);
- }
- return $cloneStream;
- }
- }
- <?php
- namespace Symfony\Component\Console\Helper;
- use Symfony\Component\Console\Formatter\OutputFormatter;
- use Symfony\Component\Console\Output\OutputInterface;
- use Symfony\Component\Console\Question\ChoiceQuestion;
- use Symfony\Component\Console\Question\ConfirmationQuestion;
- use Symfony\Component\Console\Question\Question;
- use Symfony\Component\Console\Style\SymfonyStyle;
- class SymfonyQuestionHelper extends QuestionHelper
- {
- protected function writePrompt(OutputInterface $output, Question $question)
- {
- $text = OutputFormatter::escapeTrailingBackslash($question->getQuestion());
- $default = $question->getDefault();
- if ($question->isMultiline()) {
- $text .= sprintf(' (press %s to continue)', $this->getEofShortcut());
- }
- switch (true) {
- case null === $default:
- $text = sprintf(' <info>%s</info>:', $text);
- break;
- case $question instanceof ConfirmationQuestion:
- $text = sprintf(' <info>%s (yes/no)</info> [<comment>%s</comment>]:', $text, $default ? 'yes' : 'no');
- break;
- case $question instanceof ChoiceQuestion && $question->isMultiselect():
- $choices = $question->getChoices();
- $default = explode(',', $default);
- foreach ($default as $key => $value) {
- $default[$key] = $choices[trim($value)];
- }
- $text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, OutputFormatter::escape(implode(', ', $default)));
- break;
- case $question instanceof ChoiceQuestion:
- $choices = $question->getChoices();
- $text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, OutputFormatter::escape($choices[$default] ?? $default));
- break;
- default:
- $text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, OutputFormatter::escape($default));
- }
- $output->writeln($text);
- $prompt = ' > ';
- if ($question instanceof ChoiceQuestion) {
- $output->writeln($this->formatChoiceQuestionChoices($question, 'comment'));
- $prompt = $question->getPrompt();
- }
- $output->write($prompt);
- }
- protected function writeError(OutputInterface $output, \Exception $error)
- {
- if ($output instanceof SymfonyStyle) {
- $output->newLine();
- $output->error($error->getMessage());
- return;
- }
- parent::writeError($output, $error);
- }
- private function getEofShortcut(): string
- {
- if ('Windows' === \PHP_OS_FAMILY) {
- return '<comment>Ctrl+Z</comment> then <comment>Enter</comment>';
- }
- return '<comment>Ctrl+D</comment>';
- }
- }
- <?php
- namespace Symfony\Component\Console\Helper;
- use Symfony\Component\Console\Exception\InvalidArgumentException;
- use Symfony\Component\Console\Exception\RuntimeException;
- use Symfony\Component\Console\Formatter\OutputFormatter;
- use Symfony\Component\Console\Formatter\WrappableOutputFormatterInterface;
- use Symfony\Component\Console\Output\ConsoleSectionOutput;
- use Symfony\Component\Console\Output\OutputInterface;
- class Table
- {
- private const SEPARATOR_TOP = 0;
- private const SEPARATOR_TOP_BOTTOM = 1;
- private const SEPARATOR_MID = 2;
- private const SEPARATOR_BOTTOM = 3;
- private const BORDER_OUTSIDE = 0;
- private const BORDER_INSIDE = 1;
- private $headerTitle;
- private $footerTitle;
- private $headers = [];
- private $rows = [];
- private $horizontal = false;
- private $effectiveColumnWidths = [];
- private $numberOfColumns;
- private $output;
- private $style;
- private $columnStyles = [];
- private $columnWidths = [];
- private $columnMaxWidths = [];
- private static $styles;
- private $rendered = false;
- public function __construct(OutputInterface $output)
- {
- $this->output = $output;
- if (!self::$styles) {
- self::$styles = self::initStyles();
- }
- $this->setStyle('default');
- }
- public static function setStyleDefinition(string $name, TableStyle $style)
- {
- if (!self::$styles) {
- self::$styles = self::initStyles();
- }
- self::$styles[$name] = $style;
- }
- public static function getStyleDefinition(string $name)
- {
- if (!self::$styles) {
- self::$styles = self::initStyles();
- }
- if (isset(self::$styles[$name])) {
- return self::$styles[$name];
- }
- throw new InvalidArgumentException(sprintf('Style "%s" is not defined.', $name));
- }
- public function setStyle($name)
- {
- $this->style = $this->resolveStyle($name);
- return $this;
- }
- public function getStyle()
- {
- return $this->style;
- }
- public function setColumnStyle(int $columnIndex, $name)
- {
- $this->columnStyles[$columnIndex] = $this->resolveStyle($name);
- return $this;
- }
- public function getColumnStyle(int $columnIndex)
- {
- return $this->columnStyles[$columnIndex] ?? $this->getStyle();
- }
- public function setColumnWidth(int $columnIndex, int $width)
- {
- $this->columnWidths[$columnIndex] = $width;
- return $this;
- }
- public function setColumnWidths(array $widths)
- {
- $this->columnWidths = [];
- foreach ($widths as $index => $width) {
- $this->setColumnWidth($index, $width);
- }
- return $this;
- }
- public function setColumnMaxWidth(int $columnIndex, int $width): self
- {
- if (!$this->output->getFormatter() instanceof WrappableOutputFormatterInterface) {
- 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())));
- }
- $this->columnMaxWidths[$columnIndex] = $width;
- return $this;
- }
- public function setHeaders(array $headers)
- {
- $headers = array_values($headers);
- if (!empty($headers) && !\is_array($headers[0])) {
- $headers = [$headers];
- }
- $this->headers = $headers;
- return $this;
- }
- public function setRows(array $rows)
- {
- $this->rows = [];
- return $this->addRows($rows);
- }
- public function addRows(array $rows)
- {
- foreach ($rows as $row) {
- $this->addRow($row);
- }
- return $this;
- }
- public function addRow($row)
- {
- if ($row instanceof TableSeparator) {
- $this->rows[] = $row;
- return $this;
- }
- if (!\is_array($row)) {
- throw new InvalidArgumentException('A row must be an array or a TableSeparator instance.');
- }
- $this->rows[] = array_values($row);
- return $this;
- }
- public function appendRow($row): self
- {
- if (!$this->output instanceof ConsoleSectionOutput) {
- throw new RuntimeException(sprintf('Output should be an instance of "%s" when calling "%s".', ConsoleSectionOutput::class, __METHOD__));
- }
- if ($this->rendered) {
- $this->output->clear($this->calculateRowCount());
- }
- $this->addRow($row);
- $this->render();
- return $this;
- }
- public function setRow($column, array $row)
- {
- $this->rows[$column] = $row;
- return $this;
- }
- public function setHeaderTitle(?string $title): self
- {
- $this->headerTitle = $title;
- return $this;
- }
- public function setFooterTitle(?string $title): self
- {
- $this->footerTitle = $title;
- return $this;
- }
- public function setHorizontal(bool $horizontal = true): self
- {
- $this->horizontal = $horizontal;
- return $this;
- }
- public function render()
- {
- $divider = new TableSeparator();
- if ($this->horizontal) {
- $rows = [];
- foreach ($this->headers[0] ?? [] as $i => $header) {
- $rows[$i] = [$header];
- foreach ($this->rows as $row) {
- if ($row instanceof TableSeparator) {
- continue;
- }
- if (isset($row[$i])) {
- $rows[$i][] = $row[$i];
- } elseif ($rows[$i][0] instanceof TableCell && $rows[$i][0]->getColspan() >= 2) {
- } else {
- $rows[$i][] = null;
- }
- }
- }
- } else {
- $rows = array_merge($this->headers, [$divider], $this->rows);
- }
- $this->calculateNumberOfColumns($rows);
- $rowGroups = $this->buildTableRows($rows);
- $this->calculateColumnsWidth($rowGroups);
- $isHeader = !$this->horizontal;
- $isFirstRow = $this->horizontal;
- $hasTitle = (bool) $this->headerTitle;
- foreach ($rowGroups as $rowGroup) {
- $isHeaderSeparatorRendered = false;
- foreach ($rowGroup as $row) {
- if ($divider === $row) {
- $isHeader = false;
- $isFirstRow = true;
- continue;
- }
- if ($row instanceof TableSeparator) {
- $this->renderRowSeparator();
- continue;
- }
- if (!$row) {
- continue;
- }
- if ($isHeader && !$isHeaderSeparatorRendered) {
- $this->renderRowSeparator(
- $isHeader ? self::SEPARATOR_TOP : self::SEPARATOR_TOP_BOTTOM,
- $hasTitle ? $this->headerTitle : null,
- $hasTitle ? $this->style->getHeaderTitleFormat() : null
- );
- $hasTitle = false;
- $isHeaderSeparatorRendered = true;
- }
- if ($isFirstRow) {
- $this->renderRowSeparator(
- $isHeader ? self::SEPARATOR_TOP : self::SEPARATOR_TOP_BOTTOM,
- $hasTitle ? $this->headerTitle : null,
- $hasTitle ? $this->style->getHeaderTitleFormat() : null
- );
- $isFirstRow = false;
- $hasTitle = false;
- }
- if ($this->horizontal) {
- $this->renderRow($row, $this->style->getCellRowFormat(), $this->style->getCellHeaderFormat());
- } else {
- $this->renderRow($row, $isHeader ? $this->style->getCellHeaderFormat() : $this->style->getCellRowFormat());
- }
- }
- }
- $this->renderRowSeparator(self::SEPARATOR_BOTTOM, $this->footerTitle, $this->style->getFooterTitleFormat());
- $this->cleanup();
- $this->rendered = true;
- }
- private function renderRowSeparator(int $type = self::SEPARATOR_MID, string $title = null, string $titleFormat = null)
- {
- if (0 === $count = $this->numberOfColumns) {
- return;
- }
- $borders = $this->style->getBorderChars();
- if (!$borders[0] && !$borders[2] && !$this->style->getCrossingChar()) {
- return;
- }
- $crossings = $this->style->getCrossingChars();
- if (self::SEPARATOR_MID === $type) {
- [$horizontal, $leftChar, $midChar, $rightChar] = [$borders[2], $crossings[8], $crossings[0], $crossings[4]];
- } elseif (self::SEPARATOR_TOP === $type) {
- [$horizontal, $leftChar, $midChar, $rightChar] = [$borders[0], $crossings[1], $crossings[2], $crossings[3]];
- } elseif (self::SEPARATOR_TOP_BOTTOM === $type) {
- [$horizontal, $leftChar, $midChar, $rightChar] = [$borders[0], $crossings[9], $crossings[10], $crossings[11]];
- } else {
- [$horizontal, $leftChar, $midChar, $rightChar] = [$borders[0], $crossings[7], $crossings[6], $crossings[5]];
- }
- $markup = $leftChar;
- for ($column = 0; $column < $count; ++$column) {
- $markup .= str_repeat($horizontal, $this->effectiveColumnWidths[$column]);
- $markup .= $column === $count - 1 ? $rightChar : $midChar;
- }
- if (null !== $title) {
- $titleLength = Helper::width(Helper::removeDecoration($formatter = $this->output->getFormatter(), $formattedTitle = sprintf($titleFormat, $title)));
- $markupLength = Helper::width($markup);
- if ($titleLength > $limit = $markupLength - 4) {
- $titleLength = $limit;
- $formatLength = Helper::width(Helper::removeDecoration($formatter, sprintf($titleFormat, '')));
- $formattedTitle = sprintf($titleFormat, Helper::substr($title, 0, $limit - $formatLength - 3).'...');
- }
- $titleStart = intdiv($markupLength - $titleLength, 2);
- if (false === mb_detect_encoding($markup, null, true)) {
- $markup = substr_replace($markup, $formattedTitle, $titleStart, $titleLength);
- } else {
- $markup = mb_substr($markup, 0, $titleStart).$formattedTitle.mb_substr($markup, $titleStart + $titleLength);
- }
- }
- $this->output->writeln(sprintf($this->style->getBorderFormat(), $markup));
- }
- private function renderColumnSeparator(int $type = self::BORDER_OUTSIDE): string
- {
- $borders = $this->style->getBorderChars();
- return sprintf($this->style->getBorderFormat(), self::BORDER_OUTSIDE === $type ? $borders[1] : $borders[3]);
- }
- private function renderRow(array $row, string $cellFormat, string $firstCellFormat = null)
- {
- $rowContent = $this->renderColumnSeparator(self::BORDER_OUTSIDE);
- $columns = $this->getRowColumns($row);
- $last = \count($columns) - 1;
- foreach ($columns as $i => $column) {
- if ($firstCellFormat && 0 === $i) {
- $rowContent .= $this->renderCell($row, $column, $firstCellFormat);
- } else {
- $rowContent .= $this->renderCell($row, $column, $cellFormat);
- }
- $rowContent .= $this->renderColumnSeparator($last === $i ? self::BORDER_OUTSIDE : self::BORDER_INSIDE);
- }
- $this->output->writeln($rowContent);
- }
- private function renderCell(array $row, int $column, string $cellFormat): string
- {
- $cell = $row[$column] ?? '';
- $width = $this->effectiveColumnWidths[$column];
- if ($cell instanceof TableCell && $cell->getColspan() > 1) {
- foreach (range($column + 1, $column + $cell->getColspan() - 1) as $nextColumn) {
- $width += $this->getColumnSeparatorWidth() + $this->effectiveColumnWidths[$nextColumn];
- }
- }
- if (false !== $encoding = mb_detect_encoding($cell, null, true)) {
- $width += \strlen($cell) - mb_strwidth($cell, $encoding);
- }
- $style = $this->getColumnStyle($column);
- if ($cell instanceof TableSeparator) {
- return sprintf($style->getBorderFormat(), str_repeat($style->getBorderChars()[2], $width));
- }
- $width += Helper::length($cell) - Helper::length(Helper::removeDecoration($this->output->getFormatter(), $cell));
- $content = sprintf($style->getCellRowContentFormat(), $cell);
- $padType = $style->getPadType();
- if ($cell instanceof TableCell && $cell->getStyle() instanceof TableCellStyle) {
- $isNotStyledByTag = !preg_match('/^<(\w+|(\w+=[\w,]+;?)*)>.+<\/(\w+|(\w+=\w+;?)*)?>$/', $cell);
- if ($isNotStyledByTag) {
- $cellFormat = $cell->getStyle()->getCellFormat();
- if (!\is_string($cellFormat)) {
- $tag = http_build_query($cell->getStyle()->getTagOptions(), '', ';');
- $cellFormat = '<'.$tag.'>%s</>';
- }
- if (strstr($content, '</>')) {
- $content = str_replace('</>', '', $content);
- $width -= 3;
- }
- if (strstr($content, '<fg=default;bg=default>')) {
- $content = str_replace('<fg=default;bg=default>', '', $content);
- $width -= \strlen('<fg=default;bg=default>');
- }
- }
- $padType = $cell->getStyle()->getPadByAlign();
- }
- return sprintf($cellFormat, str_pad($content, $width, $style->getPaddingChar(), $padType));
- }
- private function calculateNumberOfColumns(array $rows)
- {
- $columns = [0];
- foreach ($rows as $row) {
- if ($row instanceof TableSeparator) {
- continue;
- }
- $columns[] = $this->getNumberOfColumns($row);
- }
- $this->numberOfColumns = max($columns);
- }
- private function buildTableRows(array $rows): TableRows
- {
- $formatter = $this->output->getFormatter();
- $unmergedRows = [];
- for ($rowKey = 0; $rowKey < \count($rows); ++$rowKey) {
- $rows = $this->fillNextRows($rows, $rowKey);
- foreach ($rows[$rowKey] as $column => $cell) {
- $colspan = $cell instanceof TableCell ? $cell->getColspan() : 1;
- if (isset($this->columnMaxWidths[$column]) && Helper::width(Helper::removeDecoration($formatter, $cell)) > $this->columnMaxWidths[$column]) {
- $cell = $formatter->formatAndWrap($cell, $this->columnMaxWidths[$column] * $colspan);
- }
- if (!strstr($cell ?? '', "\n")) {
- continue;
- }
- $escaped = implode("\n", array_map([OutputFormatter::class, 'escapeTrailingBackslash'], explode("\n", $cell)));
- $cell = $cell instanceof TableCell ? new TableCell($escaped, ['colspan' => $cell->getColspan()]) : $escaped;
- $lines = explode("\n", str_replace("\n", "<fg=default;bg=default></>\n", $cell));
- foreach ($lines as $lineKey => $line) {
- if ($colspan > 1) {
- $line = new TableCell($line, ['colspan' => $colspan]);
- }
- if (0 === $lineKey) {
- $rows[$rowKey][$column] = $line;
- } else {
- if (!\array_key_exists($rowKey, $unmergedRows) || !\array_key_exists($lineKey, $unmergedRows[$rowKey])) {
- $unmergedRows[$rowKey][$lineKey] = $this->copyRow($rows, $rowKey);
- }
- $unmergedRows[$rowKey][$lineKey][$column] = $line;
- }
- }
- }
- }
- return new TableRows(function () use ($rows, $unmergedRows): \Traversable {
- foreach ($rows as $rowKey => $row) {
- $rowGroup = [$row instanceof TableSeparator ? $row : $this->fillCells($row)];
- if (isset($unmergedRows[$rowKey])) {
- foreach ($unmergedRows[$rowKey] as $row) {
- $rowGroup[] = $row instanceof TableSeparator ? $row : $this->fillCells($row);
- }
- }
- yield $rowGroup;
- }
- });
- }
- private function calculateRowCount(): int
- {
- $numberOfRows = \count(iterator_to_array($this->buildTableRows(array_merge($this->headers, [new TableSeparator()], $this->rows))));
- if ($this->headers) {
- ++$numberOfRows;
- }
- if (\count($this->rows) > 0) {
- ++$numberOfRows;
- }
- return $numberOfRows;
- }
- private function fillNextRows(array $rows, int $line): array
- {
- $unmergedRows = [];
- foreach ($rows[$line] as $column => $cell) {
- if (null !== $cell && !$cell instanceof TableCell && !\is_scalar($cell) && !(\is_object($cell) && method_exists($cell, '__toString'))) {
- throw new InvalidArgumentException(sprintf('A cell must be a TableCell, a scalar or an object implementing "__toString()", "%s" given.', get_debug_type($cell)));
- }
- if ($cell instanceof TableCell && $cell->getRowspan() > 1) {
- $nbLines = $cell->getRowspan() - 1;
- $lines = [$cell];
- if (strstr($cell, "\n")) {
- $lines = explode("\n", str_replace("\n", "<fg=default;bg=default>\n</>", $cell));
- $nbLines = \count($lines) > $nbLines ? substr_count($cell, "\n") : $nbLines;
- $rows[$line][$column] = new TableCell($lines[0], ['colspan' => $cell->getColspan(), 'style' => $cell->getStyle()]);
- unset($lines[0]);
- }
- $unmergedRows = array_replace_recursive(array_fill($line + 1, $nbLines, []), $unmergedRows);
- foreach ($unmergedRows as $unmergedRowKey => $unmergedRow) {
- $value = $lines[$unmergedRowKey - $line] ?? '';
- $unmergedRows[$unmergedRowKey][$column] = new TableCell($value, ['colspan' => $cell->getColspan(), 'style' => $cell->getStyle()]);
- if ($nbLines === $unmergedRowKey - $line) {
- break;
- }
- }
- }
- }
- foreach ($unmergedRows as $unmergedRowKey => $unmergedRow) {
- if (isset($rows[$unmergedRowKey]) && \is_array($rows[$unmergedRowKey]) && ($this->getNumberOfColumns($rows[$unmergedRowKey]) + $this->getNumberOfColumns($unmergedRows[$unmergedRowKey]) <= $this->numberOfColumns)) {
- foreach ($unmergedRow as $cellKey => $cell) {
- array_splice($rows[$unmergedRowKey], $cellKey, 0, [$cell]);
- }
- } else {
- $row = $this->copyRow($rows, $unmergedRowKey - 1);
- foreach ($unmergedRow as $column => $cell) {
- if (!empty($cell)) {
- $row[$column] = $unmergedRow[$column];
- }
- }
- array_splice($rows, $unmergedRowKey, 0, [$row]);
- }
- }
- return $rows;
- }
- private function fillCells(iterable $row)
- {
- $newRow = [];
- foreach ($row as $column => $cell) {
- $newRow[] = $cell;
- if ($cell instanceof TableCell && $cell->getColspan() > 1) {
- foreach (range($column + 1, $column + $cell->getColspan() - 1) as $position) {
- $newRow[] = '';
- }
- }
- }
- return $newRow ?: $row;
- }
- private function copyRow(array $rows, int $line): array
- {
- $row = $rows[$line];
- foreach ($row as $cellKey => $cellValue) {
- $row[$cellKey] = '';
- if ($cellValue instanceof TableCell) {
- $row[$cellKey] = new TableCell('', ['colspan' => $cellValue->getColspan()]);
- }
- }
- return $row;
- }
- private function getNumberOfColumns(array $row): int
- {
- $columns = \count($row);
- foreach ($row as $column) {
- $columns += $column instanceof TableCell ? ($column->getColspan() - 1) : 0;
- }
- return $columns;
- }
- private function getRowColumns(array $row): array
- {
- $columns = range(0, $this->numberOfColumns - 1);
- foreach ($row as $cellKey => $cell) {
- if ($cell instanceof TableCell && $cell->getColspan() > 1) {
- $columns = array_diff($columns, range($cellKey + 1, $cellKey + $cell->getColspan() - 1));
- }
- }
- return $columns;
- }
- private function calculateColumnsWidth(iterable $groups)
- {
- for ($column = 0; $column < $this->numberOfColumns; ++$column) {
- $lengths = [];
- foreach ($groups as $group) {
- foreach ($group as $row) {
- if ($row instanceof TableSeparator) {
- continue;
- }
- foreach ($row as $i => $cell) {
- if ($cell instanceof TableCell) {
- $textContent = Helper::removeDecoration($this->output->getFormatter(), $cell);
- $textLength = Helper::width($textContent);
- if ($textLength > 0) {
- $contentColumns = str_split($textContent, ceil($textLength / $cell->getColspan()));
- foreach ($contentColumns as $position => $content) {
- $row[$i + $position] = $content;
- }
- }
- }
- }
- $lengths[] = $this->getCellWidth($row, $column);
- }
- }
- $this->effectiveColumnWidths[$column] = max($lengths) + Helper::width($this->style->getCellRowContentFormat()) - 2;
- }
- }
- private function getColumnSeparatorWidth(): int
- {
- return Helper::width(sprintf($this->style->getBorderFormat(), $this->style->getBorderChars()[3]));
- }
- private function getCellWidth(array $row, int $column): int
- {
- $cellWidth = 0;
- if (isset($row[$column])) {
- $cell = $row[$column];
- $cellWidth = Helper::width(Helper::removeDecoration($this->output->getFormatter(), $cell));
- }
- $columnWidth = $this->columnWidths[$column] ?? 0;
- $cellWidth = max($cellWidth, $columnWidth);
- return isset($this->columnMaxWidths[$column]) ? min($this->columnMaxWidths[$column], $cellWidth) : $cellWidth;
- }
- private function cleanup()
- {
- $this->effectiveColumnWidths = [];
- $this->numberOfColumns = null;
- }
- private static function initStyles(): array
- {
- $borderless = new TableStyle();
- $borderless
- ->setHorizontalBorderChars('=')
- ->setVerticalBorderChars(' ')
- ->setDefaultCrossingChar(' ')
- ;
- $compact = new TableStyle();
- $compact
- ->setHorizontalBorderChars('')
- ->setVerticalBorderChars('')
- ->setDefaultCrossingChar('')
- ->setCellRowContentFormat('%s ')
- ;
- $styleGuide = new TableStyle();
- $styleGuide
- ->setHorizontalBorderChars('-')
- ->setVerticalBorderChars(' ')
- ->setDefaultCrossingChar(' ')
- ->setCellHeaderFormat('%s')
- ;
- $box = (new TableStyle())
- ->setHorizontalBorderChars('─')
- ->setVerticalBorderChars('│')
- ->setCrossingChars('┼', '┌', '┬', '�', '┤', '┘', '┴', '└', '├')
- ;
- $boxDouble = (new TableStyle())
- ->setHorizontalBorderChars('�', '─')
- ->setVerticalBorderChars('║', '│')
- ->setCrossingChars('┼', '╔', '╤', '╗', '╢', '�', '╧', '╚', '╟', '╠', '╪', '╣')
- ;
- return [
- 'default' => new TableStyle(),
- 'borderless' => $borderless,
- 'compact' => $compact,
- 'symfony-style-guide' => $styleGuide,
- 'box' => $box,
- 'box-double' => $boxDouble,
- ];
- }
- private function resolveStyle($name): TableStyle
- {
- if ($name instanceof TableStyle) {
- return $name;
- }
- if (isset(self::$styles[$name])) {
- return self::$styles[$name];
- }
- throw new InvalidArgumentException(sprintf('Style "%s" is not defined.', $name));
- }
- }
- <?php
- namespace Symfony\Component\Console\Helper;
- use Symfony\Component\Console\Exception\InvalidArgumentException;
- class TableCell
- {
- private $value;
- private $options = [
- 'rowspan' => 1,
- 'colspan' => 1,
- 'style' => null,
- ];
- public function __construct(string $value = '', array $options = [])
- {
- $this->value = $value;
- if ($diff = array_diff(array_keys($options), array_keys($this->options))) {
- throw new InvalidArgumentException(sprintf('The TableCell does not support the following options: \'%s\'.', implode('\', \'', $diff)));
- }
- if (isset($options['style']) && !$options['style'] instanceof TableCellStyle) {
- throw new InvalidArgumentException('The style option must be an instance of "TableCellStyle".');
- }
- $this->options = array_merge($this->options, $options);
- }
- public function __toString()
- {
- return $this->value;
- }
- public function getColspan()
- {
- return (int) $this->options['colspan'];
- }
- public function getRowspan()
- {
- return (int) $this->options['rowspan'];
- }
- public function getStyle(): ?TableCellStyle
- {
- return $this->options['style'];
- }
- }
- <?php
- namespace Symfony\Component\Console\Helper;
- use Symfony\Component\Console\Exception\InvalidArgumentException;
- class TableCellStyle
- {
- public const DEFAULT_ALIGN = 'left';
- private const TAG_OPTIONS = [
- 'fg',
- 'bg',
- 'options',
- ];
- private const ALIGN_MAP = [
- 'left' => \STR_PAD_RIGHT,
- 'center' => \STR_PAD_BOTH,
- 'right' => \STR_PAD_LEFT,
- ];
- private $options = [
- 'fg' => 'default',
- 'bg' => 'default',
- 'options' => null,
- 'align' => self::DEFAULT_ALIGN,
- 'cellFormat' => null,
- ];
- public function __construct(array $options = [])
- {
- if ($diff = array_diff(array_keys($options), array_keys($this->options))) {
- throw new InvalidArgumentException(sprintf('The TableCellStyle does not support the following options: \'%s\'.', implode('\', \'', $diff)));
- }
- if (isset($options['align']) && !\array_key_exists($options['align'], self::ALIGN_MAP)) {
- throw new InvalidArgumentException(sprintf('Wrong align value. Value must be following: \'%s\'.', implode('\', \'', array_keys(self::ALIGN_MAP))));
- }
- $this->options = array_merge($this->options, $options);
- }
- public function getOptions(): array
- {
- return $this->options;
- }
- public function getTagOptions()
- {
- return array_filter(
- $this->getOptions(),
- function ($key) {
- return \in_array($key, self::TAG_OPTIONS) && isset($this->options[$key]);
- },
- \ARRAY_FILTER_USE_KEY
- );
- }
- public function getPadByAlign()
- {
- return self::ALIGN_MAP[$this->getOptions()['align']];
- }
- public function getCellFormat(): ?string
- {
- return $this->getOptions()['cellFormat'];
- }
- }
- <?php
- namespace Symfony\Component\Console\Helper;
- class TableRows implements \IteratorAggregate
- {
- private $generator;
- public function __construct(\Closure $generator)
- {
- $this->generator = $generator;
- }
- public function getIterator(): \Traversable
- {
- return ($this->generator)();
- }
- }
- <?php
- namespace Symfony\Component\Console\Helper;
- class TableSeparator extends TableCell
- {
- public function __construct(array $options = [])
- {
- parent::__construct('', $options);
- }
- }
- <?php
- namespace Symfony\Component\Console\Helper;
- use Symfony\Component\Console\Exception\InvalidArgumentException;
- use Symfony\Component\Console\Exception\LogicException;
- class TableStyle
- {
- private $paddingChar = ' ';
- private $horizontalOutsideBorderChar = '-';
- private $horizontalInsideBorderChar = '-';
- private $verticalOutsideBorderChar = '|';
- private $verticalInsideBorderChar = '|';
- private $crossingChar = '+';
- private $crossingTopRightChar = '+';
- private $crossingTopMidChar = '+';
- private $crossingTopLeftChar = '+';
- private $crossingMidRightChar = '+';
- private $crossingBottomRightChar = '+';
- private $crossingBottomMidChar = '+';
- private $crossingBottomLeftChar = '+';
- private $crossingMidLeftChar = '+';
- private $crossingTopLeftBottomChar = '+';
- private $crossingTopMidBottomChar = '+';
- private $crossingTopRightBottomChar = '+';
- private $headerTitleFormat = '<fg=black;bg=white;options=bold> %s </>';
- private $footerTitleFormat = '<fg=black;bg=white;options=bold> %s </>';
- private $cellHeaderFormat = '<info>%s</info>';
- private $cellRowFormat = '%s';
- private $cellRowContentFormat = ' %s ';
- private $borderFormat = '%s';
- private $padType = \STR_PAD_RIGHT;
- public function setPaddingChar(string $paddingChar)
- {
- if (!$paddingChar) {
- throw new LogicException('The padding char must not be empty.');
- }
- $this->paddingChar = $paddingChar;
- return $this;
- }
- public function getPaddingChar()
- {
- return $this->paddingChar;
- }
- public function setHorizontalBorderChars(string $outside, string $inside = null): self
- {
- $this->horizontalOutsideBorderChar = $outside;
- $this->horizontalInsideBorderChar = $inside ?? $outside;
- return $this;
- }
- public function setVerticalBorderChars(string $outside, string $inside = null): self
- {
- $this->verticalOutsideBorderChar = $outside;
- $this->verticalInsideBorderChar = $inside ?? $outside;
- return $this;
- }
- public function getBorderChars(): array
- {
- return [
- $this->horizontalOutsideBorderChar,
- $this->verticalOutsideBorderChar,
- $this->horizontalInsideBorderChar,
- $this->verticalInsideBorderChar,
- ];
- }
- 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
- {
- $this->crossingChar = $cross;
- $this->crossingTopLeftChar = $topLeft;
- $this->crossingTopMidChar = $topMid;
- $this->crossingTopRightChar = $topRight;
- $this->crossingMidRightChar = $midRight;
- $this->crossingBottomRightChar = $bottomRight;
- $this->crossingBottomMidChar = $bottomMid;
- $this->crossingBottomLeftChar = $bottomLeft;
- $this->crossingMidLeftChar = $midLeft;
- $this->crossingTopLeftBottomChar = $topLeftBottom ?? $midLeft;
- $this->crossingTopMidBottomChar = $topMidBottom ?? $cross;
- $this->crossingTopRightBottomChar = $topRightBottom ?? $midRight;
- return $this;
- }
- public function setDefaultCrossingChar(string $char): self
- {
- return $this->setCrossingChars($char, $char, $char, $char, $char, $char, $char, $char, $char);
- }
- public function getCrossingChar()
- {
- return $this->crossingChar;
- }
- public function getCrossingChars(): array
- {
- return [
- $this->crossingChar,
- $this->crossingTopLeftChar,
- $this->crossingTopMidChar,
- $this->crossingTopRightChar,
- $this->crossingMidRightChar,
- $this->crossingBottomRightChar,
- $this->crossingBottomMidChar,
- $this->crossingBottomLeftChar,
- $this->crossingMidLeftChar,
- $this->crossingTopLeftBottomChar,
- $this->crossingTopMidBottomChar,
- $this->crossingTopRightBottomChar,
- ];
- }
- public function setCellHeaderFormat(string $cellHeaderFormat)
- {
- $this->cellHeaderFormat = $cellHeaderFormat;
- return $this;
- }
- public function getCellHeaderFormat()
- {
- return $this->cellHeaderFormat;
- }
- public function setCellRowFormat(string $cellRowFormat)
- {
- $this->cellRowFormat = $cellRowFormat;
- return $this;
- }
- public function getCellRowFormat()
- {
- return $this->cellRowFormat;
- }
- public function setCellRowContentFormat(string $cellRowContentFormat)
- {
- $this->cellRowContentFormat = $cellRowContentFormat;
- return $this;
- }
- public function getCellRowContentFormat()
- {
- return $this->cellRowContentFormat;
- }
- public function setBorderFormat(string $borderFormat)
- {
- $this->borderFormat = $borderFormat;
- return $this;
- }
- public function getBorderFormat()
- {
- return $this->borderFormat;
- }
- public function setPadType(int $padType)
- {
- if (!\in_array($padType, [\STR_PAD_LEFT, \STR_PAD_RIGHT, \STR_PAD_BOTH], true)) {
- throw new InvalidArgumentException('Invalid padding type. Expected one of (STR_PAD_LEFT, STR_PAD_RIGHT, STR_PAD_BOTH).');
- }
- $this->padType = $padType;
- return $this;
- }
- public function getPadType()
- {
- return $this->padType;
- }
- public function getHeaderTitleFormat(): string
- {
- return $this->headerTitleFormat;
- }
- public function setHeaderTitleFormat(string $format): self
- {
- $this->headerTitleFormat = $format;
- return $this;
- }
- public function getFooterTitleFormat(): string
- {
- return $this->footerTitleFormat;
- }
- public function setFooterTitleFormat(string $format): self
- {
- $this->footerTitleFormat = $format;
- return $this;
- }
- }
- <?php
- namespace Symfony\Component\Console\Input;
- use Symfony\Component\Console\Exception\RuntimeException;
- class ArgvInput extends Input
- {
- private $tokens;
- private $parsed;
- public function __construct(array $argv = null, InputDefinition $definition = null)
- {
- $argv = $argv ?? $_SERVER['argv'] ?? [];
- array_shift($argv);
- $this->tokens = $argv;
- parent::__construct($definition);
- }
- protected function setTokens(array $tokens)
- {
- $this->tokens = $tokens;
- }
- protected function parse()
- {
- $parseOptions = true;
- $this->parsed = $this->tokens;
- while (null !== $token = array_shift($this->parsed)) {
- $parseOptions = $this->parseToken($token, $parseOptions);
- }
- }
- protected function parseToken(string $token, bool $parseOptions): bool
- {
- if ($parseOptions && '' == $token) {
- $this->parseArgument($token);
- } elseif ($parseOptions && '--' == $token) {
- return false;
- } elseif ($parseOptions && str_starts_with($token, '--')) {
- $this->parseLongOption($token);
- } elseif ($parseOptions && '-' === $token[0] && '-' !== $token) {
- $this->parseShortOption($token);
- } else {
- $this->parseArgument($token);
- }
- return $parseOptions;
- }
- private function parseShortOption(string $token)
- {
- $name = substr($token, 1);
- if (\strlen($name) > 1) {
- if ($this->definition->hasShortcut($name[0]) && $this->definition->getOptionForShortcut($name[0])->acceptValue()) {
- $this->addShortOption($name[0], substr($name, 1));
- } else {
- $this->parseShortOptionSet($name);
- }
- } else {
- $this->addShortOption($name, null);
- }
- }
- private function parseShortOptionSet(string $name)
- {
- $len = \strlen($name);
- for ($i = 0; $i < $len; ++$i) {
- if (!$this->definition->hasShortcut($name[$i])) {
- $encoding = mb_detect_encoding($name, null, true);
- throw new RuntimeException(sprintf('The "-%s" option does not exist.', false === $encoding ? $name[$i] : mb_substr($name, $i, 1, $encoding)));
- }
- $option = $this->definition->getOptionForShortcut($name[$i]);
- if ($option->acceptValue()) {
- $this->addLongOption($option->getName(), $i === $len - 1 ? null : substr($name, $i + 1));
- break;
- } else {
- $this->addLongOption($option->getName(), null);
- }
- }
- }
- private function parseLongOption(string $token)
- {
- $name = substr($token, 2);
- if (false !== $pos = strpos($name, '=')) {
- if ('' === $value = substr($name, $pos + 1)) {
- array_unshift($this->parsed, $value);
- }
- $this->addLongOption(substr($name, 0, $pos), $value);
- } else {
- $this->addLongOption($name, null);
- }
- }
- private function parseArgument(string $token)
- {
- $c = \count($this->arguments);
- if ($this->definition->hasArgument($c)) {
- $arg = $this->definition->getArgument($c);
- $this->arguments[$arg->getName()] = $arg->isArray() ? [$token] : $token;
- } elseif ($this->definition->hasArgument($c - 1) && $this->definition->getArgument($c - 1)->isArray()) {
- $arg = $this->definition->getArgument($c - 1);
- $this->arguments[$arg->getName()][] = $token;
- } else {
- $all = $this->definition->getArguments();
- $symfonyCommandName = null;
- if (($inputArgument = $all[$key = array_key_first($all)] ?? null) && 'command' === $inputArgument->getName()) {
- $symfonyCommandName = $this->arguments['command'] ?? null;
- unset($all[$key]);
- }
- if (\count($all)) {
- if ($symfonyCommandName) {
- $message = sprintf('Too many arguments to "%s" command, expected arguments "%s".', $symfonyCommandName, implode('" "', array_keys($all)));
- } else {
- $message = sprintf('Too many arguments, expected arguments "%s".', implode('" "', array_keys($all)));
- }
- } elseif ($symfonyCommandName) {
- $message = sprintf('No arguments expected for "%s" command, got "%s".', $symfonyCommandName, $token);
- } else {
- $message = sprintf('No arguments expected, got "%s".', $token);
- }
- throw new RuntimeException($message);
- }
- }
- private function addShortOption(string $shortcut, $value)
- {
- if (!$this->definition->hasShortcut($shortcut)) {
- throw new RuntimeException(sprintf('The "-%s" option does not exist.', $shortcut));
- }
- $this->addLongOption($this->definition->getOptionForShortcut($shortcut)->getName(), $value);
- }
- private function addLongOption(string $name, $value)
- {
- if (!$this->definition->hasOption($name)) {
- if (!$this->definition->hasNegation($name)) {
- throw new RuntimeException(sprintf('The "--%s" option does not exist.', $name));
- }
- $optionName = $this->definition->negationToName($name);
- if (null !== $value) {
- throw new RuntimeException(sprintf('The "--%s" option does not accept a value.', $name));
- }
- $this->options[$optionName] = false;
- return;
- }
- $option = $this->definition->getOption($name);
- if (null !== $value && !$option->acceptValue()) {
- throw new RuntimeException(sprintf('The "--%s" option does not accept a value.', $name));
- }
- if (\in_array($value, ['', null], true) && $option->acceptValue() && \count($this->parsed)) {
- $next = array_shift($this->parsed);
- if ((isset($next[0]) && '-' !== $next[0]) || \in_array($next, ['', null], true)) {
- $value = $next;
- } else {
- array_unshift($this->parsed, $next);
- }
- }
- if (null === $value) {
- if ($option->isValueRequired()) {
- throw new RuntimeException(sprintf('The "--%s" option requires a value.', $name));
- }
- if (!$option->isArray() && !$option->isValueOptional()) {
- $value = true;
- }
- }
- if ($option->isArray()) {
- $this->options[$name][] = $value;
- } else {
- $this->options[$name] = $value;
- }
- }
- public function getFirstArgument()
- {
- $isOption = false;
- foreach ($this->tokens as $i => $token) {
- if ($token && '-' === $token[0]) {
- if (str_contains($token, '=') || !isset($this->tokens[$i + 1])) {
- continue;
- }
- $name = '-' === $token[1] ? substr($token, 2) : substr($token, -1);
- if (!isset($this->options[$name]) && !$this->definition->hasShortcut($name)) {
- } elseif ((isset($this->options[$name]) || isset($this->options[$name = $this->definition->shortcutToName($name)])) && $this->tokens[$i + 1] === $this->options[$name]) {
- $isOption = true;
- }
- continue;
- }
- if ($isOption) {
- $isOption = false;
- continue;
- }
- return $token;
- }
- return null;
- }
- public function hasParameterOption($values, bool $onlyParams = false)
- {
- $values = (array) $values;
- foreach ($this->tokens as $token) {
- if ($onlyParams && '--' === $token) {
- return false;
- }
- foreach ($values as $value) {
- $leading = str_starts_with($value, '--') ? $value.'=' : $value;
- if ($token === $value || '' !== $leading && str_starts_with($token, $leading)) {
- return true;
- }
- }
- }
- return false;
- }
- public function getParameterOption($values, $default = false, bool $onlyParams = false)
- {
- $values = (array) $values;
- $tokens = $this->tokens;
- while (0 < \count($tokens)) {
- $token = array_shift($tokens);
- if ($onlyParams && '--' === $token) {
- return $default;
- }
- foreach ($values as $value) {
- if ($token === $value) {
- return array_shift($tokens);
- }
- $leading = str_starts_with($value, '--') ? $value.'=' : $value;
- if ('' !== $leading && str_starts_with($token, $leading)) {
- return substr($token, \strlen($leading));
- }
- }
- }
- return $default;
- }
- public function __toString()
- {
- $tokens = array_map(function ($token) {
- if (preg_match('{^(-[^=]+=)(.+)}', $token, $match)) {
- return $match[1].$this->escapeToken($match[2]);
- }
- if ($token && '-' !== $token[0]) {
- return $this->escapeToken($token);
- }
- return $token;
- }, $this->tokens);
- return implode(' ', $tokens);
- }
- }
- <?php
- namespace Symfony\Component\Console\Input;
- use Symfony\Component\Console\Exception\InvalidArgumentException;
- use Symfony\Component\Console\Exception\InvalidOptionException;
- class ArrayInput extends Input
- {
- private $parameters;
- public function __construct(array $parameters, InputDefinition $definition = null)
- {
- $this->parameters = $parameters;
- parent::__construct($definition);
- }
- public function getFirstArgument()
- {
- foreach ($this->parameters as $param => $value) {
- if ($param && \is_string($param) && '-' === $param[0]) {
- continue;
- }
- return $value;
- }
- return null;
- }
- public function hasParameterOption($values, bool $onlyParams = false)
- {
- $values = (array) $values;
- foreach ($this->parameters as $k => $v) {
- if (!\is_int($k)) {
- $v = $k;
- }
- if ($onlyParams && '--' === $v) {
- return false;
- }
- if (\in_array($v, $values)) {
- return true;
- }
- }
- return false;
- }
- public function getParameterOption($values, $default = false, bool $onlyParams = false)
- {
- $values = (array) $values;
- foreach ($this->parameters as $k => $v) {
- if ($onlyParams && ('--' === $k || (\is_int($k) && '--' === $v))) {
- return $default;
- }
- if (\is_int($k)) {
- if (\in_array($v, $values)) {
- return true;
- }
- } elseif (\in_array($k, $values)) {
- return $v;
- }
- }
- return $default;
- }
- public function __toString()
- {
- $params = [];
- foreach ($this->parameters as $param => $val) {
- if ($param && \is_string($param) && '-' === $param[0]) {
- $glue = ('-' === $param[1]) ? '=' : ' ';
- if (\is_array($val)) {
- foreach ($val as $v) {
- $params[] = $param.('' != $v ? $glue.$this->escapeToken($v) : '');
- }
- } else {
- $params[] = $param.('' != $val ? $glue.$this->escapeToken($val) : '');
- }
- } else {
- $params[] = \is_array($val) ? implode(' ', array_map([$this, 'escapeToken'], $val)) : $this->escapeToken($val);
- }
- }
- return implode(' ', $params);
- }
- protected function parse()
- {
- foreach ($this->parameters as $key => $value) {
- if ('--' === $key) {
- return;
- }
- if (str_starts_with($key, '--')) {
- $this->addLongOption(substr($key, 2), $value);
- } elseif (str_starts_with($key, '-')) {
- $this->addShortOption(substr($key, 1), $value);
- } else {
- $this->addArgument($key, $value);
- }
- }
- }
- private function addShortOption(string $shortcut, $value)
- {
- if (!$this->definition->hasShortcut($shortcut)) {
- throw new InvalidOptionException(sprintf('The "-%s" option does not exist.', $shortcut));
- }
- $this->addLongOption($this->definition->getOptionForShortcut($shortcut)->getName(), $value);
- }
- private function addLongOption(string $name, $value)
- {
- if (!$this->definition->hasOption($name)) {
- if (!$this->definition->hasNegation($name)) {
- throw new InvalidOptionException(sprintf('The "--%s" option does not exist.', $name));
- }
- $optionName = $this->definition->negationToName($name);
- $this->options[$optionName] = false;
- return;
- }
- $option = $this->definition->getOption($name);
- if (null === $value) {
- if ($option->isValueRequired()) {
- throw new InvalidOptionException(sprintf('The "--%s" option requires a value.', $name));
- }
- if (!$option->isValueOptional()) {
- $value = true;
- }
- }
- $this->options[$name] = $value;
- }
- private function addArgument($name, $value)
- {
- if (!$this->definition->hasArgument($name)) {
- throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
- }
- $this->arguments[$name] = $value;
- }
- }
- <?php
- namespace Symfony\Component\Console\Input;
- use Symfony\Component\Console\Exception\InvalidArgumentException;
- use Symfony\Component\Console\Exception\RuntimeException;
- abstract class Input implements InputInterface, StreamableInputInterface
- {
- protected $definition;
- protected $stream;
- protected $options = [];
- protected $arguments = [];
- protected $interactive = true;
- public function __construct(InputDefinition $definition = null)
- {
- if (null === $definition) {
- $this->definition = new InputDefinition();
- } else {
- $this->bind($definition);
- $this->validate();
- }
- }
- public function bind(InputDefinition $definition)
- {
- $this->arguments = [];
- $this->options = [];
- $this->definition = $definition;
- $this->parse();
- }
- abstract protected function parse();
- public function validate()
- {
- $definition = $this->definition;
- $givenArguments = $this->arguments;
- $missingArguments = array_filter(array_keys($definition->getArguments()), function ($argument) use ($definition, $givenArguments) {
- return !\array_key_exists($argument, $givenArguments) && $definition->getArgument($argument)->isRequired();
- });
- if (\count($missingArguments) > 0) {
- throw new RuntimeException(sprintf('Not enough arguments (missing: "%s").', implode(', ', $missingArguments)));
- }
- }
- public function isInteractive()
- {
- return $this->interactive;
- }
- public function setInteractive(bool $interactive)
- {
- $this->interactive = $interactive;
- }
- public function getArguments()
- {
- return array_merge($this->definition->getArgumentDefaults(), $this->arguments);
- }
- public function getArgument(string $name)
- {
- if (!$this->definition->hasArgument($name)) {
- throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
- }
- return $this->arguments[$name] ?? $this->definition->getArgument($name)->getDefault();
- }
- public function setArgument(string $name, $value)
- {
- if (!$this->definition->hasArgument($name)) {
- throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
- }
- $this->arguments[$name] = $value;
- }
- public function hasArgument(string $name)
- {
- return $this->definition->hasArgument($name);
- }
- public function getOptions()
- {
- return array_merge($this->definition->getOptionDefaults(), $this->options);
- }
- public function getOption(string $name)
- {
- if ($this->definition->hasNegation($name)) {
- if (null === $value = $this->getOption($this->definition->negationToName($name))) {
- return $value;
- }
- return !$value;
- }
- if (!$this->definition->hasOption($name)) {
- throw new InvalidArgumentException(sprintf('The "%s" option does not exist.', $name));
- }
- return \array_key_exists($name, $this->options) ? $this->options[$name] : $this->definition->getOption($name)->getDefault();
- }
- public function setOption(string $name, $value)
- {
- if ($this->definition->hasNegation($name)) {
- $this->options[$this->definition->negationToName($name)] = !$value;
- return;
- } elseif (!$this->definition->hasOption($name)) {
- throw new InvalidArgumentException(sprintf('The "%s" option does not exist.', $name));
- }
- $this->options[$name] = $value;
- }
- public function hasOption(string $name)
- {
- return $this->definition->hasOption($name) || $this->definition->hasNegation($name);
- }
- public function escapeToken(string $token)
- {
- return preg_match('{^[\w-]+$}', $token) ? $token : escapeshellarg($token);
- }
- public function setStream($stream)
- {
- $this->stream = $stream;
- }
- public function getStream()
- {
- return $this->stream;
- }
- }
- <?php
- namespace Symfony\Component\Console\Input;
- use Symfony\Component\Console\Exception\InvalidArgumentException;
- use Symfony\Component\Console\Exception\LogicException;
- class InputArgument
- {
- public const REQUIRED = 1;
- public const OPTIONAL = 2;
- public const IS_ARRAY = 4;
- private $name;
- private $mode;
- private $default;
- private $description;
- public function __construct(string $name, int $mode = null, string $description = '', $default = null)
- {
- if (null === $mode) {
- $mode = self::OPTIONAL;
- } elseif ($mode > 7 || $mode < 1) {
- throw new InvalidArgumentException(sprintf('Argument mode "%s" is not valid.', $mode));
- }
- $this->name = $name;
- $this->mode = $mode;
- $this->description = $description;
- $this->setDefault($default);
- }
- public function getName()
- {
- return $this->name;
- }
- public function isRequired()
- {
- return self::REQUIRED === (self::REQUIRED & $this->mode);
- }
- public function isArray()
- {
- return self::IS_ARRAY === (self::IS_ARRAY & $this->mode);
- }
- public function setDefault($default = null)
- {
- if ($this->isRequired() && null !== $default) {
- throw new LogicException('Cannot set a default value except for InputArgument::OPTIONAL mode.');
- }
- if ($this->isArray()) {
- if (null === $default) {
- $default = [];
- } elseif (!\is_array($default)) {
- throw new LogicException('A default value for an array argument must be an array.');
- }
- }
- $this->default = $default;
- }
- public function getDefault()
- {
- return $this->default;
- }
- public function getDescription()
- {
- return $this->description;
- }
- }
- <?php
- namespace Symfony\Component\Console\Input;
- interface InputAwareInterface
- {
- public function setInput(InputInterface $input);
- }
- <?php
- namespace Symfony\Component\Console\Input;
- use Symfony\Component\Console\Exception\InvalidArgumentException;
- use Symfony\Component\Console\Exception\LogicException;
- class InputDefinition
- {
- private $arguments;
- private $requiredCount;
- private $lastArrayArgument;
- private $lastOptionalArgument;
- private $options;
- private $negations;
- private $shortcuts;
- public function __construct(array $definition = [])
- {
- $this->setDefinition($definition);
- }
- public function setDefinition(array $definition)
- {
- $arguments = [];
- $options = [];
- foreach ($definition as $item) {
- if ($item instanceof InputOption) {
- $options[] = $item;
- } else {
- $arguments[] = $item;
- }
- }
- $this->setArguments($arguments);
- $this->setOptions($options);
- }
- public function setArguments(array $arguments = [])
- {
- $this->arguments = [];
- $this->requiredCount = 0;
- $this->lastOptionalArgument = null;
- $this->lastArrayArgument = null;
- $this->addArguments($arguments);
- }
- public function addArguments(?array $arguments = [])
- {
- if (null !== $arguments) {
- foreach ($arguments as $argument) {
- $this->addArgument($argument);
- }
- }
- }
- public function addArgument(InputArgument $argument)
- {
- if (isset($this->arguments[$argument->getName()])) {
- throw new LogicException(sprintf('An argument with name "%s" already exists.', $argument->getName()));
- }
- if (null !== $this->lastArrayArgument) {
- throw new LogicException(sprintf('Cannot add a required argument "%s" after an array argument "%s".', $argument->getName(), $this->lastArrayArgument->getName()));
- }
- if ($argument->isRequired() && null !== $this->lastOptionalArgument) {
- throw new LogicException(sprintf('Cannot add a required argument "%s" after an optional one "%s".', $argument->getName(), $this->lastOptionalArgument->getName()));
- }
- if ($argument->isArray()) {
- $this->lastArrayArgument = $argument;
- }
- if ($argument->isRequired()) {
- ++$this->requiredCount;
- } else {
- $this->lastOptionalArgument = $argument;
- }
- $this->arguments[$argument->getName()] = $argument;
- }
- public function getArgument($name)
- {
- if (!$this->hasArgument($name)) {
- throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
- }
- $arguments = \is_int($name) ? array_values($this->arguments) : $this->arguments;
- return $arguments[$name];
- }
- public function hasArgument($name)
- {
- $arguments = \is_int($name) ? array_values($this->arguments) : $this->arguments;
- return isset($arguments[$name]);
- }
- public function getArguments()
- {
- return $this->arguments;
- }
- public function getArgumentCount()
- {
- return null !== $this->lastArrayArgument ? \PHP_INT_MAX : \count($this->arguments);
- }
- public function getArgumentRequiredCount()
- {
- return $this->requiredCount;
- }
- public function getArgumentDefaults()
- {
- $values = [];
- foreach ($this->arguments as $argument) {
- $values[$argument->getName()] = $argument->getDefault();
- }
- return $values;
- }
- public function setOptions(array $options = [])
- {
- $this->options = [];
- $this->shortcuts = [];
- $this->negations = [];
- $this->addOptions($options);
- }
- public function addOptions(array $options = [])
- {
- foreach ($options as $option) {
- $this->addOption($option);
- }
- }
- public function addOption(InputOption $option)
- {
- if (isset($this->options[$option->getName()]) && !$option->equals($this->options[$option->getName()])) {
- throw new LogicException(sprintf('An option named "%s" already exists.', $option->getName()));
- }
- if (isset($this->negations[$option->getName()])) {
- throw new LogicException(sprintf('An option named "%s" already exists.', $option->getName()));
- }
- if ($option->getShortcut()) {
- foreach (explode('|', $option->getShortcut()) as $shortcut) {
- if (isset($this->shortcuts[$shortcut]) && !$option->equals($this->options[$this->shortcuts[$shortcut]])) {
- throw new LogicException(sprintf('An option with shortcut "%s" already exists.', $shortcut));
- }
- }
- }
- $this->options[$option->getName()] = $option;
- if ($option->getShortcut()) {
- foreach (explode('|', $option->getShortcut()) as $shortcut) {
- $this->shortcuts[$shortcut] = $option->getName();
- }
- }
- if ($option->isNegatable()) {
- $negatedName = 'no-'.$option->getName();
- if (isset($this->options[$negatedName])) {
- throw new LogicException(sprintf('An option named "%s" already exists.', $negatedName));
- }
- $this->negations[$negatedName] = $option->getName();
- }
- }
- public function getOption(string $name)
- {
- if (!$this->hasOption($name)) {
- throw new InvalidArgumentException(sprintf('The "--%s" option does not exist.', $name));
- }
- return $this->options[$name];
- }
- public function hasOption(string $name)
- {
- return isset($this->options[$name]);
- }
- public function getOptions()
- {
- return $this->options;
- }
- public function hasShortcut(string $name)
- {
- return isset($this->shortcuts[$name]);
- }
- public function hasNegation(string $name): bool
- {
- return isset($this->negations[$name]);
- }
- public function getOptionForShortcut(string $shortcut)
- {
- return $this->getOption($this->shortcutToName($shortcut));
- }
- public function getOptionDefaults()
- {
- $values = [];
- foreach ($this->options as $option) {
- $values[$option->getName()] = $option->getDefault();
- }
- return $values;
- }
- public function shortcutToName(string $shortcut): string
- {
- if (!isset($this->shortcuts[$shortcut])) {
- throw new InvalidArgumentException(sprintf('The "-%s" option does not exist.', $shortcut));
- }
- return $this->shortcuts[$shortcut];
- }
- public function negationToName(string $negation): string
- {
- if (!isset($this->negations[$negation])) {
- throw new InvalidArgumentException(sprintf('The "--%s" option does not exist.', $negation));
- }
- return $this->negations[$negation];
- }
- public function getSynopsis(bool $short = false)
- {
- $elements = [];
- if ($short && $this->getOptions()) {
- $elements[] = '[options]';
- } elseif (!$short) {
- foreach ($this->getOptions() as $option) {
- $value = '';
- if ($option->acceptValue()) {
- $value = sprintf(
- ' %s%s%s',
- $option->isValueOptional() ? '[' : '',
- strtoupper($option->getName()),
- $option->isValueOptional() ? ']' : ''
- );
- }
- $shortcut = $option->getShortcut() ? sprintf('-%s|', $option->getShortcut()) : '';
- $negation = $option->isNegatable() ? sprintf('|--no-%s', $option->getName()) : '';
- $elements[] = sprintf('[%s--%s%s%s]', $shortcut, $option->getName(), $value, $negation);
- }
- }
- if (\count($elements) && $this->getArguments()) {
- $elements[] = '[--]';
- }
- $tail = '';
- foreach ($this->getArguments() as $argument) {
- $element = '<'.$argument->getName().'>';
- if ($argument->isArray()) {
- $element .= '...';
- }
- if (!$argument->isRequired()) {
- $element = '['.$element;
- $tail .= ']';
- }
- $elements[] = $element;
- }
- return implode(' ', $elements).$tail;
- }
- }
- <?php
- namespace Symfony\Component\Console\Input;
- use Symfony\Component\Console\Exception\InvalidArgumentException;
- use Symfony\Component\Console\Exception\RuntimeException;
- interface InputInterface
- {
- public function getFirstArgument();
- public function hasParameterOption($values, bool $onlyParams = false);
- public function getParameterOption($values, $default = false, bool $onlyParams = false);
- public function bind(InputDefinition $definition);
- public function validate();
- public function getArguments();
- public function getArgument(string $name);
- public function setArgument(string $name, $value);
- public function hasArgument(string $name);
- public function getOptions();
- public function getOption(string $name);
- public function setOption(string $name, $value);
- public function hasOption(string $name);
- public function isInteractive();
- public function setInteractive(bool $interactive);
- }
- <?php
- namespace Symfony\Component\Console\Input;
- use Symfony\Component\Console\Exception\InvalidArgumentException;
- use Symfony\Component\Console\Exception\LogicException;
- class InputOption
- {
- public const VALUE_NONE = 1;
- public const VALUE_REQUIRED = 2;
- public const VALUE_OPTIONAL = 4;
- public const VALUE_IS_ARRAY = 8;
- public const VALUE_NEGATABLE = 16;
- private $name;
- private $shortcut;
- private $mode;
- private $default;
- private $description;
- public function __construct(string $name, $shortcut = null, int $mode = null, string $description = '', $default = null)
- {
- if (str_starts_with($name, '--')) {
- $name = substr($name, 2);
- }
- if (empty($name)) {
- throw new InvalidArgumentException('An option name cannot be empty.');
- }
- if (empty($shortcut)) {
- $shortcut = null;
- }
- if (null !== $shortcut) {
- if (\is_array($shortcut)) {
- $shortcut = implode('|', $shortcut);
- }
- $shortcuts = preg_split('{(\|)-?}', ltrim($shortcut, '-'));
- $shortcuts = array_filter($shortcuts);
- $shortcut = implode('|', $shortcuts);
- if (empty($shortcut)) {
- throw new InvalidArgumentException('An option shortcut cannot be empty.');
- }
- }
- if (null === $mode) {
- $mode = self::VALUE_NONE;
- } elseif ($mode >= (self::VALUE_NEGATABLE << 1) || $mode < 1) {
- throw new InvalidArgumentException(sprintf('Option mode "%s" is not valid.', $mode));
- }
- $this->name = $name;
- $this->shortcut = $shortcut;
- $this->mode = $mode;
- $this->description = $description;
- if ($this->isArray() && !$this->acceptValue()) {
- throw new InvalidArgumentException('Impossible to have an option mode VALUE_IS_ARRAY if the option does not accept a value.');
- }
- if ($this->isNegatable() && $this->acceptValue()) {
- throw new InvalidArgumentException('Impossible to have an option mode VALUE_NEGATABLE if the option also accepts a value.');
- }
- $this->setDefault($default);
- }
- public function getShortcut()
- {
- return $this->shortcut;
- }
- public function getName()
- {
- return $this->name;
- }
- public function acceptValue()
- {
- return $this->isValueRequired() || $this->isValueOptional();
- }
- public function isValueRequired()
- {
- return self::VALUE_REQUIRED === (self::VALUE_REQUIRED & $this->mode);
- }
- public function isValueOptional()
- {
- return self::VALUE_OPTIONAL === (self::VALUE_OPTIONAL & $this->mode);
- }
- public function isArray()
- {
- return self::VALUE_IS_ARRAY === (self::VALUE_IS_ARRAY & $this->mode);
- }
- public function isNegatable(): bool
- {
- return self::VALUE_NEGATABLE === (self::VALUE_NEGATABLE & $this->mode);
- }
- public function setDefault($default = null)
- {
- if (self::VALUE_NONE === (self::VALUE_NONE & $this->mode) && null !== $default) {
- throw new LogicException('Cannot set a default value when using InputOption::VALUE_NONE mode.');
- }
- if ($this->isArray()) {
- if (null === $default) {
- $default = [];
- } elseif (!\is_array($default)) {
- throw new LogicException('A default value for an array option must be an array.');
- }
- }
- $this->default = $this->acceptValue() || $this->isNegatable() ? $default : false;
- }
- public function getDefault()
- {
- return $this->default;
- }
- public function getDescription()
- {
- return $this->description;
- }
- public function equals(self $option)
- {
- return $option->getName() === $this->getName()
- && $option->getShortcut() === $this->getShortcut()
- && $option->getDefault() === $this->getDefault()
- && $option->isNegatable() === $this->isNegatable()
- && $option->isArray() === $this->isArray()
- && $option->isValueRequired() === $this->isValueRequired()
- && $option->isValueOptional() === $this->isValueOptional()
- ;
- }
- }
- <?php
- namespace Symfony\Component\Console\Input;
- interface StreamableInputInterface extends InputInterface
- {
- public function setStream($stream);
- public function getStream();
- }
- <?php
- namespace Symfony\Component\Console\Input;
- use Symfony\Component\Console\Exception\InvalidArgumentException;
- class StringInput extends ArgvInput
- {
- public const REGEX_STRING = '([^\s]+?)(?:\s|(?<!\\\\)"|(?<!\\\\)\'|$)';
- public const REGEX_UNQUOTED_STRING = '([^\s\\\\]+?)';
- public const REGEX_QUOTED_STRING = '(?:"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"|\'([^\'\\\\]*(?:\\\\.[^\'\\\\]*)*)\')';
- public function __construct(string $input)
- {
- parent::__construct([]);
- $this->setTokens($this->tokenize($input));
- }
- private function tokenize(string $input): array
- {
- $tokens = [];
- $length = \strlen($input);
- $cursor = 0;
- $token = null;
- while ($cursor < $length) {
- if ('\\' === $input[$cursor]) {
- $token .= $input[++$cursor] ?? '';
- ++$cursor;
- continue;
- }
- if (preg_match('/\s+/A', $input, $match, 0, $cursor)) {
- if (null !== $token) {
- $tokens[] = $token;
- $token = null;
- }
- } elseif (preg_match('/([^="\'\s]+?)(=?)('.self::REGEX_QUOTED_STRING.'+)/A', $input, $match, 0, $cursor)) {
- $token .= $match[1].$match[2].stripcslashes(str_replace(['"\'', '\'"', '\'\'', '""'], '', substr($match[3], 1, -1)));
- } elseif (preg_match('/'.self::REGEX_QUOTED_STRING.'/A', $input, $match, 0, $cursor)) {
- $token .= stripcslashes(substr($match[0], 1, -1));
- } elseif (preg_match('/'.self::REGEX_UNQUOTED_STRING.'/A', $input, $match, 0, $cursor)) {
- $token .= $match[1];
- } else {
- throw new InvalidArgumentException(sprintf('Unable to parse input near "... %s ...".', substr($input, $cursor, 10)));
- }
- $cursor += \strlen($match[0]);
- }
- if (null !== $token) {
- $tokens[] = $token;
- }
- return $tokens;
- }
- }
- Copyright (c) 2004-2022 Fabien Potencier
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is furnished
- to do so, subject to the following conditions:
- The above copyright notice and this permission notice shall be included in all
- copies or substantial portions of the Software.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
- <?php
- namespace Symfony\Component\Console\Logger;
- use Psr\Log\AbstractLogger;
- use Psr\Log\InvalidArgumentException;
- use Psr\Log\LogLevel;
- use Symfony\Component\Console\Output\ConsoleOutputInterface;
- use Symfony\Component\Console\Output\OutputInterface;
- class ConsoleLogger extends AbstractLogger
- {
- public const INFO = 'info';
- public const ERROR = 'error';
- private $output;
- private $verbosityLevelMap = [
- LogLevel::EMERGENCY => OutputInterface::VERBOSITY_NORMAL,
- LogLevel::ALERT => OutputInterface::VERBOSITY_NORMAL,
- LogLevel::CRITICAL => OutputInterface::VERBOSITY_NORMAL,
- LogLevel::ERROR => OutputInterface::VERBOSITY_NORMAL,
- LogLevel::WARNING => OutputInterface::VERBOSITY_NORMAL,
- LogLevel::NOTICE => OutputInterface::VERBOSITY_VERBOSE,
- LogLevel::INFO => OutputInterface::VERBOSITY_VERY_VERBOSE,
- LogLevel::DEBUG => OutputInterface::VERBOSITY_DEBUG,
- ];
- private $formatLevelMap = [
- LogLevel::EMERGENCY => self::ERROR,
- LogLevel::ALERT => self::ERROR,
- LogLevel::CRITICAL => self::ERROR,
- LogLevel::ERROR => self::ERROR,
- LogLevel::WARNING => self::INFO,
- LogLevel::NOTICE => self::INFO,
- LogLevel::INFO => self::INFO,
- LogLevel::DEBUG => self::INFO,
- ];
- private $errored = false;
- public function __construct(OutputInterface $output, array $verbosityLevelMap = [], array $formatLevelMap = [])
- {
- $this->output = $output;
- $this->verbosityLevelMap = $verbosityLevelMap + $this->verbosityLevelMap;
- $this->formatLevelMap = $formatLevelMap + $this->formatLevelMap;
- }
- public function log($level, $message, array $context = [])
- {
- if (!isset($this->verbosityLevelMap[$level])) {
- throw new InvalidArgumentException(sprintf('The log level "%s" does not exist.', $level));
- }
- $output = $this->output;
- if (self::ERROR === $this->formatLevelMap[$level]) {
- if ($this->output instanceof ConsoleOutputInterface) {
- $output = $output->getErrorOutput();
- }
- $this->errored = true;
- }
- if ($output->getVerbosity() >= $this->verbosityLevelMap[$level]) {
- $output->writeln(sprintf('<%1$s>[%2$s] %3$s</%1$s>', $this->formatLevelMap[$level], $level, $this->interpolate($message, $context)), $this->verbosityLevelMap[$level]);
- }
- }
- public function hasErrored()
- {
- return $this->errored;
- }
- private function interpolate(string $message, array $context): string
- {
- if (!str_contains($message, '{')) {
- return $message;
- }
- $replacements = [];
- foreach ($context as $key => $val) {
- if (null === $val || \is_scalar($val) || (\is_object($val) && method_exists($val, '__toString'))) {
- $replacements["{{$key}}"] = $val;
- } elseif ($val instanceof \DateTimeInterface) {
- $replacements["{{$key}}"] = $val->format(\DateTime::RFC3339);
- } elseif (\is_object($val)) {
- $replacements["{{$key}}"] = '[object '.\get_class($val).']';
- } else {
- $replacements["{{$key}}"] = '['.\gettype($val).']';
- }
- }
- return strtr($message, $replacements);
- }
- }
- <?php
- namespace Symfony\Component\Console\Output;
- class BufferedOutput extends Output
- {
- private $buffer = '';
- public function fetch()
- {
- $content = $this->buffer;
- $this->buffer = '';
- return $content;
- }
- protected function doWrite(string $message, bool $newline)
- {
- $this->buffer .= $message;
- if ($newline) {
- $this->buffer .= \PHP_EOL;
- }
- }
- }
- <?php
- namespace Symfony\Component\Console\Output;
- use Symfony\Component\Console\Formatter\OutputFormatterInterface;
- class ConsoleOutput extends StreamOutput implements ConsoleOutputInterface
- {
- private $stderr;
- private $consoleSectionOutputs = [];
- public function __construct(int $verbosity = self::VERBOSITY_NORMAL, bool $decorated = null, OutputFormatterInterface $formatter = null)
- {
- parent::__construct($this->openOutputStream(), $verbosity, $decorated, $formatter);
- if (null === $formatter) {
- $this->stderr = new StreamOutput($this->openErrorStream(), $verbosity, $decorated);
- return;
- }
- $actualDecorated = $this->isDecorated();
- $this->stderr = new StreamOutput($this->openErrorStream(), $verbosity, $decorated, $this->getFormatter());
- if (null === $decorated) {
- $this->setDecorated($actualDecorated && $this->stderr->isDecorated());
- }
- }
- public function section(): ConsoleSectionOutput
- {
- return new ConsoleSectionOutput($this->getStream(), $this->consoleSectionOutputs, $this->getVerbosity(), $this->isDecorated(), $this->getFormatter());
- }
- public function setDecorated(bool $decorated)
- {
- parent::setDecorated($decorated);
- $this->stderr->setDecorated($decorated);
- }
- public function setFormatter(OutputFormatterInterface $formatter)
- {
- parent::setFormatter($formatter);
- $this->stderr->setFormatter($formatter);
- }
- public function setVerbosity(int $level)
- {
- parent::setVerbosity($level);
- $this->stderr->setVerbosity($level);
- }
- public function getErrorOutput()
- {
- return $this->stderr;
- }
- public function setErrorOutput(OutputInterface $error)
- {
- $this->stderr = $error;
- }
- protected function hasStdoutSupport()
- {
- return false === $this->isRunningOS400();
- }
- protected function hasStderrSupport()
- {
- return false === $this->isRunningOS400();
- }
- private function isRunningOS400(): bool
- {
- $checks = [
- \function_exists('php_uname') ? php_uname('s') : '',
- getenv('OSTYPE'),
- \PHP_OS,
- ];
- return false !== stripos(implode(';', $checks), 'OS400');
- }
- private function openOutputStream()
- {
- if (!$this->hasStdoutSupport()) {
- return fopen('php://output', 'w');
- }
- return \defined('STDOUT') ? \STDOUT : (@fopen('php://stdout', 'w') ?: fopen('php://output', 'w'));
- }
- private function openErrorStream()
- {
- if (!$this->hasStderrSupport()) {
- return fopen('php://output', 'w');
- }
- return \defined('STDERR') ? \STDERR : (@fopen('php://stderr', 'w') ?: fopen('php://output', 'w'));
- }
- }
- <?php
- namespace Symfony\Component\Console\Output;
- interface ConsoleOutputInterface extends OutputInterface
- {
- public function getErrorOutput();
- public function setErrorOutput(OutputInterface $error);
- public function section(): ConsoleSectionOutput;
- }
- <?php
- namespace Symfony\Component\Console\Output;
- use Symfony\Component\Console\Formatter\OutputFormatterInterface;
- use Symfony\Component\Console\Helper\Helper;
- use Symfony\Component\Console\Terminal;
- class ConsoleSectionOutput extends StreamOutput
- {
- private $content = [];
- private $lines = 0;
- private $sections;
- private $terminal;
- public function __construct($stream, array &$sections, int $verbosity, bool $decorated, OutputFormatterInterface $formatter)
- {
- parent::__construct($stream, $verbosity, $decorated, $formatter);
- array_unshift($sections, $this);
- $this->sections = &$sections;
- $this->terminal = new Terminal();
- }
- public function clear(int $lines = null)
- {
- if (empty($this->content) || !$this->isDecorated()) {
- return;
- }
- if ($lines) {
- array_splice($this->content, -($lines * 2));
- } else {
- $lines = $this->lines;
- $this->content = [];
- }
- $this->lines -= $lines;
- parent::doWrite($this->popStreamContentUntilCurrentSection($lines), false);
- }
- public function overwrite($message)
- {
- $this->clear();
- $this->writeln($message);
- }
- public function getContent(): string
- {
- return implode('', $this->content);
- }
- public function addContent(string $input)
- {
- foreach (explode(\PHP_EOL, $input) as $lineContent) {
- $this->lines += ceil($this->getDisplayLength($lineContent) / $this->terminal->getWidth()) ?: 1;
- $this->content[] = $lineContent;
- $this->content[] = \PHP_EOL;
- }
- }
- protected function doWrite(string $message, bool $newline)
- {
- if (!$this->isDecorated()) {
- parent::doWrite($message, $newline);
- return;
- }
- $erasedContent = $this->popStreamContentUntilCurrentSection();
- $this->addContent($message);
- parent::doWrite($message, true);
- parent::doWrite($erasedContent, false);
- }
- private function popStreamContentUntilCurrentSection(int $numberOfLinesToClearFromCurrentSection = 0): string
- {
- $numberOfLinesToClear = $numberOfLinesToClearFromCurrentSection;
- $erasedContent = [];
- foreach ($this->sections as $section) {
- if ($section === $this) {
- break;
- }
- $numberOfLinesToClear += $section->lines;
- $erasedContent[] = $section->getContent();
- }
- if ($numberOfLinesToClear > 0) {
- parent::doWrite(sprintf("\x1b[%dA", $numberOfLinesToClear), false);
- parent::doWrite("\x1b[0J", false);
- }
- return implode('', array_reverse($erasedContent));
- }
- private function getDisplayLength(string $text): int
- {
- return Helper::width(Helper::removeDecoration($this->getFormatter(), str_replace("\t", ' ', $text)));
- }
- }
- <?php
- namespace Symfony\Component\Console\Output;
- use Symfony\Component\Console\Formatter\NullOutputFormatter;
- use Symfony\Component\Console\Formatter\OutputFormatterInterface;
- class NullOutput implements OutputInterface
- {
- private $formatter;
- public function setFormatter(OutputFormatterInterface $formatter)
- {
- }
- public function getFormatter()
- {
- if ($this->formatter) {
- return $this->formatter;
- }
- return $this->formatter = new NullOutputFormatter();
- }
- public function setDecorated(bool $decorated)
- {
- }
- public function isDecorated()
- {
- return false;
- }
- public function setVerbosity(int $level)
- {
- }
- public function getVerbosity()
- {
- return self::VERBOSITY_QUIET;
- }
- public function isQuiet()
- {
- return true;
- }
- public function isVerbose()
- {
- return false;
- }
- public function isVeryVerbose()
- {
- return false;
- }
- public function isDebug()
- {
- return false;
- }
- public function writeln($messages, int $options = self::OUTPUT_NORMAL)
- {
- }
- public function write($messages, bool $newline = false, int $options = self::OUTPUT_NORMAL)
- {
- }
- }
- <?php
- namespace Symfony\Component\Console\Output;
- use Symfony\Component\Console\Formatter\OutputFormatter;
- use Symfony\Component\Console\Formatter\OutputFormatterInterface;
- abstract class Output implements OutputInterface
- {
- private $verbosity;
- private $formatter;
- public function __construct(?int $verbosity = self::VERBOSITY_NORMAL, bool $decorated = false, OutputFormatterInterface $formatter = null)
- {
- $this->verbosity = $verbosity ?? self::VERBOSITY_NORMAL;
- $this->formatter = $formatter ?? new OutputFormatter();
- $this->formatter->setDecorated($decorated);
- }
- public function setFormatter(OutputFormatterInterface $formatter)
- {
- $this->formatter = $formatter;
- }
- public function getFormatter()
- {
- return $this->formatter;
- }
- public function setDecorated(bool $decorated)
- {
- $this->formatter->setDecorated($decorated);
- }
- public function isDecorated()
- {
- return $this->formatter->isDecorated();
- }
- public function setVerbosity(int $level)
- {
- $this->verbosity = $level;
- }
- public function getVerbosity()
- {
- return $this->verbosity;
- }
- public function isQuiet()
- {
- return self::VERBOSITY_QUIET === $this->verbosity;
- }
- public function isVerbose()
- {
- return self::VERBOSITY_VERBOSE <= $this->verbosity;
- }
- public function isVeryVerbose()
- {
- return self::VERBOSITY_VERY_VERBOSE <= $this->verbosity;
- }
- public function isDebug()
- {
- return self::VERBOSITY_DEBUG <= $this->verbosity;
- }
- public function writeln($messages, int $options = self::OUTPUT_NORMAL)
- {
- $this->write($messages, true, $options);
- }
- public function write($messages, bool $newline = false, int $options = self::OUTPUT_NORMAL)
- {
- if (!is_iterable($messages)) {
- $messages = [$messages];
- }
- $types = self::OUTPUT_NORMAL | self::OUTPUT_RAW | self::OUTPUT_PLAIN;
- $type = $types & $options ?: self::OUTPUT_NORMAL;
- $verbosities = self::VERBOSITY_QUIET | self::VERBOSITY_NORMAL | self::VERBOSITY_VERBOSE | self::VERBOSITY_VERY_VERBOSE | self::VERBOSITY_DEBUG;
- $verbosity = $verbosities & $options ?: self::VERBOSITY_NORMAL;
- if ($verbosity > $this->getVerbosity()) {
- return;
- }
- foreach ($messages as $message) {
- switch ($type) {
- case OutputInterface::OUTPUT_NORMAL:
- $message = $this->formatter->format($message);
- break;
- case OutputInterface::OUTPUT_RAW:
- break;
- case OutputInterface::OUTPUT_PLAIN:
- $message = strip_tags($this->formatter->format($message));
- break;
- }
- $this->doWrite($message ?? '', $newline);
- }
- }
- abstract protected function doWrite(string $message, bool $newline);
- }
- <?php
- namespace Symfony\Component\Console\Output;
- use Symfony\Component\Console\Formatter\OutputFormatterInterface;
- interface OutputInterface
- {
- public const VERBOSITY_QUIET = 16;
- public const VERBOSITY_NORMAL = 32;
- public const VERBOSITY_VERBOSE = 64;
- public const VERBOSITY_VERY_VERBOSE = 128;
- public const VERBOSITY_DEBUG = 256;
- public const OUTPUT_NORMAL = 1;
- public const OUTPUT_RAW = 2;
- public const OUTPUT_PLAIN = 4;
- public function write($messages, bool $newline = false, int $options = 0);
- public function writeln($messages, int $options = 0);
- public function setVerbosity(int $level);
- public function getVerbosity();
- public function isQuiet();
- public function isVerbose();
- public function isVeryVerbose();
- public function isDebug();
- public function setDecorated(bool $decorated);
- public function isDecorated();
- public function setFormatter(OutputFormatterInterface $formatter);
- public function getFormatter();
- }
- <?php
- namespace Symfony\Component\Console\Output;
- use Symfony\Component\Console\Exception\InvalidArgumentException;
- use Symfony\Component\Console\Formatter\OutputFormatterInterface;
- class StreamOutput extends Output
- {
- private $stream;
- public function __construct($stream, int $verbosity = self::VERBOSITY_NORMAL, bool $decorated = null, OutputFormatterInterface $formatter = null)
- {
- if (!\is_resource($stream) || 'stream' !== get_resource_type($stream)) {
- throw new InvalidArgumentException('The StreamOutput class needs a stream as its first argument.');
- }
- $this->stream = $stream;
- if (null === $decorated) {
- $decorated = $this->hasColorSupport();
- }
- parent::__construct($verbosity, $decorated, $formatter);
- }
- public function getStream()
- {
- return $this->stream;
- }
- protected function doWrite(string $message, bool $newline)
- {
- if ($newline) {
- $message .= \PHP_EOL;
- }
- @fwrite($this->stream, $message);
- fflush($this->stream);
- }
- protected function hasColorSupport()
- {
- if (isset($_SERVER['NO_COLOR']) || false !== getenv('NO_COLOR')) {
- return false;
- }
- if ('Hyper' === getenv('TERM_PROGRAM')) {
- return true;
- }
- if (\DIRECTORY_SEPARATOR === '\\') {
- return (\function_exists('sapi_windows_vt100_support')
- && @sapi_windows_vt100_support($this->stream))
- || false !== getenv('ANSICON')
- || 'ON' === getenv('ConEmuANSI')
- || 'xterm' === getenv('TERM');
- }
- return stream_isatty($this->stream);
- }
- }
- <?php
- namespace Symfony\Component\Console\Output;
- use Symfony\Component\Console\Exception\InvalidArgumentException;
- use Symfony\Component\Console\Formatter\OutputFormatterInterface;
- class TrimmedBufferOutput extends Output
- {
- private $maxLength;
- private $buffer = '';
- public function __construct(int $maxLength, ?int $verbosity = self::VERBOSITY_NORMAL, bool $decorated = false, OutputFormatterInterface $formatter = null)
- {
- if ($maxLength <= 0) {
- throw new InvalidArgumentException(sprintf('"%s()" expects a strictly positive maxLength. Got %d.', __METHOD__, $maxLength));
- }
- parent::__construct($verbosity, $decorated, $formatter);
- $this->maxLength = $maxLength;
- }
- public function fetch()
- {
- $content = $this->buffer;
- $this->buffer = '';
- return $content;
- }
- protected function doWrite(string $message, bool $newline)
- {
- $this->buffer .= $message;
- if ($newline) {
- $this->buffer .= \PHP_EOL;
- }
- $this->buffer = substr($this->buffer, 0 - $this->maxLength);
- }
- }
- <?php
- namespace Symfony\Component\Console\Question;
- use Symfony\Component\Console\Exception\InvalidArgumentException;
- class ChoiceQuestion extends Question
- {
- private $choices;
- private $multiselect = false;
- private $prompt = ' > ';
- private $errorMessage = 'Value "%s" is invalid';
- public function __construct(string $question, array $choices, $default = null)
- {
- if (!$choices) {
- throw new \LogicException('Choice question must have at least 1 choice available.');
- }
- parent::__construct($question, $default);
- $this->choices = $choices;
- $this->setValidator($this->getDefaultValidator());
- $this->setAutocompleterValues($choices);
- }
- public function getChoices()
- {
- return $this->choices;
- }
- public function setMultiselect(bool $multiselect)
- {
- $this->multiselect = $multiselect;
- $this->setValidator($this->getDefaultValidator());
- return $this;
- }
- public function isMultiselect()
- {
- return $this->multiselect;
- }
- public function getPrompt()
- {
- return $this->prompt;
- }
- public function setPrompt(string $prompt)
- {
- $this->prompt = $prompt;
- return $this;
- }
- public function setErrorMessage(string $errorMessage)
- {
- $this->errorMessage = $errorMessage;
- $this->setValidator($this->getDefaultValidator());
- return $this;
- }
- private function getDefaultValidator(): callable
- {
- $choices = $this->choices;
- $errorMessage = $this->errorMessage;
- $multiselect = $this->multiselect;
- $isAssoc = $this->isAssoc($choices);
- return function ($selected) use ($choices, $errorMessage, $multiselect, $isAssoc) {
- if ($multiselect) {
- if (!preg_match('/^[^,]+(?:,[^,]+)*$/', (string) $selected, $matches)) {
- throw new InvalidArgumentException(sprintf($errorMessage, $selected));
- }
- $selectedChoices = explode(',', (string) $selected);
- } else {
- $selectedChoices = [$selected];
- }
- if ($this->isTrimmable()) {
- foreach ($selectedChoices as $k => $v) {
- $selectedChoices[$k] = trim((string) $v);
- }
- }
- $multiselectChoices = [];
- foreach ($selectedChoices as $value) {
- $results = [];
- foreach ($choices as $key => $choice) {
- if ($choice === $value) {
- $results[] = $key;
- }
- }
- if (\count($results) > 1) {
- throw new InvalidArgumentException(sprintf('The provided answer is ambiguous. Value should be one of "%s".', implode('" or "', $results)));
- }
- $result = array_search($value, $choices);
- if (!$isAssoc) {
- if (false !== $result) {
- $result = $choices[$result];
- } elseif (isset($choices[$value])) {
- $result = $choices[$value];
- }
- } elseif (false === $result && isset($choices[$value])) {
- $result = $value;
- }
- if (false === $result) {
- throw new InvalidArgumentException(sprintf($errorMessage, $value));
- }
- $multiselectChoices[] = $isAssoc ? (string) $result : $result;
- }
- if ($multiselect) {
- return $multiselectChoices;
- }
- return current($multiselectChoices);
- };
- }
- }
- <?php
- namespace Symfony\Component\Console\Question;
- class ConfirmationQuestion extends Question
- {
- private $trueAnswerRegex;
- public function __construct(string $question, bool $default = true, string $trueAnswerRegex = '/^y/i')
- {
- parent::__construct($question, $default);
- $this->trueAnswerRegex = $trueAnswerRegex;
- $this->setNormalizer($this->getDefaultNormalizer());
- }
- private function getDefaultNormalizer(): callable
- {
- $default = $this->getDefault();
- $regex = $this->trueAnswerRegex;
- return function ($answer) use ($default, $regex) {
- if (\is_bool($answer)) {
- return $answer;
- }
- $answerIsTrue = (bool) preg_match($regex, $answer);
- if (false === $default) {
- return $answer && $answerIsTrue;
- }
- return '' === $answer || $answerIsTrue;
- };
- }
- }
- <?php
- namespace Symfony\Component\Console\Question;
- use Symfony\Component\Console\Exception\InvalidArgumentException;
- use Symfony\Component\Console\Exception\LogicException;
- class Question
- {
- private $question;
- private $attempts;
- private $hidden = false;
- private $hiddenFallback = true;
- private $autocompleterCallback;
- private $validator;
- private $default;
- private $normalizer;
- private $trimmable = true;
- private $multiline = false;
- public function __construct(string $question, $default = null)
- {
- $this->question = $question;
- $this->default = $default;
- }
- public function getQuestion()
- {
- return $this->question;
- }
- public function getDefault()
- {
- return $this->default;
- }
- public function isMultiline(): bool
- {
- return $this->multiline;
- }
- public function setMultiline(bool $multiline): self
- {
- $this->multiline = $multiline;
- return $this;
- }
- public function isHidden()
- {
- return $this->hidden;
- }
- public function setHidden(bool $hidden)
- {
- if ($this->autocompleterCallback) {
- throw new LogicException('A hidden question cannot use the autocompleter.');
- }
- $this->hidden = $hidden;
- return $this;
- }
- public function isHiddenFallback()
- {
- return $this->hiddenFallback;
- }
- public function setHiddenFallback(bool $fallback)
- {
- $this->hiddenFallback = $fallback;
- return $this;
- }
- public function getAutocompleterValues()
- {
- $callback = $this->getAutocompleterCallback();
- return $callback ? $callback('') : null;
- }
- public function setAutocompleterValues(?iterable $values)
- {
- if (\is_array($values)) {
- $values = $this->isAssoc($values) ? array_merge(array_keys($values), array_values($values)) : array_values($values);
- $callback = static function () use ($values) {
- return $values;
- };
- } elseif ($values instanceof \Traversable) {
- $valueCache = null;
- $callback = static function () use ($values, &$valueCache) {
- return $valueCache ?? $valueCache = iterator_to_array($values, false);
- };
- } else {
- $callback = null;
- }
- return $this->setAutocompleterCallback($callback);
- }
- public function getAutocompleterCallback(): ?callable
- {
- return $this->autocompleterCallback;
- }
- public function setAutocompleterCallback(callable $callback = null): self
- {
- if ($this->hidden && null !== $callback) {
- throw new LogicException('A hidden question cannot use the autocompleter.');
- }
- $this->autocompleterCallback = $callback;
- return $this;
- }
- public function setValidator(callable $validator = null)
- {
- $this->validator = $validator;
- return $this;
- }
- public function getValidator()
- {
- return $this->validator;
- }
- public function setMaxAttempts(?int $attempts)
- {
- if (null !== $attempts && $attempts < 1) {
- throw new InvalidArgumentException('Maximum number of attempts must be a positive value.');
- }
- $this->attempts = $attempts;
- return $this;
- }
- public function getMaxAttempts()
- {
- return $this->attempts;
- }
- public function setNormalizer(callable $normalizer)
- {
- $this->normalizer = $normalizer;
- return $this;
- }
- public function getNormalizer()
- {
- return $this->normalizer;
- }
- protected function isAssoc(array $array)
- {
- return (bool) \count(array_filter(array_keys($array), 'is_string'));
- }
- public function isTrimmable(): bool
- {
- return $this->trimmable;
- }
- public function setTrimmable(bool $trimmable): self
- {
- $this->trimmable = $trimmable;
- return $this;
- }
- }
- MZ��������ÿÿ��¸�������@�����������������������������������è���º�´ Í!¸LÍ!This program cannot be run in DOS mode.
- $�������Æ,Í;§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��������à� ��
- ���������8������ ����@����������������������`�����?œ���@�����������������������������"��P����@�� �������������������P��p���!�����������������������������8!��@������������ ��Ø���������������������������.text��� ������
- ����������������� ��`.rdata����� ���
- �����������������@��@.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
- 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
- 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@��uhµ@�ÿ¬ @�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
- 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">
- <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
- <security>
- <requestedPrivileges>
- <requestedExecutionLevel level="asInvoker" uiAccess="false"></requestedExecutionLevel>
- </requestedPrivileges>
- </security>
- </trustInfo>
- <dependency>
- <dependentAssembly>
- <assemblyIdentity type="win32" name="Microsoft.VC90.CRT" version="9.0.21022.8" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
- </dependentAssembly>
- </dependency>
- </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§11´1È1Í1Ó1Û1á1ç1ô1ú12"2*23292A2M2_2j2p2¹2¿2Ç2Î2Ó2Ù2ß2ç2í2ô2û2333%303N3T3Z3`3f3l3s3z3�3ˆ3�3–3�3¥33µ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.
- #
- # (c) Fabien Potencier <fabien@symfony.com>
- #
- # For the full copyright and license information, please view
- # https://symfony.com/doc/current/contributing/code/license.html
- _sf_{{ COMMAND_NAME }}() {
- # Use newline as only separator to allow space in completion values
- IFS=$'\n'
- local sf_cmd="${COMP_WORDS[0]}"
- # for an alias, get the real script behind it
- if [[ $(type -t $sf_cmd) == "alias" ]]; then
- sf_cmd=$(alias $sf_cmd | sed -E "s/alias $sf_cmd='(.*)'/\1/")
- else
- sf_cmd=$(type -p $sf_cmd)
- fi
- if [ ! -x "$sf_cmd" ]; then
- return 1
- fi
- local cur prev words cword
- _get_comp_words_by_ref -n := cur prev words cword
- local completecmd=("$sf_cmd" "_complete" "-sbash" "-c$cword" "-S{{ VERSION }}")
- for w in ${words[@]}; do
- w=$(printf -- '%b' "$w")
- # remove quotes from typed values
- quote="${w:0:1}"
- if [ "$quote" == \' ]; then
- w="${w%\'}"
- w="${w#\'}"
- elif [ "$quote" == \" ]; then
- w="${w%\"}"
- w="${w#\"}"
- fi
- # empty values are ignored
- if [ ! -z "$w" ]; then
- completecmd+=("-i$w")
- fi
- done
- local sfcomplete
- if sfcomplete=$(${completecmd[@]} 2>&1); then
- local quote suggestions
- quote=${cur:0:1}
- # Use single quotes by default if suggestions contains backslash (FQCN)
- if [ "$quote" == '' ] && [[ "$sfcomplete" =~ \\ ]]; then
- quote=\'
- fi
- if [ "$quote" == \' ]; then
- # single quotes: no additional escaping (does not accept ' in values)
- suggestions=$(for s in $sfcomplete; do printf $'%q%q%q\n' "$quote" "$s" "$quote"; done)
- elif [ "$quote" == \" ]; then
- # double quotes: double escaping for \ $ ` "
- suggestions=$(for s in $sfcomplete; do
- s=${s//\\/\\\\}
- s=${s//\$/\\\$}
- s=${s//\`/\\\`}
- s=${s//\"/\\\"}
- printf $'%q%q%q\n' "$quote" "$s" "$quote";
- done)
- else
- # no quotes: double escaping
- suggestions=$(for s in $sfcomplete; do printf $'%q\n' $(printf '%q' "$s"); done)
- fi
- COMPREPLY=($(IFS=$'\n' compgen -W "$suggestions" -- $(printf -- "%q" "$cur")))
- __ltrim_colon_completions "$cur"
- else
- if [[ "$sfcomplete" != *"Command \"_complete\" is not defined."* ]]; then
- >&2 echo
- >&2 echo $sfcomplete
- fi
- return 1
- fi
- }
- complete -F _sf_{{ COMMAND_NAME }} {{ COMMAND_NAME }}
- <?php
- namespace Symfony\Component\Console\SignalRegistry;
- final class SignalRegistry
- {
- private $signalHandlers = [];
- public function __construct()
- {
- if (\function_exists('pcntl_async_signals')) {
- pcntl_async_signals(true);
- }
- }
- public function register(int $signal, callable $signalHandler): void
- {
- if (!isset($this->signalHandlers[$signal])) {
- $previousCallback = pcntl_signal_get_handler($signal);
- if (\is_callable($previousCallback)) {
- $this->signalHandlers[$signal][] = $previousCallback;
- }
- }
- $this->signalHandlers[$signal][] = $signalHandler;
- pcntl_signal($signal, [$this, 'handle']);
- }
- public static function isSupported(): bool
- {
- if (!\function_exists('pcntl_signal')) {
- return false;
- }
- if (\in_array('pcntl_signal', explode(',', \ini_get('disable_functions')))) {
- return false;
- }
- return true;
- }
- public function handle(int $signal): void
- {
- $count = \count($this->signalHandlers[$signal]);
- foreach ($this->signalHandlers[$signal] as $i => $signalHandler) {
- $hasNext = $i !== $count - 1;
- $signalHandler($signal, $hasNext);
- }
- }
- }
- <?php
- namespace Symfony\Component\Console;
- use Symfony\Component\Console\Command\Command;
- use Symfony\Component\Console\Input\InputInterface;
- use Symfony\Component\Console\Output\OutputInterface;
- class SingleCommandApplication extends Command
- {
- private $version = 'UNKNOWN';
- private $autoExit = true;
- private $running = false;
- public function setVersion(string $version): self
- {
- $this->version = $version;
- return $this;
- }
- public function setAutoExit(bool $autoExit): self
- {
- $this->autoExit = $autoExit;
- return $this;
- }
- public function run(InputInterface $input = null, OutputInterface $output = null): int
- {
- if ($this->running) {
- return parent::run($input, $output);
- }
- $application = new Application($this->getName() ?: 'UNKNOWN', $this->version);
- $application->setAutoExit($this->autoExit);
- $this->setName($_SERVER['argv'][0]);
- $application->add($this);
- $application->setDefaultCommand($this->getName(), true);
- $this->running = true;
- try {
- $ret = $application->run($input, $output);
- } finally {
- $this->running = false;
- }
- return $ret ?? 1;
- }
- }
- <?php
- namespace Symfony\Component\Console\Style;
- use Symfony\Component\Console\Formatter\OutputFormatterInterface;
- use Symfony\Component\Console\Helper\ProgressBar;
- use Symfony\Component\Console\Output\ConsoleOutputInterface;
- use Symfony\Component\Console\Output\OutputInterface;
- abstract class OutputStyle implements OutputInterface, StyleInterface
- {
- private $output;
- public function __construct(OutputInterface $output)
- {
- $this->output = $output;
- }
- public function newLine(int $count = 1)
- {
- $this->output->write(str_repeat(\PHP_EOL, $count));
- }
- public function createProgressBar(int $max = 0)
- {
- return new ProgressBar($this->output, $max);
- }
- public function write($messages, bool $newline = false, int $type = self::OUTPUT_NORMAL)
- {
- $this->output->write($messages, $newline, $type);
- }
- public function writeln($messages, int $type = self::OUTPUT_NORMAL)
- {
- $this->output->writeln($messages, $type);
- }
- public function setVerbosity(int $level)
- {
- $this->output->setVerbosity($level);
- }
- public function getVerbosity()
- {
- return $this->output->getVerbosity();
- }
- public function setDecorated(bool $decorated)
- {
- $this->output->setDecorated($decorated);
- }
- public function isDecorated()
- {
- return $this->output->isDecorated();
- }
- public function setFormatter(OutputFormatterInterface $formatter)
- {
- $this->output->setFormatter($formatter);
- }
- public function getFormatter()
- {
- return $this->output->getFormatter();
- }
- public function isQuiet()
- {
- return $this->output->isQuiet();
- }
- public function isVerbose()
- {
- return $this->output->isVerbose();
- }
- public function isVeryVerbose()
- {
- return $this->output->isVeryVerbose();
- }
- public function isDebug()
- {
- return $this->output->isDebug();
- }
- protected function getErrorOutput()
- {
- if (!$this->output instanceof ConsoleOutputInterface) {
- return $this->output;
- }
- return $this->output->getErrorOutput();
- }
- }
- <?php
- namespace Symfony\Component\Console\Style;
- interface StyleInterface
- {
- public function title(string $message);
- public function section(string $message);
- public function listing(array $elements);
- public function text($message);
- public function success($message);
- public function error($message);
- public function warning($message);
- public function note($message);
- public function caution($message);
- public function table(array $headers, array $rows);
- public function ask(string $question, string $default = null, callable $validator = null);
- public function askHidden(string $question, callable $validator = null);
- public function confirm(string $question, bool $default = true);
- public function choice(string $question, array $choices, $default = null);
- public function newLine(int $count = 1);
- public function progressStart(int $max = 0);
- public function progressAdvance(int $step = 1);
- public function progressFinish();
- }
- <?php
- namespace Symfony\Component\Console\Style;
- use Symfony\Component\Console\Exception\InvalidArgumentException;
- use Symfony\Component\Console\Exception\RuntimeException;
- use Symfony\Component\Console\Formatter\OutputFormatter;
- use Symfony\Component\Console\Helper\Helper;
- use Symfony\Component\Console\Helper\ProgressBar;
- use Symfony\Component\Console\Helper\SymfonyQuestionHelper;
- use Symfony\Component\Console\Helper\Table;
- use Symfony\Component\Console\Helper\TableCell;
- use Symfony\Component\Console\Helper\TableSeparator;
- use Symfony\Component\Console\Input\InputInterface;
- use Symfony\Component\Console\Output\ConsoleOutputInterface;
- use Symfony\Component\Console\Output\OutputInterface;
- use Symfony\Component\Console\Output\TrimmedBufferOutput;
- use Symfony\Component\Console\Question\ChoiceQuestion;
- use Symfony\Component\Console\Question\ConfirmationQuestion;
- use Symfony\Component\Console\Question\Question;
- use Symfony\Component\Console\Terminal;
- class SymfonyStyle extends OutputStyle
- {
- public const MAX_LINE_LENGTH = 120;
- private $input;
- private $output;
- private $questionHelper;
- private $progressBar;
- private $lineLength;
- private $bufferedOutput;
- public function __construct(InputInterface $input, OutputInterface $output)
- {
- $this->input = $input;
- $this->bufferedOutput = new TrimmedBufferOutput(\DIRECTORY_SEPARATOR === '\\' ? 4 : 2, $output->getVerbosity(), false, clone $output->getFormatter());
- $width = (new Terminal())->getWidth() ?: self::MAX_LINE_LENGTH;
- $this->lineLength = min($width - (int) (\DIRECTORY_SEPARATOR === '\\'), self::MAX_LINE_LENGTH);
- parent::__construct($this->output = $output);
- }
- public function block($messages, string $type = null, string $style = null, string $prefix = ' ', bool $padding = false, bool $escape = true)
- {
- $messages = \is_array($messages) ? array_values($messages) : [$messages];
- $this->autoPrependBlock();
- $this->writeln($this->createBlock($messages, $type, $style, $prefix, $padding, $escape));
- $this->newLine();
- }
- public function title(string $message)
- {
- $this->autoPrependBlock();
- $this->writeln([
- sprintf('<comment>%s</>', OutputFormatter::escapeTrailingBackslash($message)),
- sprintf('<comment>%s</>', str_repeat('=', Helper::width(Helper::removeDecoration($this->getFormatter(), $message)))),
- ]);
- $this->newLine();
- }
- public function section(string $message)
- {
- $this->autoPrependBlock();
- $this->writeln([
- sprintf('<comment>%s</>', OutputFormatter::escapeTrailingBackslash($message)),
- sprintf('<comment>%s</>', str_repeat('-', Helper::width(Helper::removeDecoration($this->getFormatter(), $message)))),
- ]);
- $this->newLine();
- }
- public function listing(array $elements)
- {
- $this->autoPrependText();
- $elements = array_map(function ($element) {
- return sprintf(' * %s', $element);
- }, $elements);
- $this->writeln($elements);
- $this->newLine();
- }
- public function text($message)
- {
- $this->autoPrependText();
- $messages = \is_array($message) ? array_values($message) : [$message];
- foreach ($messages as $message) {
- $this->writeln(sprintf(' %s', $message));
- }
- }
- public function comment($message)
- {
- $this->block($message, null, null, '<fg=default;bg=default> // </>', false, false);
- }
- public function success($message)
- {
- $this->block($message, 'OK', 'fg=black;bg=green', ' ', true);
- }
- public function error($message)
- {
- $this->block($message, 'ERROR', 'fg=white;bg=red', ' ', true);
- }
- public function warning($message)
- {
- $this->block($message, 'WARNING', 'fg=black;bg=yellow', ' ', true);
- }
- public function note($message)
- {
- $this->block($message, 'NOTE', 'fg=yellow', ' ! ');
- }
- public function info($message)
- {
- $this->block($message, 'INFO', 'fg=green', ' ', true);
- }
- public function caution($message)
- {
- $this->block($message, 'CAUTION', 'fg=white;bg=red', ' ! ', true);
- }
- public function table(array $headers, array $rows)
- {
- $this->createTable()
- ->setHeaders($headers)
- ->setRows($rows)
- ->render()
- ;
- $this->newLine();
- }
- public function horizontalTable(array $headers, array $rows)
- {
- $this->createTable()
- ->setHorizontal(true)
- ->setHeaders($headers)
- ->setRows($rows)
- ->render()
- ;
- $this->newLine();
- }
- public function definitionList(...$list)
- {
- $headers = [];
- $row = [];
- foreach ($list as $value) {
- if ($value instanceof TableSeparator) {
- $headers[] = $value;
- $row[] = $value;
- continue;
- }
- if (\is_string($value)) {
- $headers[] = new TableCell($value, ['colspan' => 2]);
- $row[] = null;
- continue;
- }
- if (!\is_array($value)) {
- throw new InvalidArgumentException('Value should be an array, string, or an instance of TableSeparator.');
- }
- $headers[] = key($value);
- $row[] = current($value);
- }
- $this->horizontalTable($headers, [$row]);
- }
- public function ask(string $question, string $default = null, callable $validator = null)
- {
- $question = new Question($question, $default);
- $question->setValidator($validator);
- return $this->askQuestion($question);
- }
- public function askHidden(string $question, callable $validator = null)
- {
- $question = new Question($question);
- $question->setHidden(true);
- $question->setValidator($validator);
- return $this->askQuestion($question);
- }
- public function confirm(string $question, bool $default = true)
- {
- return $this->askQuestion(new ConfirmationQuestion($question, $default));
- }
- public function choice(string $question, array $choices, $default = null)
- {
- if (null !== $default) {
- $values = array_flip($choices);
- $default = $values[$default] ?? $default;
- }
- return $this->askQuestion(new ChoiceQuestion($question, $choices, $default));
- }
- public function progressStart(int $max = 0)
- {
- $this->progressBar = $this->createProgressBar($max);
- $this->progressBar->start();
- }
- public function progressAdvance(int $step = 1)
- {
- $this->getProgressBar()->advance($step);
- }
- public function progressFinish()
- {
- $this->getProgressBar()->finish();
- $this->newLine(2);
- $this->progressBar = null;
- }
- public function createProgressBar(int $max = 0)
- {
- $progressBar = parent::createProgressBar($max);
- if ('\\' !== \DIRECTORY_SEPARATOR || 'Hyper' === getenv('TERM_PROGRAM')) {
- $progressBar->setEmptyBarCharacter('â–‘');
- $progressBar->setProgressCharacter('');
- $progressBar->setBarCharacter('â–“');
- }
- return $progressBar;
- }
- public function progressIterate(iterable $iterable, int $max = null): iterable
- {
- yield from $this->createProgressBar()->iterate($iterable, $max);
- $this->newLine(2);
- }
- public function askQuestion(Question $question)
- {
- if ($this->input->isInteractive()) {
- $this->autoPrependBlock();
- }
- if (!$this->questionHelper) {
- $this->questionHelper = new SymfonyQuestionHelper();
- }
- $answer = $this->questionHelper->ask($this->input, $this, $question);
- if ($this->input->isInteractive()) {
- $this->newLine();
- $this->bufferedOutput->write("\n");
- }
- return $answer;
- }
- public function writeln($messages, int $type = self::OUTPUT_NORMAL)
- {
- if (!is_iterable($messages)) {
- $messages = [$messages];
- }
- foreach ($messages as $message) {
- parent::writeln($message, $type);
- $this->writeBuffer($message, true, $type);
- }
- }
- public function write($messages, bool $newline = false, int $type = self::OUTPUT_NORMAL)
- {
- if (!is_iterable($messages)) {
- $messages = [$messages];
- }
- foreach ($messages as $message) {
- parent::write($message, $newline, $type);
- $this->writeBuffer($message, $newline, $type);
- }
- }
- public function newLine(int $count = 1)
- {
- parent::newLine($count);
- $this->bufferedOutput->write(str_repeat("\n", $count));
- }
- public function getErrorStyle()
- {
- return new self($this->input, $this->getErrorOutput());
- }
- public function createTable(): Table
- {
- $output = $this->output instanceof ConsoleOutputInterface ? $this->output->section() : $this->output;
- $style = clone Table::getStyleDefinition('symfony-style-guide');
- $style->setCellHeaderFormat('<info>%s</info>');
- return (new Table($output))->setStyle($style);
- }
- private function getProgressBar(): ProgressBar
- {
- if (!$this->progressBar) {
- throw new RuntimeException('The ProgressBar is not started.');
- }
- return $this->progressBar;
- }
- private function autoPrependBlock(): void
- {
- $chars = substr(str_replace(\PHP_EOL, "\n", $this->bufferedOutput->fetch()), -2);
- if (!isset($chars[0])) {
- $this->newLine();
- return;
- }
- $this->newLine(2 - substr_count($chars, "\n"));
- }
- private function autoPrependText(): void
- {
- $fetched = $this->bufferedOutput->fetch();
- if (!str_ends_with($fetched, "\n")) {
- $this->newLine();
- }
- }
- private function writeBuffer(string $message, bool $newLine, int $type): void
- {
- $this->bufferedOutput->write($message, $newLine, $type);
- }
- private function createBlock(iterable $messages, string $type = null, string $style = null, string $prefix = ' ', bool $padding = false, bool $escape = false): array
- {
- $indentLength = 0;
- $prefixLength = Helper::width(Helper::removeDecoration($this->getFormatter(), $prefix));
- $lines = [];
- if (null !== $type) {
- $type = sprintf('[%s] ', $type);
- $indentLength = \strlen($type);
- $lineIndentation = str_repeat(' ', $indentLength);
- }
- foreach ($messages as $key => $message) {
- if ($escape) {
- $message = OutputFormatter::escape($message);
- }
- $decorationLength = Helper::width($message) - Helper::width(Helper::removeDecoration($this->getFormatter(), $message));
- $messageLineLength = min($this->lineLength - $prefixLength - $indentLength + $decorationLength, $this->lineLength);
- $messageLines = explode(\PHP_EOL, wordwrap($message, $messageLineLength, \PHP_EOL, true));
- foreach ($messageLines as $messageLine) {
- $lines[] = $messageLine;
- }
- if (\count($messages) > 1 && $key < \count($messages) - 1) {
- $lines[] = '';
- }
- }
- $firstLineIndex = 0;
- if ($padding && $this->isDecorated()) {
- $firstLineIndex = 1;
- array_unshift($lines, '');
- $lines[] = '';
- }
- foreach ($lines as $i => &$line) {
- if (null !== $type) {
- $line = $firstLineIndex === $i ? $type.$line : $lineIndentation.$line;
- }
- $line = $prefix.$line;
- $line .= str_repeat(' ', max($this->lineLength - Helper::width(Helper::removeDecoration($this->getFormatter(), $line)), 0));
- if ($style) {
- $line = sprintf('<%s>%s</>', $style, $line);
- }
- }
- return $lines;
- }
- }
- <?php
- namespace Symfony\Component\Console;
- class Terminal
- {
- private static $width;
- private static $height;
- private static $stty;
- public function getWidth()
- {
- $width = getenv('COLUMNS');
- if (false !== $width) {
- return (int) trim($width);
- }
- if (null === self::$width) {
- self::initDimensions();
- }
- return self::$width ?: 80;
- }
- public function getHeight()
- {
- $height = getenv('LINES');
- if (false !== $height) {
- return (int) trim($height);
- }
- if (null === self::$height) {
- self::initDimensions();
- }
- return self::$height ?: 50;
- }
- public static function hasSttyAvailable(): bool
- {
- if (null !== self::$stty) {
- return self::$stty;
- }
- if (!\function_exists('exec')) {
- return false;
- }
- exec('stty 2>&1', $output, $exitcode);
- return self::$stty = 0 === $exitcode;
- }
- private static function initDimensions()
- {
- if ('\\' === \DIRECTORY_SEPARATOR) {
- if (preg_match('/^(\d+)x(\d+)(?: \((\d+)x(\d+)\))?$/', trim(getenv('ANSICON')), $matches)) {
- self::$width = (int) $matches[1];
- self::$height = isset($matches[4]) ? (int) $matches[4] : (int) $matches[2];
- } elseif (!self::hasVt100Support() && self::hasSttyAvailable()) {
- self::initDimensionsUsingStty();
- } elseif (null !== $dimensions = self::getConsoleMode()) {
- self::$width = (int) $dimensions[0];
- self::$height = (int) $dimensions[1];
- }
- } else {
- self::initDimensionsUsingStty();
- }
- }
- private static function hasVt100Support(): bool
- {
- return \function_exists('sapi_windows_vt100_support') && sapi_windows_vt100_support(fopen('php://stdout', 'w'));
- }
- private static function initDimensionsUsingStty()
- {
- if ($sttyString = self::getSttyColumns()) {
- if (preg_match('/rows.(\d+);.columns.(\d+);/i', $sttyString, $matches)) {
- self::$width = (int) $matches[2];
- self::$height = (int) $matches[1];
- } elseif (preg_match('/;.(\d+).rows;.(\d+).columns/i', $sttyString, $matches)) {
- self::$width = (int) $matches[2];
- self::$height = (int) $matches[1];
- }
- }
- }
- private static function getConsoleMode(): ?array
- {
- $info = self::readFromProcess('mode CON');
- if (null === $info || !preg_match('/--------+\r?\n.+?(\d+)\r?\n.+?(\d+)\r?\n/', $info, $matches)) {
- return null;
- }
- return [(int) $matches[2], (int) $matches[1]];
- }
- private static function getSttyColumns(): ?string
- {
- return self::readFromProcess('stty -a | grep columns');
- }
- private static function readFromProcess(string $command): ?string
- {
- if (!\function_exists('proc_open')) {
- return null;
- }
- $descriptorspec = [
- 1 => ['pipe', 'w'],
- 2 => ['pipe', 'w'],
- ];
- $process = proc_open($command, $descriptorspec, $pipes, null, null, ['suppress_errors' => true]);
- if (!\is_resource($process)) {
- return null;
- }
- $info = stream_get_contents($pipes[1]);
- fclose($pipes[1]);
- fclose($pipes[2]);
- proc_close($process);
- return $info;
- }
- }
- <?php
- namespace Symfony\Component\Console\Tester;
- use Symfony\Component\Console\Application;
- use Symfony\Component\Console\Input\ArrayInput;
- class ApplicationTester
- {
- use TesterTrait;
- private $application;
- public function __construct(Application $application)
- {
- $this->application = $application;
- }
- public function run(array $input, array $options = [])
- {
- $prevShellVerbosity = getenv('SHELL_VERBOSITY');
- try {
- $this->input = new ArrayInput($input);
- if (isset($options['interactive'])) {
- $this->input->setInteractive($options['interactive']);
- }
- if ($this->inputs) {
- $this->input->setStream(self::createStream($this->inputs));
- }
- $this->initOutput($options);
- return $this->statusCode = $this->application->run($this->input, $this->output);
- } finally {
- if (false === $prevShellVerbosity) {
- if (\function_exists('putenv')) {
- @putenv('SHELL_VERBOSITY');
- }
- unset($_ENV['SHELL_VERBOSITY']);
- unset($_SERVER['SHELL_VERBOSITY']);
- } else {
- if (\function_exists('putenv')) {
- @putenv('SHELL_VERBOSITY='.$prevShellVerbosity);
- }
- $_ENV['SHELL_VERBOSITY'] = $prevShellVerbosity;
- $_SERVER['SHELL_VERBOSITY'] = $prevShellVerbosity;
- }
- }
- }
- }
- <?php
- namespace Symfony\Component\Console\Tester;
- use Symfony\Component\Console\Command\Command;
- use Symfony\Component\Console\Completion\CompletionInput;
- use Symfony\Component\Console\Completion\CompletionSuggestions;
- class CommandCompletionTester
- {
- private $command;
- public function __construct(Command $command)
- {
- $this->command = $command;
- }
- public function complete(array $input): array
- {
- $currentIndex = \count($input);
- if ('' === end($input)) {
- array_pop($input);
- }
- array_unshift($input, $this->command->getName());
- $completionInput = CompletionInput::fromTokens($input, $currentIndex);
- $completionInput->bind($this->command->getDefinition());
- $suggestions = new CompletionSuggestions();
- $this->command->complete($completionInput, $suggestions);
- $options = [];
- foreach ($suggestions->getOptionSuggestions() as $option) {
- $options[] = '--'.$option->getName();
- }
- return array_map('strval', array_merge($options, $suggestions->getValueSuggestions()));
- }
- }
- <?php
- namespace Symfony\Component\Console\Tester;
- use Symfony\Component\Console\Command\Command;
- use Symfony\Component\Console\Input\ArrayInput;
- class CommandTester
- {
- use TesterTrait;
- private $command;
- public function __construct(Command $command)
- {
- $this->command = $command;
- }
- public function execute(array $input, array $options = [])
- {
- if (!isset($input['command'])
- && (null !== $application = $this->command->getApplication())
- && $application->getDefinition()->hasArgument('command')
- ) {
- $input = array_merge(['command' => $this->command->getName()], $input);
- }
- $this->input = new ArrayInput($input);
- $this->input->setStream(self::createStream($this->inputs));
- if (isset($options['interactive'])) {
- $this->input->setInteractive($options['interactive']);
- }
- if (!isset($options['decorated'])) {
- $options['decorated'] = false;
- }
- $this->initOutput($options);
- return $this->statusCode = $this->command->run($this->input, $this->output);
- }
- }
- <?php
- namespace Symfony\Component\Console\Tester\Constraint;
- use PHPUnit\Framework\Constraint\Constraint;
- use Symfony\Component\Console\Command\Command;
- final class CommandIsSuccessful extends Constraint
- {
- public function toString(): string
- {
- return 'is successful';
- }
- protected function matches($other): bool
- {
- return Command::SUCCESS === $other;
- }
- protected function failureDescription($other): string
- {
- return 'the command '.$this->toString();
- }
- protected function additionalFailureDescription($other): string
- {
- $mapping = [
- Command::FAILURE => 'Command failed.',
- Command::INVALID => 'Command was invalid.',
- ];
- return $mapping[$other] ?? sprintf('Command returned exit status %d.', $other);
- }
- }
- <?php
- namespace Symfony\Component\Console\Tester;
- use PHPUnit\Framework\Assert;
- use Symfony\Component\Console\Input\InputInterface;
- use Symfony\Component\Console\Output\ConsoleOutput;
- use Symfony\Component\Console\Output\OutputInterface;
- use Symfony\Component\Console\Output\StreamOutput;
- use Symfony\Component\Console\Tester\Constraint\CommandIsSuccessful;
- trait TesterTrait
- {
- private $output;
- private $inputs = [];
- private $captureStreamsIndependently = false;
- private $input;
- private $statusCode;
- public function getDisplay(bool $normalize = false)
- {
- if (null === $this->output) {
- throw new \RuntimeException('Output not initialized, did you execute the command before requesting the display?');
- }
- rewind($this->output->getStream());
- $display = stream_get_contents($this->output->getStream());
- if ($normalize) {
- $display = str_replace(\PHP_EOL, "\n", $display);
- }
- return $display;
- }
- public function getErrorOutput(bool $normalize = false)
- {
- if (!$this->captureStreamsIndependently) {
- throw new \LogicException('The error output is not available when the tester is run without "capture_stderr_separately" option set.');
- }
- rewind($this->output->getErrorOutput()->getStream());
- $display = stream_get_contents($this->output->getErrorOutput()->getStream());
- if ($normalize) {
- $display = str_replace(\PHP_EOL, "\n", $display);
- }
- return $display;
- }
- public function getInput()
- {
- return $this->input;
- }
- public function getOutput()
- {
- return $this->output;
- }
- public function getStatusCode()
- {
- if (null === $this->statusCode) {
- throw new \RuntimeException('Status code not initialized, did you execute the command before requesting the status code?');
- }
- return $this->statusCode;
- }
- public function assertCommandIsSuccessful(string $message = ''): void
- {
- Assert::assertThat($this->statusCode, new CommandIsSuccessful(), $message);
- }
- public function setInputs(array $inputs)
- {
- $this->inputs = $inputs;
- return $this;
- }
- private function initOutput(array $options)
- {
- $this->captureStreamsIndependently = \array_key_exists('capture_stderr_separately', $options) && $options['capture_stderr_separately'];
- if (!$this->captureStreamsIndependently) {
- $this->output = new StreamOutput(fopen('php://memory', 'w', false));
- if (isset($options['decorated'])) {
- $this->output->setDecorated($options['decorated']);
- }
- if (isset($options['verbosity'])) {
- $this->output->setVerbosity($options['verbosity']);
- }
- } else {
- $this->output = new ConsoleOutput(
- $options['verbosity'] ?? ConsoleOutput::VERBOSITY_NORMAL,
- $options['decorated'] ?? null
- );
- $errorOutput = new StreamOutput(fopen('php://memory', 'w', false));
- $errorOutput->setFormatter($this->output->getFormatter());
- $errorOutput->setVerbosity($this->output->getVerbosity());
- $errorOutput->setDecorated($this->output->isDecorated());
- $reflectedOutput = new \ReflectionObject($this->output);
- $strErrProperty = $reflectedOutput->getProperty('stderr');
- $strErrProperty->setAccessible(true);
- $strErrProperty->setValue($this->output, $errorOutput);
- $reflectedParent = $reflectedOutput->getParentClass();
- $streamProperty = $reflectedParent->getProperty('stream');
- $streamProperty->setAccessible(true);
- $streamProperty->setValue($this->output, fopen('php://memory', 'w', false));
- }
- }
- private static function createStream(array $inputs)
- {
- $stream = fopen('php://memory', 'r+', false);
- foreach ($inputs as $input) {
- fwrite($stream, $input.\PHP_EOL);
- }
- rewind($stream);
- return $stream;
- }
- }
- Copyright (c) 2020-2022 Fabien Potencier
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is furnished
- to do so, subject to the following conditions:
- The above copyright notice and this permission notice shall be included in all
- copies or substantial portions of the Software.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
- <?php
- if (!function_exists('trigger_deprecation')) {
- function trigger_deprecation(string $package, string $version, string $message, ...$args): void
- {
- @trigger_error(($package || $version ? "Since $package $version: " : '').($args ? vsprintf($message, $args) : $message), \E_USER_DEPRECATED);
- }
- }
- <?php
- namespace Symfony\Component\Filesystem\Exception;
- interface ExceptionInterface extends \Throwable
- {
- }
- <?php
- namespace Symfony\Component\Filesystem\Exception;
- class FileNotFoundException extends IOException
- {
- public function __construct(string $message = null, int $code = 0, \Throwable $previous = null, string $path = null)
- {
- if (null === $message) {
- if (null === $path) {
- $message = 'File could not be found.';
- } else {
- $message = sprintf('File "%s" could not be found.', $path);
- }
- }
- parent::__construct($message, $code, $previous, $path);
- }
- }
- <?php
- namespace Symfony\Component\Filesystem\Exception;
- class IOException extends \RuntimeException implements IOExceptionInterface
- {
- private $path;
- public function __construct(string $message, int $code = 0, \Throwable $previous = null, string $path = null)
- {
- $this->path = $path;
- parent::__construct($message, $code, $previous);
- }
- public function getPath()
- {
- return $this->path;
- }
- }
- <?php
- namespace Symfony\Component\Filesystem\Exception;
- interface IOExceptionInterface extends ExceptionInterface
- {
- public function getPath();
- }
- <?php
- namespace Symfony\Component\Filesystem\Exception;
- class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
- {
- }
- <?php
- namespace Symfony\Component\Filesystem\Exception;
- class RuntimeException extends \RuntimeException implements ExceptionInterface
- {
- }
- <?php
- namespace Symfony\Component\Filesystem;
- use Symfony\Component\Filesystem\Exception\FileNotFoundException;
- use Symfony\Component\Filesystem\Exception\InvalidArgumentException;
- use Symfony\Component\Filesystem\Exception\IOException;
- class Filesystem
- {
- private static $lastError;
- public function copy(string $originFile, string $targetFile, bool $overwriteNewerFiles = false)
- {
- $originIsLocal = stream_is_local($originFile) || 0 === stripos($originFile, 'file://');
- if ($originIsLocal && !is_file($originFile)) {
- throw new FileNotFoundException(sprintf('Failed to copy "%s" because file does not exist.', $originFile), 0, null, $originFile);
- }
- $this->mkdir(\dirname($targetFile));
- $doCopy = true;
- if (!$overwriteNewerFiles && null === parse_url($originFile, \PHP_URL_HOST) && is_file($targetFile)) {
- $doCopy = filemtime($originFile) > filemtime($targetFile);
- }
- if ($doCopy) {
- if (!$source = self::box('fopen', $originFile, 'r')) {
- 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);
- }
- if (!$target = self::box('fopen', $targetFile, 'w', false, stream_context_create(['ftp' => ['overwrite' => true]]))) {
- 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);
- }
- $bytesCopied = stream_copy_to_stream($source, $target);
- fclose($source);
- fclose($target);
- unset($source, $target);
- if (!is_file($targetFile)) {
- throw new IOException(sprintf('Failed to copy "%s" to "%s".', $originFile, $targetFile), 0, null, $originFile);
- }
- if ($originIsLocal) {
- self::box('chmod', $targetFile, fileperms($targetFile) | (fileperms($originFile) & 0111));
- if ($bytesCopied !== $bytesOrigin = filesize($originFile)) {
- 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);
- }
- }
- }
- }
- public function mkdir($dirs, int $mode = 0777)
- {
- foreach ($this->toIterable($dirs) as $dir) {
- if (is_dir($dir)) {
- continue;
- }
- if (!self::box('mkdir', $dir, $mode, true) && !is_dir($dir)) {
- throw new IOException(sprintf('Failed to create "%s": ', $dir).self::$lastError, 0, null, $dir);
- }
- }
- }
- public function exists($files)
- {
- $maxPathLength = \PHP_MAXPATHLEN - 2;
- foreach ($this->toIterable($files) as $file) {
- if (\strlen($file) > $maxPathLength) {
- throw new IOException(sprintf('Could not check if file exist because path length exceeds %d characters.', $maxPathLength), 0, null, $file);
- }
- if (!file_exists($file)) {
- return false;
- }
- }
- return true;
- }
- public function touch($files, int $time = null, int $atime = null)
- {
- foreach ($this->toIterable($files) as $file) {
- if (!($time ? self::box('touch', $file, $time, $atime) : self::box('touch', $file))) {
- throw new IOException(sprintf('Failed to touch "%s": ', $file).self::$lastError, 0, null, $file);
- }
- }
- }
- public function remove($files)
- {
- if ($files instanceof \Traversable) {
- $files = iterator_to_array($files, false);
- } elseif (!\is_array($files)) {
- $files = [$files];
- }
- self::doRemove($files, false);
- }
- private static function doRemove(array $files, bool $isRecursive): void
- {
- $files = array_reverse($files);
- foreach ($files as $file) {
- if (is_link($file)) {
- if (!(self::box('unlink', $file) || '\\' !== \DIRECTORY_SEPARATOR || self::box('rmdir', $file)) && file_exists($file)) {
- throw new IOException(sprintf('Failed to remove symlink "%s": ', $file).self::$lastError);
- }
- } elseif (is_dir($file)) {
- if (!$isRecursive) {
- $tmpName = \dirname(realpath($file)).'/.'.strrev(strtr(base64_encode(random_bytes(2)), '/=', '-.'));
- if (file_exists($tmpName)) {
- try {
- self::doRemove([$tmpName], true);
- } catch (IOException $e) {
- }
- }
- if (!file_exists($tmpName) && self::box('rename', $file, $tmpName)) {
- $origFile = $file;
- $file = $tmpName;
- } else {
- $origFile = null;
- }
- }
- $files = new \FilesystemIterator($file, \FilesystemIterator::CURRENT_AS_PATHNAME | \FilesystemIterator::SKIP_DOTS);
- self::doRemove(iterator_to_array($files, true), true);
- if (!self::box('rmdir', $file) && file_exists($file) && !$isRecursive) {
- $lastError = self::$lastError;
- if (null !== $origFile && self::box('rename', $file, $origFile)) {
- $file = $origFile;
- }
- throw new IOException(sprintf('Failed to remove directory "%s": ', $file).$lastError);
- }
- } elseif (!self::box('unlink', $file) && (str_contains(self::$lastError, 'Permission denied') || file_exists($file))) {
- throw new IOException(sprintf('Failed to remove file "%s": ', $file).self::$lastError);
- }
- }
- }
- public function chmod($files, int $mode, int $umask = 0000, bool $recursive = false)
- {
- foreach ($this->toIterable($files) as $file) {
- if ((\PHP_VERSION_ID < 80000 || \is_int($mode)) && !self::box('chmod', $file, $mode & ~$umask)) {
- throw new IOException(sprintf('Failed to chmod file "%s": ', $file).self::$lastError, 0, null, $file);
- }
- if ($recursive && is_dir($file) && !is_link($file)) {
- $this->chmod(new \FilesystemIterator($file), $mode, $umask, true);
- }
- }
- }
- public function chown($files, $user, bool $recursive = false)
- {
- foreach ($this->toIterable($files) as $file) {
- if ($recursive && is_dir($file) && !is_link($file)) {
- $this->chown(new \FilesystemIterator($file), $user, true);
- }
- if (is_link($file) && \function_exists('lchown')) {
- if (!self::box('lchown', $file, $user)) {
- throw new IOException(sprintf('Failed to chown file "%s": ', $file).self::$lastError, 0, null, $file);
- }
- } else {
- if (!self::box('chown', $file, $user)) {
- throw new IOException(sprintf('Failed to chown file "%s": ', $file).self::$lastError, 0, null, $file);
- }
- }
- }
- }
- public function chgrp($files, $group, bool $recursive = false)
- {
- foreach ($this->toIterable($files) as $file) {
- if ($recursive && is_dir($file) && !is_link($file)) {
- $this->chgrp(new \FilesystemIterator($file), $group, true);
- }
- if (is_link($file) && \function_exists('lchgrp')) {
- if (!self::box('lchgrp', $file, $group)) {
- throw new IOException(sprintf('Failed to chgrp file "%s": ', $file).self::$lastError, 0, null, $file);
- }
- } else {
- if (!self::box('chgrp', $file, $group)) {
- throw new IOException(sprintf('Failed to chgrp file "%s": ', $file).self::$lastError, 0, null, $file);
- }
- }
- }
- }
- public function rename(string $origin, string $target, bool $overwrite = false)
- {
- if (!$overwrite && $this->isReadable($target)) {
- throw new IOException(sprintf('Cannot rename because the target "%s" already exists.', $target), 0, null, $target);
- }
- if (!self::box('rename', $origin, $target)) {
- if (is_dir($origin)) {
- $this->mirror($origin, $target, null, ['override' => $overwrite, 'delete' => $overwrite]);
- $this->remove($origin);
- return;
- }
- throw new IOException(sprintf('Cannot rename "%s" to "%s": ', $origin, $target).self::$lastError, 0, null, $target);
- }
- }
- private function isReadable(string $filename): bool
- {
- $maxPathLength = \PHP_MAXPATHLEN - 2;
- if (\strlen($filename) > $maxPathLength) {
- throw new IOException(sprintf('Could not check if file is readable because path length exceeds %d characters.', $maxPathLength), 0, null, $filename);
- }
- return is_readable($filename);
- }
- public function symlink(string $originDir, string $targetDir, bool $copyOnWindows = false)
- {
- self::assertFunctionExists('symlink');
- if ('\\' === \DIRECTORY_SEPARATOR) {
- $originDir = strtr($originDir, '/', '\\');
- $targetDir = strtr($targetDir, '/', '\\');
- if ($copyOnWindows) {
- $this->mirror($originDir, $targetDir);
- return;
- }
- }
- $this->mkdir(\dirname($targetDir));
- if (is_link($targetDir)) {
- if (readlink($targetDir) === $originDir) {
- return;
- }
- $this->remove($targetDir);
- }
- if (!self::box('symlink', $originDir, $targetDir)) {
- $this->linkException($originDir, $targetDir, 'symbolic');
- }
- }
- public function hardlink(string $originFile, $targetFiles)
- {
- self::assertFunctionExists('link');
- if (!$this->exists($originFile)) {
- throw new FileNotFoundException(null, 0, null, $originFile);
- }
- if (!is_file($originFile)) {
- throw new FileNotFoundException(sprintf('Origin file "%s" is not a file.', $originFile));
- }
- foreach ($this->toIterable($targetFiles) as $targetFile) {
- if (is_file($targetFile)) {
- if (fileinode($originFile) === fileinode($targetFile)) {
- continue;
- }
- $this->remove($targetFile);
- }
- if (!self::box('link', $originFile, $targetFile)) {
- $this->linkException($originFile, $targetFile, 'hard');
- }
- }
- }
- private function linkException(string $origin, string $target, string $linkType)
- {
- if (self::$lastError) {
- if ('\\' === \DIRECTORY_SEPARATOR && str_contains(self::$lastError, 'error code(1314)')) {
- 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);
- }
- }
- throw new IOException(sprintf('Failed to create "%s" link from "%s" to "%s": ', $linkType, $origin, $target).self::$lastError, 0, null, $target);
- }
- public function readlink(string $path, bool $canonicalize = false)
- {
- if (!$canonicalize && !is_link($path)) {
- return null;
- }
- if ($canonicalize) {
- if (!$this->exists($path)) {
- return null;
- }
- if ('\\' === \DIRECTORY_SEPARATOR && \PHP_VERSION_ID < 70410) {
- $path = readlink($path);
- }
- return realpath($path);
- }
- if ('\\' === \DIRECTORY_SEPARATOR && \PHP_VERSION_ID < 70400) {
- return realpath($path);
- }
- return readlink($path);
- }
- public function makePathRelative(string $endPath, string $startPath)
- {
- if (!$this->isAbsolutePath($startPath)) {
- throw new InvalidArgumentException(sprintf('The start path "%s" is not absolute.', $startPath));
- }
- if (!$this->isAbsolutePath($endPath)) {
- throw new InvalidArgumentException(sprintf('The end path "%s" is not absolute.', $endPath));
- }
- if ('\\' === \DIRECTORY_SEPARATOR) {
- $endPath = str_replace('\\', '/', $endPath);
- $startPath = str_replace('\\', '/', $startPath);
- }
- $splitDriveLetter = function ($path) {
- return (\strlen($path) > 2 && ':' === $path[1] && '/' === $path[2] && ctype_alpha($path[0]))
- ? [substr($path, 2), strtoupper($path[0])]
- : [$path, null];
- };
- $splitPath = function ($path) {
- $result = [];
- foreach (explode('/', trim($path, '/')) as $segment) {
- if ('..' === $segment) {
- array_pop($result);
- } elseif ('.' !== $segment && '' !== $segment) {
- $result[] = $segment;
- }
- }
- return $result;
- };
- [$endPath, $endDriveLetter] = $splitDriveLetter($endPath);
- [$startPath, $startDriveLetter] = $splitDriveLetter($startPath);
- $startPathArr = $splitPath($startPath);
- $endPathArr = $splitPath($endPath);
- if ($endDriveLetter && $startDriveLetter && $endDriveLetter != $startDriveLetter) {
- return $endDriveLetter.':/'.($endPathArr ? implode('/', $endPathArr).'/' : '');
- }
- $index = 0;
- while (isset($startPathArr[$index]) && isset($endPathArr[$index]) && $startPathArr[$index] === $endPathArr[$index]) {
- ++$index;
- }
- if (1 === \count($startPathArr) && '' === $startPathArr[0]) {
- $depth = 0;
- } else {
- $depth = \count($startPathArr) - $index;
- }
- $traverser = str_repeat('../', $depth);
- $endPathRemainder = implode('/', \array_slice($endPathArr, $index));
- $relativePath = $traverser.('' !== $endPathRemainder ? $endPathRemainder.'/' : '');
- return '' === $relativePath ? './' : $relativePath;
- }
- public function mirror(string $originDir, string $targetDir, \Traversable $iterator = null, array $options = [])
- {
- $targetDir = rtrim($targetDir, '/\\');
- $originDir = rtrim($originDir, '/\\');
- $originDirLen = \strlen($originDir);
- if (!$this->exists($originDir)) {
- throw new IOException(sprintf('The origin directory specified "%s" was not found.', $originDir), 0, null, $originDir);
- }
- if ($this->exists($targetDir) && isset($options['delete']) && $options['delete']) {
- $deleteIterator = $iterator;
- if (null === $deleteIterator) {
- $flags = \FilesystemIterator::SKIP_DOTS;
- $deleteIterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($targetDir, $flags), \RecursiveIteratorIterator::CHILD_FIRST);
- }
- $targetDirLen = \strlen($targetDir);
- foreach ($deleteIterator as $file) {
- $origin = $originDir.substr($file->getPathname(), $targetDirLen);
- if (!$this->exists($origin)) {
- $this->remove($file);
- }
- }
- }
- $copyOnWindows = $options['copy_on_windows'] ?? false;
- if (null === $iterator) {
- $flags = $copyOnWindows ? \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::FOLLOW_SYMLINKS : \FilesystemIterator::SKIP_DOTS;
- $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($originDir, $flags), \RecursiveIteratorIterator::SELF_FIRST);
- }
- $this->mkdir($targetDir);
- $filesCreatedWhileMirroring = [];
- foreach ($iterator as $file) {
- if ($file->getPathname() === $targetDir || $file->getRealPath() === $targetDir || isset($filesCreatedWhileMirroring[$file->getRealPath()])) {
- continue;
- }
- $target = $targetDir.substr($file->getPathname(), $originDirLen);
- $filesCreatedWhileMirroring[$target] = true;
- if (!$copyOnWindows && is_link($file)) {
- $this->symlink($file->getLinkTarget(), $target);
- } elseif (is_dir($file)) {
- $this->mkdir($target);
- } elseif (is_file($file)) {
- $this->copy($file, $target, $options['override'] ?? false);
- } else {
- throw new IOException(sprintf('Unable to guess "%s" file type.', $file), 0, null, $file);
- }
- }
- }
- public function isAbsolutePath(string $file)
- {
- return '' !== $file && (strspn($file, '/\\', 0, 1)
- || (\strlen($file) > 3 && ctype_alpha($file[0])
- && ':' === $file[1]
- && strspn($file, '/\\', 2, 1)
- )
- || null !== parse_url($file, \PHP_URL_SCHEME)
- );
- }
- public function tempnam(string $dir, string $prefix)
- {
- $suffix = \func_num_args() > 2 ? func_get_arg(2) : '';
- [$scheme, $hierarchy] = $this->getSchemeAndHierarchy($dir);
- if ((null === $scheme || 'file' === $scheme || 'gs' === $scheme) && '' === $suffix) {
- if ($tmpFile = self::box('tempnam', $hierarchy, $prefix)) {
- if (null !== $scheme && 'gs' !== $scheme) {
- return $scheme.'://'.$tmpFile;
- }
- return $tmpFile;
- }
- throw new IOException('A temporary file could not be created: '.self::$lastError);
- }
- for ($i = 0; $i < 10; ++$i) {
- $tmpFile = $dir.'/'.$prefix.uniqid(mt_rand(), true).$suffix;
- if (!$handle = self::box('fopen', $tmpFile, 'x+')) {
- continue;
- }
- self::box('fclose', $handle);
- return $tmpFile;
- }
- throw new IOException('A temporary file could not be created: '.self::$lastError);
- }
- public function dumpFile(string $filename, $content)
- {
- if (\is_array($content)) {
- throw new \TypeError(sprintf('Argument 2 passed to "%s()" must be string or resource, array given.', __METHOD__));
- }
- $dir = \dirname($filename);
- if (!is_dir($dir)) {
- $this->mkdir($dir);
- }
- $tmpFile = $this->tempnam($dir, basename($filename));
- try {
- if (false === self::box('file_put_contents', $tmpFile, $content)) {
- throw new IOException(sprintf('Failed to write file "%s": ', $filename).self::$lastError, 0, null, $filename);
- }
- self::box('chmod', $tmpFile, file_exists($filename) ? fileperms($filename) : 0666 & ~umask());
- $this->rename($tmpFile, $filename, true);
- } finally {
- if (file_exists($tmpFile)) {
- self::box('unlink', $tmpFile);
- }
- }
- }
- public function appendToFile(string $filename, $content)
- {
- if (\is_array($content)) {
- throw new \TypeError(sprintf('Argument 2 passed to "%s()" must be string or resource, array given.', __METHOD__));
- }
- $dir = \dirname($filename);
- if (!is_dir($dir)) {
- $this->mkdir($dir);
- }
- $lock = \func_num_args() > 2 && func_get_arg(2);
- if (false === self::box('file_put_contents', $filename, $content, \FILE_APPEND | ($lock ? \LOCK_EX : 0))) {
- throw new IOException(sprintf('Failed to write file "%s": ', $filename).self::$lastError, 0, null, $filename);
- }
- }
- private function toIterable($files): iterable
- {
- return is_iterable($files) ? $files : [$files];
- }
- private function getSchemeAndHierarchy(string $filename): array
- {
- $components = explode('://', $filename, 2);
- return 2 === \count($components) ? [$components[0], $components[1]] : [null, $components[0]];
- }
- private static function assertFunctionExists(string $func): void
- {
- if (!\function_exists($func)) {
- throw new IOException(sprintf('Unable to perform filesystem operation because the "%s()" function has been disabled.', $func));
- }
- }
- private static function box(string $func, ...$args)
- {
- self::assertFunctionExists($func);
- self::$lastError = null;
- set_error_handler(__CLASS__.'::handleError');
- try {
- return $func(...$args);
- } finally {
- restore_error_handler();
- }
- }
- public static function handleError(int $type, string $msg)
- {
- self::$lastError = $msg;
- }
- }
- Copyright (c) 2004-2022 Fabien Potencier
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is furnished
- to do so, subject to the following conditions:
- The above copyright notice and this permission notice shall be included in all
- copies or substantial portions of the Software.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
- <?php
- namespace Symfony\Component\Filesystem;
- use Symfony\Component\Filesystem\Exception\InvalidArgumentException;
- use Symfony\Component\Filesystem\Exception\RuntimeException;
- final class Path
- {
- private const CLEANUP_THRESHOLD = 1250;
- private const CLEANUP_SIZE = 1000;
- private static $buffer = [];
- private static $bufferSize = 0;
- public static function canonicalize(string $path): string
- {
- if ('' === $path) {
- return '';
- }
- if (isset(self::$buffer[$path])) {
- return self::$buffer[$path];
- }
- if ('~' === $path[0]) {
- $path = self::getHomeDirectory().mb_substr($path, 1);
- }
- $path = self::normalize($path);
- [$root, $pathWithoutRoot] = self::split($path);
- $canonicalParts = self::findCanonicalParts($root, $pathWithoutRoot);
- self::$buffer[$path] = $canonicalPath = $root.implode('/', $canonicalParts);
- ++self::$bufferSize;
- if (self::$bufferSize > self::CLEANUP_THRESHOLD) {
- self::$buffer = \array_slice(self::$buffer, -self::CLEANUP_SIZE, null, true);
- self::$bufferSize = self::CLEANUP_SIZE;
- }
- return $canonicalPath;
- }
- public static function normalize(string $path): string
- {
- return str_replace('\\', '/', $path);
- }
- public static function getDirectory(string $path): string
- {
- if ('' === $path) {
- return '';
- }
- $path = self::canonicalize($path);
- if (false !== ($schemeSeparatorPosition = mb_strpos($path, '://'))) {
- $scheme = mb_substr($path, 0, $schemeSeparatorPosition + 3);
- $path = mb_substr($path, $schemeSeparatorPosition + 3);
- } else {
- $scheme = '';
- }
- if (false === ($dirSeparatorPosition = strrpos($path, '/'))) {
- return '';
- }
- if (0 === $dirSeparatorPosition) {
- return $scheme.'/';
- }
- if (2 === $dirSeparatorPosition && ctype_alpha($path[0]) && ':' === $path[1]) {
- return $scheme.mb_substr($path, 0, 3);
- }
- return $scheme.mb_substr($path, 0, $dirSeparatorPosition);
- }
- public static function getHomeDirectory(): string
- {
- if (getenv('HOME')) {
- return self::canonicalize(getenv('HOME'));
- }
- if (getenv('HOMEDRIVE') && getenv('HOMEPATH')) {
- return self::canonicalize(getenv('HOMEDRIVE').getenv('HOMEPATH'));
- }
- throw new RuntimeException("Cannot find the home directory path: Your environment or operating system isn't supported.");
- }
- public static function getRoot(string $path): string
- {
- if ('' === $path) {
- return '';
- }
- if (false !== ($schemeSeparatorPosition = strpos($path, '://'))) {
- $scheme = substr($path, 0, $schemeSeparatorPosition + 3);
- $path = substr($path, $schemeSeparatorPosition + 3);
- } else {
- $scheme = '';
- }
- $firstCharacter = $path[0];
- if ('/' === $firstCharacter || '\\' === $firstCharacter) {
- return $scheme.'/';
- }
- $length = mb_strlen($path);
- if ($length > 1 && ':' === $path[1] && ctype_alpha($firstCharacter)) {
- if (2 === $length) {
- return $scheme.$path.'/';
- }
- if ('/' === $path[2] || '\\' === $path[2]) {
- return $scheme.$firstCharacter.$path[1].'/';
- }
- }
- return '';
- }
- public static function getFilenameWithoutExtension(string $path, string $extension = null): string
- {
- if ('' === $path) {
- return '';
- }
- if (null !== $extension) {
- return rtrim(basename($path, $extension), '.');
- }
- return pathinfo($path, \PATHINFO_FILENAME);
- }
- public static function getExtension(string $path, bool $forceLowerCase = false): string
- {
- if ('' === $path) {
- return '';
- }
- $extension = pathinfo($path, \PATHINFO_EXTENSION);
- if ($forceLowerCase) {
- $extension = self::toLower($extension);
- }
- return $extension;
- }
- public static function hasExtension(string $path, $extensions = null, bool $ignoreCase = false): bool
- {
- if ('' === $path) {
- return false;
- }
- $actualExtension = self::getExtension($path, $ignoreCase);
- if ([] === $extensions || null === $extensions) {
- return '' !== $actualExtension;
- }
- if (\is_string($extensions)) {
- $extensions = [$extensions];
- }
- foreach ($extensions as $key => $extension) {
- if ($ignoreCase) {
- $extension = self::toLower($extension);
- }
- $extensions[$key] = ltrim($extension, '.');
- }
- return \in_array($actualExtension, $extensions, true);
- }
- public static function changeExtension(string $path, string $extension): string
- {
- if ('' === $path) {
- return '';
- }
- $actualExtension = self::getExtension($path);
- $extension = ltrim($extension, '.');
- if ('/' === mb_substr($path, -1)) {
- return $path;
- }
- if (empty($actualExtension)) {
- return $path.('.' === mb_substr($path, -1) ? '' : '.').$extension;
- }
- return mb_substr($path, 0, -mb_strlen($actualExtension)).$extension;
- }
- public static function isAbsolute(string $path): bool
- {
- if ('' === $path) {
- return false;
- }
- if (false !== ($schemeSeparatorPosition = mb_strpos($path, '://'))) {
- $path = mb_substr($path, $schemeSeparatorPosition + 3);
- }
- $firstCharacter = $path[0];
- if ('/' === $firstCharacter || '\\' === $firstCharacter) {
- return true;
- }
- if (mb_strlen($path) > 1 && ctype_alpha($firstCharacter) && ':' === $path[1]) {
- if (2 === mb_strlen($path)) {
- return true;
- }
- if ('/' === $path[2] || '\\' === $path[2]) {
- return true;
- }
- }
- return false;
- }
- public static function isRelative(string $path): bool
- {
- return !self::isAbsolute($path);
- }
- public static function makeAbsolute(string $path, string $basePath): string
- {
- if ('' === $basePath) {
- throw new InvalidArgumentException(sprintf('The base path must be a non-empty string. Got: "%s".', $basePath));
- }
- if (!self::isAbsolute($basePath)) {
- throw new InvalidArgumentException(sprintf('The base path "%s" is not an absolute path.', $basePath));
- }
- if (self::isAbsolute($path)) {
- return self::canonicalize($path);
- }
- if (false !== ($schemeSeparatorPosition = mb_strpos($basePath, '://'))) {
- $scheme = mb_substr($basePath, 0, $schemeSeparatorPosition + 3);
- $basePath = mb_substr($basePath, $schemeSeparatorPosition + 3);
- } else {
- $scheme = '';
- }
- return $scheme.self::canonicalize(rtrim($basePath, '/\\').'/'.$path);
- }
- public static function makeRelative(string $path, string $basePath): string
- {
- $path = self::canonicalize($path);
- $basePath = self::canonicalize($basePath);
- [$root, $relativePath] = self::split($path);
- [$baseRoot, $relativeBasePath] = self::split($basePath);
- if ('' === $root && '' !== $baseRoot) {
- if ('' === $relativeBasePath) {
- $relativePath = ltrim($relativePath, './\\');
- }
- return $relativePath;
- }
- if ('' !== $root && '' === $baseRoot) {
- 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));
- }
- if ($baseRoot && $root !== $baseRoot) {
- 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));
- }
- if ('' === $relativeBasePath) {
- return $relativePath;
- }
- $parts = explode('/', $relativePath);
- $baseParts = explode('/', $relativeBasePath);
- $dotDotPrefix = '';
- $match = true;
- foreach ($baseParts as $index => $basePart) {
- if ($match && isset($parts[$index]) && $basePart === $parts[$index]) {
- unset($parts[$index]);
- continue;
- }
- $match = false;
- $dotDotPrefix .= '../';
- }
- return rtrim($dotDotPrefix.implode('/', $parts), '/');
- }
- public static function isLocal(string $path): bool
- {
- return '' !== $path && false === mb_strpos($path, '://');
- }
- public static function getLongestCommonBasePath(string ...$paths): ?string
- {
- [$bpRoot, $basePath] = self::split(self::canonicalize(reset($paths)));
- for (next($paths); null !== key($paths) && '' !== $basePath; next($paths)) {
- [$root, $path] = self::split(self::canonicalize(current($paths)));
- if ($root !== $bpRoot) {
- return null;
- }
- while (true) {
- if ('.' === $basePath) {
- $basePath = '';
- continue 2;
- }
- if (0 === mb_strpos($path.'/', $basePath.'/')) {
- continue 2;
- }
- $basePath = \dirname($basePath);
- }
- }
- return $bpRoot.$basePath;
- }
- public static function join(string ...$paths): string
- {
- $finalPath = null;
- $wasScheme = false;
- foreach ($paths as $path) {
- if ('' === $path) {
- continue;
- }
- if (null === $finalPath) {
- $finalPath = $path;
- $wasScheme = (false !== mb_strpos($path, '://'));
- continue;
- }
- if (!\in_array(mb_substr($finalPath, -1), ['/', '\\'])) {
- $finalPath .= '/';
- }
- $finalPath .= $wasScheme ? $path : ltrim($path, '/');
- $wasScheme = false;
- }
- if (null === $finalPath) {
- return '';
- }
- return self::canonicalize($finalPath);
- }
- public static function isBasePath(string $basePath, string $ofPath): bool
- {
- $basePath = self::canonicalize($basePath);
- $ofPath = self::canonicalize($ofPath);
- return 0 === mb_strpos($ofPath.'/', rtrim($basePath, '/').'/');
- }
- private static function findCanonicalParts(string $root, string $pathWithoutRoot): array
- {
- $parts = explode('/', $pathWithoutRoot);
- $canonicalParts = [];
- foreach ($parts as $part) {
- if ('.' === $part || '' === $part) {
- continue;
- }
- if ('..' === $part && \count($canonicalParts) > 0 && '..' !== $canonicalParts[\count($canonicalParts) - 1]) {
- array_pop($canonicalParts);
- continue;
- }
- if ('..' !== $part || '' === $root) {
- $canonicalParts[] = $part;
- }
- }
- return $canonicalParts;
- }
- private static function split(string $path): array
- {
- if ('' === $path) {
- return ['', ''];
- }
- if (false !== ($schemeSeparatorPosition = mb_strpos($path, '://'))) {
- $root = mb_substr($path, 0, $schemeSeparatorPosition + 3);
- $path = mb_substr($path, $schemeSeparatorPosition + 3);
- } else {
- $root = '';
- }
- $length = mb_strlen($path);
- if (0 === mb_strpos($path, '/')) {
- $root .= '/';
- $path = $length > 1 ? mb_substr($path, 1) : '';
- } elseif ($length > 1 && ctype_alpha($path[0]) && ':' === $path[1]) {
- if (2 === $length) {
- $root .= $path.'/';
- $path = '';
- } elseif ('/' === $path[2]) {
- $root .= mb_substr($path, 0, 3);
- $path = $length > 3 ? mb_substr($path, 3) : '';
- }
- }
- return [$root, $path];
- }
- private static function toLower(string $string): string
- {
- if (false !== $encoding = mb_detect_encoding($string)) {
- return mb_strtolower($string, $encoding);
- }
- return strtolower($string, $encoding);
- }
- private function __construct()
- {
- }
- }
- <?php
- namespace Symfony\Component\Finder\Comparator;
- class Comparator
- {
- private $target;
- private $operator = '==';
- public function __construct(string $target = null, string $operator = '==')
- {
- if (null === $target) {
- trigger_deprecation('symfony/finder', '5.4', 'Constructing a "%s" without setting "$target" is deprecated.', __CLASS__);
- }
- $this->target = $target;
- $this->doSetOperator($operator);
- }
- public function getTarget()
- {
- if (null === $this->target) {
- trigger_deprecation('symfony/finder', '5.4', 'Calling "%s" without initializing the target is deprecated.', __METHOD__);
- }
- return $this->target;
- }
- public function setTarget(string $target)
- {
- trigger_deprecation('symfony/finder', '5.4', '"%s" is deprecated. Set the target via the constructor instead.', __METHOD__);
- $this->target = $target;
- }
- public function getOperator()
- {
- return $this->operator;
- }
- public function setOperator(string $operator)
- {
- trigger_deprecation('symfony/finder', '5.4', '"%s" is deprecated. Set the operator via the constructor instead.', __METHOD__);
- $this->doSetOperator('' === $operator ? '==' : $operator);
- }
- public function test($test)
- {
- if (null === $this->target) {
- trigger_deprecation('symfony/finder', '5.4', 'Calling "%s" without initializing the target is deprecated.', __METHOD__);
- }
- switch ($this->operator) {
- case '>':
- return $test > $this->target;
- case '>=':
- return $test >= $this->target;
- case '<':
- return $test < $this->target;
- case '<=':
- return $test <= $this->target;
- case '!=':
- return $test != $this->target;
- }
- return $test == $this->target;
- }
- private function doSetOperator(string $operator): void
- {
- if (!\in_array($operator, ['>', '<', '>=', '<=', '==', '!='])) {
- throw new \InvalidArgumentException(sprintf('Invalid operator "%s".', $operator));
- }
- $this->operator = $operator;
- }
- }
- <?php
- namespace Symfony\Component\Finder\Comparator;
- class DateComparator extends Comparator
- {
- public function __construct(string $test)
- {
- if (!preg_match('#^\s*(==|!=|[<>]=?|after|since|before|until)?\s*(.+?)\s*$#i', $test, $matches)) {
- throw new \InvalidArgumentException(sprintf('Don\'t understand "%s" as a date test.', $test));
- }
- try {
- $date = new \DateTime($matches[2]);
- $target = $date->format('U');
- } catch (\Exception $e) {
- throw new \InvalidArgumentException(sprintf('"%s" is not a valid date.', $matches[2]));
- }
- $operator = $matches[1] ?? '==';
- if ('since' === $operator || 'after' === $operator) {
- $operator = '>';
- }
- if ('until' === $operator || 'before' === $operator) {
- $operator = '<';
- }
- parent::__construct($target, $operator);
- }
- }
- <?php
- namespace Symfony\Component\Finder\Comparator;
- class NumberComparator extends Comparator
- {
- public function __construct(?string $test)
- {
- if (null === $test || !preg_match('#^\s*(==|!=|[<>]=?)?\s*([0-9\.]+)\s*([kmg]i?)?\s*$#i', $test, $matches)) {
- throw new \InvalidArgumentException(sprintf('Don\'t understand "%s" as a number test.', $test ?? 'null'));
- }
- $target = $matches[2];
- if (!is_numeric($target)) {
- throw new \InvalidArgumentException(sprintf('Invalid number "%s".', $target));
- }
- if (isset($matches[3])) {
- switch (strtolower($matches[3])) {
- case 'k':
- $target *= 1000;
- break;
- case 'ki':
- $target *= 1024;
- break;
- case 'm':
- $target *= 1000000;
- break;
- case 'mi':
- $target *= 1024 * 1024;
- break;
- case 'g':
- $target *= 1000000000;
- break;
- case 'gi':
- $target *= 1024 * 1024 * 1024;
- break;
- }
- }
- parent::__construct($target, $matches[1] ?: '==');
- }
- }
- <?php
- namespace Symfony\Component\Finder\Exception;
- class AccessDeniedException extends \UnexpectedValueException
- {
- }
- <?php
- namespace Symfony\Component\Finder\Exception;
- class DirectoryNotFoundException extends \InvalidArgumentException
- {
- }
- <?php
- namespace Symfony\Component\Finder;
- use Symfony\Component\Finder\Comparator\DateComparator;
- use Symfony\Component\Finder\Comparator\NumberComparator;
- use Symfony\Component\Finder\Exception\DirectoryNotFoundException;
- use Symfony\Component\Finder\Iterator\CustomFilterIterator;
- use Symfony\Component\Finder\Iterator\DateRangeFilterIterator;
- use Symfony\Component\Finder\Iterator\DepthRangeFilterIterator;
- use Symfony\Component\Finder\Iterator\ExcludeDirectoryFilterIterator;
- use Symfony\Component\Finder\Iterator\FilecontentFilterIterator;
- use Symfony\Component\Finder\Iterator\FilenameFilterIterator;
- use Symfony\Component\Finder\Iterator\LazyIterator;
- use Symfony\Component\Finder\Iterator\SizeRangeFilterIterator;
- use Symfony\Component\Finder\Iterator\SortableIterator;
- class Finder implements \IteratorAggregate, \Countable
- {
- public const IGNORE_VCS_FILES = 1;
- public const IGNORE_DOT_FILES = 2;
- public const IGNORE_VCS_IGNORED_FILES = 4;
- private $mode = 0;
- private $names = [];
- private $notNames = [];
- private $exclude = [];
- private $filters = [];
- private $depths = [];
- private $sizes = [];
- private $followLinks = false;
- private $reverseSorting = false;
- private $sort = false;
- private $ignore = 0;
- private $dirs = [];
- private $dates = [];
- private $iterators = [];
- private $contains = [];
- private $notContains = [];
- private $paths = [];
- private $notPaths = [];
- private $ignoreUnreadableDirs = false;
- private static $vcsPatterns = ['.svn', '_svn', 'CVS', '_darcs', '.arch-params', '.monotone', '.bzr', '.git', '.hg'];
- public function __construct()
- {
- $this->ignore = static::IGNORE_VCS_FILES | static::IGNORE_DOT_FILES;
- }
- public static function create()
- {
- return new static();
- }
- public function directories()
- {
- $this->mode = Iterator\FileTypeFilterIterator::ONLY_DIRECTORIES;
- return $this;
- }
- public function files()
- {
- $this->mode = Iterator\FileTypeFilterIterator::ONLY_FILES;
- return $this;
- }
- public function depth($levels)
- {
- foreach ((array) $levels as $level) {
- $this->depths[] = new Comparator\NumberComparator($level);
- }
- return $this;
- }
- public function date($dates)
- {
- foreach ((array) $dates as $date) {
- $this->dates[] = new Comparator\DateComparator($date);
- }
- return $this;
- }
- public function name($patterns)
- {
- $this->names = array_merge($this->names, (array) $patterns);
- return $this;
- }
- public function notName($patterns)
- {
- $this->notNames = array_merge($this->notNames, (array) $patterns);
- return $this;
- }
- public function contains($patterns)
- {
- $this->contains = array_merge($this->contains, (array) $patterns);
- return $this;
- }
- public function notContains($patterns)
- {
- $this->notContains = array_merge($this->notContains, (array) $patterns);
- return $this;
- }
- public function path($patterns)
- {
- $this->paths = array_merge($this->paths, (array) $patterns);
- return $this;
- }
- public function notPath($patterns)
- {
- $this->notPaths = array_merge($this->notPaths, (array) $patterns);
- return $this;
- }
- public function size($sizes)
- {
- foreach ((array) $sizes as $size) {
- $this->sizes[] = new Comparator\NumberComparator($size);
- }
- return $this;
- }
- public function exclude($dirs)
- {
- $this->exclude = array_merge($this->exclude, (array) $dirs);
- return $this;
- }
- public function ignoreDotFiles(bool $ignoreDotFiles)
- {
- if ($ignoreDotFiles) {
- $this->ignore |= static::IGNORE_DOT_FILES;
- } else {
- $this->ignore &= ~static::IGNORE_DOT_FILES;
- }
- return $this;
- }
- public function ignoreVCS(bool $ignoreVCS)
- {
- if ($ignoreVCS) {
- $this->ignore |= static::IGNORE_VCS_FILES;
- } else {
- $this->ignore &= ~static::IGNORE_VCS_FILES;
- }
- return $this;
- }
- public function ignoreVCSIgnored(bool $ignoreVCSIgnored)
- {
- if ($ignoreVCSIgnored) {
- $this->ignore |= static::IGNORE_VCS_IGNORED_FILES;
- } else {
- $this->ignore &= ~static::IGNORE_VCS_IGNORED_FILES;
- }
- return $this;
- }
- public static function addVCSPattern($pattern)
- {
- foreach ((array) $pattern as $p) {
- self::$vcsPatterns[] = $p;
- }
- self::$vcsPatterns = array_unique(self::$vcsPatterns);
- }
- public function sort(\Closure $closure)
- {
- $this->sort = $closure;
- return $this;
- }
- public function sortByName(bool $useNaturalSort = false)
- {
- $this->sort = $useNaturalSort ? Iterator\SortableIterator::SORT_BY_NAME_NATURAL : Iterator\SortableIterator::SORT_BY_NAME;
- return $this;
- }
- public function sortByType()
- {
- $this->sort = Iterator\SortableIterator::SORT_BY_TYPE;
- return $this;
- }
- public function sortByAccessedTime()
- {
- $this->sort = Iterator\SortableIterator::SORT_BY_ACCESSED_TIME;
- return $this;
- }
- public function reverseSorting()
- {
- $this->reverseSorting = true;
- return $this;
- }
- public function sortByChangedTime()
- {
- $this->sort = Iterator\SortableIterator::SORT_BY_CHANGED_TIME;
- return $this;
- }
- public function sortByModifiedTime()
- {
- $this->sort = Iterator\SortableIterator::SORT_BY_MODIFIED_TIME;
- return $this;
- }
- public function filter(\Closure $closure)
- {
- $this->filters[] = $closure;
- return $this;
- }
- public function followLinks()
- {
- $this->followLinks = true;
- return $this;
- }
- public function ignoreUnreadableDirs(bool $ignore = true)
- {
- $this->ignoreUnreadableDirs = $ignore;
- return $this;
- }
- public function in($dirs)
- {
- $resolvedDirs = [];
- foreach ((array) $dirs as $dir) {
- if (is_dir($dir)) {
- $resolvedDirs[] = [$this->normalizeDir($dir)];
- } elseif ($glob = glob($dir, (\defined('GLOB_BRACE') ? \GLOB_BRACE : 0) | \GLOB_ONLYDIR | \GLOB_NOSORT)) {
- sort($glob);
- $resolvedDirs[] = array_map([$this, 'normalizeDir'], $glob);
- } else {
- throw new DirectoryNotFoundException(sprintf('The "%s" directory does not exist.', $dir));
- }
- }
- $this->dirs = array_merge($this->dirs, ...$resolvedDirs);
- return $this;
- }
- #[\ReturnTypeWillChange]
- public function getIterator()
- {
- if (0 === \count($this->dirs) && 0 === \count($this->iterators)) {
- throw new \LogicException('You must call one of in() or append() methods before iterating over a Finder.');
- }
- if (1 === \count($this->dirs) && 0 === \count($this->iterators)) {
- $iterator = $this->searchInDirectory($this->dirs[0]);
- if ($this->sort || $this->reverseSorting) {
- $iterator = (new Iterator\SortableIterator($iterator, $this->sort, $this->reverseSorting))->getIterator();
- }
- return $iterator;
- }
- $iterator = new \AppendIterator();
- foreach ($this->dirs as $dir) {
- $iterator->append(new \IteratorIterator(new LazyIterator(function () use ($dir) {
- return $this->searchInDirectory($dir);
- })));
- }
- foreach ($this->iterators as $it) {
- $iterator->append($it);
- }
- if ($this->sort || $this->reverseSorting) {
- $iterator = (new Iterator\SortableIterator($iterator, $this->sort, $this->reverseSorting))->getIterator();
- }
- return $iterator;
- }
- public function append(iterable $iterator)
- {
- if ($iterator instanceof \IteratorAggregate) {
- $this->iterators[] = $iterator->getIterator();
- } elseif ($iterator instanceof \Iterator) {
- $this->iterators[] = $iterator;
- } elseif (is_iterable($iterator)) {
- $it = new \ArrayIterator();
- foreach ($iterator as $file) {
- $file = $file instanceof \SplFileInfo ? $file : new \SplFileInfo($file);
- $it[$file->getPathname()] = $file;
- }
- $this->iterators[] = $it;
- } else {
- throw new \InvalidArgumentException('Finder::append() method wrong argument type.');
- }
- return $this;
- }
- public function hasResults()
- {
- foreach ($this->getIterator() as $_) {
- return true;
- }
- return false;
- }
- #[\ReturnTypeWillChange]
- public function count()
- {
- return iterator_count($this->getIterator());
- }
- private function searchInDirectory(string $dir): \Iterator
- {
- $exclude = $this->exclude;
- $notPaths = $this->notPaths;
- if (static::IGNORE_VCS_FILES === (static::IGNORE_VCS_FILES & $this->ignore)) {
- $exclude = array_merge($exclude, self::$vcsPatterns);
- }
- if (static::IGNORE_DOT_FILES === (static::IGNORE_DOT_FILES & $this->ignore)) {
- $notPaths[] = '#(^|/)\..+(/|$)#';
- }
- $minDepth = 0;
- $maxDepth = \PHP_INT_MAX;
- foreach ($this->depths as $comparator) {
- switch ($comparator->getOperator()) {
- case '>':
- $minDepth = $comparator->getTarget() + 1;
- break;
- case '>=':
- $minDepth = $comparator->getTarget();
- break;
- case '<':
- $maxDepth = $comparator->getTarget() - 1;
- break;
- case '<=':
- $maxDepth = $comparator->getTarget();
- break;
- default:
- $minDepth = $maxDepth = $comparator->getTarget();
- }
- }
- $flags = \RecursiveDirectoryIterator::SKIP_DOTS;
- if ($this->followLinks) {
- $flags |= \RecursiveDirectoryIterator::FOLLOW_SYMLINKS;
- }
- $iterator = new Iterator\RecursiveDirectoryIterator($dir, $flags, $this->ignoreUnreadableDirs);
- if ($exclude) {
- $iterator = new Iterator\ExcludeDirectoryFilterIterator($iterator, $exclude);
- }
- $iterator = new \RecursiveIteratorIterator($iterator, \RecursiveIteratorIterator::SELF_FIRST);
- if ($minDepth > 0 || $maxDepth < \PHP_INT_MAX) {
- $iterator = new Iterator\DepthRangeFilterIterator($iterator, $minDepth, $maxDepth);
- }
- if ($this->mode) {
- $iterator = new Iterator\FileTypeFilterIterator($iterator, $this->mode);
- }
- if ($this->names || $this->notNames) {
- $iterator = new Iterator\FilenameFilterIterator($iterator, $this->names, $this->notNames);
- }
- if ($this->contains || $this->notContains) {
- $iterator = new Iterator\FilecontentFilterIterator($iterator, $this->contains, $this->notContains);
- }
- if ($this->sizes) {
- $iterator = new Iterator\SizeRangeFilterIterator($iterator, $this->sizes);
- }
- if ($this->dates) {
- $iterator = new Iterator\DateRangeFilterIterator($iterator, $this->dates);
- }
- if ($this->filters) {
- $iterator = new Iterator\CustomFilterIterator($iterator, $this->filters);
- }
- if ($this->paths || $notPaths) {
- $iterator = new Iterator\PathFilterIterator($iterator, $this->paths, $notPaths);
- }
- if (static::IGNORE_VCS_IGNORED_FILES === (static::IGNORE_VCS_IGNORED_FILES & $this->ignore)) {
- $iterator = new Iterator\VcsIgnoredFilterIterator($iterator, $dir);
- }
- return $iterator;
- }
- private function normalizeDir(string $dir): string
- {
- if ('/' === $dir) {
- return $dir;
- }
- $dir = rtrim($dir, '/'.\DIRECTORY_SEPARATOR);
- if (preg_match('#^(ssh2\.)?s?ftp://#', $dir)) {
- $dir .= '/';
- }
- return $dir;
- }
- }
- <?php
- namespace Symfony\Component\Finder;
- class Gitignore
- {
- public static function toRegex(string $gitignoreFileContent): string
- {
- return self::buildRegex($gitignoreFileContent, false);
- }
- public static function toRegexMatchingNegatedPatterns(string $gitignoreFileContent): string
- {
- return self::buildRegex($gitignoreFileContent, true);
- }
- private static function buildRegex(string $gitignoreFileContent, bool $inverted): string
- {
- $gitignoreFileContent = preg_replace('~(?<!\\\\)#[^\n\r]*~', '', $gitignoreFileContent);
- $gitignoreLines = preg_split('~\r\n?|\n~', $gitignoreFileContent);
- $res = self::lineToRegex('');
- foreach ($gitignoreLines as $line) {
- $line = preg_replace('~(?<!\\\\)[ \t]+$~', '', $line);
- if ('!' === substr($line, 0, 1)) {
- $line = substr($line, 1);
- $isNegative = true;
- } else {
- $isNegative = false;
- }
- if ('' !== $line) {
- if ($isNegative xor $inverted) {
- $res = '(?!'.self::lineToRegex($line).'$)'.$res;
- } else {
- $res = '(?:'.$res.'|'.self::lineToRegex($line).')';
- }
- }
- }
- return '~^(?:'.$res.')~s';
- }
- private static function lineToRegex(string $gitignoreLine): string
- {
- if ('' === $gitignoreLine) {
- return '$f';
- }
- $slashPos = strpos($gitignoreLine, '/');
- if (false !== $slashPos && \strlen($gitignoreLine) - 1 !== $slashPos) {
- if (0 === $slashPos) {
- $gitignoreLine = substr($gitignoreLine, 1);
- }
- $isAbsolute = true;
- } else {
- $isAbsolute = false;
- }
- $regex = preg_quote(str_replace('\\', '', $gitignoreLine), '~');
- $regex = preg_replace_callback('~\\\\\[((?:\\\\!)?)([^\[\]]*)\\\\\]~', function (array $matches): string {
- return '['.('' !== $matches[1] ? '^' : '').str_replace('\\-', '-', $matches[2]).']';
- }, $regex);
- $regex = preg_replace('~(?:(?:\\\\\*){2,}(/?))+~', '(?:(?:(?!//).(?<!//))+$1)?', $regex);
- $regex = preg_replace('~\\\\\*~', '[^/]*', $regex);
- $regex = preg_replace('~\\\\\?~', '[^/]', $regex);
- return ($isAbsolute ? '' : '(?:[^/]+/)*')
- .$regex
- .(!str_ends_with($gitignoreLine, '/') ? '(?:$|/)' : '');
- }
- }
- <?php
- namespace Symfony\Component\Finder;
- class Glob
- {
- public static function toRegex(string $glob, bool $strictLeadingDot = true, bool $strictWildcardSlash = true, string $delimiter = '#')
- {
- $firstByte = true;
- $escaping = false;
- $inCurlies = 0;
- $regex = '';
- $sizeGlob = \strlen($glob);
- for ($i = 0; $i < $sizeGlob; ++$i) {
- $car = $glob[$i];
- if ($firstByte && $strictLeadingDot && '.' !== $car) {
- $regex .= '(?=[^\.])';
- }
- $firstByte = '/' === $car;
- if ($firstByte && $strictWildcardSlash && isset($glob[$i + 2]) && '**' === $glob[$i + 1].$glob[$i + 2] && (!isset($glob[$i + 3]) || '/' === $glob[$i + 3])) {
- $car = '[^/]++/';
- if (!isset($glob[$i + 3])) {
- $car .= '?';
- }
- if ($strictLeadingDot) {
- $car = '(?=[^\.])'.$car;
- }
- $car = '/(?:'.$car.')*';
- $i += 2 + isset($glob[$i + 3]);
- if ('/' === $delimiter) {
- $car = str_replace('/', '\\/', $car);
- }
- }
- if ($delimiter === $car || '.' === $car || '(' === $car || ')' === $car || '|' === $car || '+' === $car || '^' === $car || '$' === $car) {
- $regex .= "\\$car";
- } elseif ('*' === $car) {
- $regex .= $escaping ? '\\*' : ($strictWildcardSlash ? '[^/]*' : '.*');
- } elseif ('?' === $car) {
- $regex .= $escaping ? '\\?' : ($strictWildcardSlash ? '[^/]' : '.');
- } elseif ('{' === $car) {
- $regex .= $escaping ? '\\{' : '(';
- if (!$escaping) {
- ++$inCurlies;
- }
- } elseif ('}' === $car && $inCurlies) {
- $regex .= $escaping ? '}' : ')';
- if (!$escaping) {
- --$inCurlies;
- }
- } elseif (',' === $car && $inCurlies) {
- $regex .= $escaping ? ',' : '|';
- } elseif ('\\' === $car) {
- if ($escaping) {
- $regex .= '\\\\';
- $escaping = false;
- } else {
- $escaping = true;
- }
- continue;
- } else {
- $regex .= $car;
- }
- $escaping = false;
- }
- return $delimiter.'^'.$regex.'$'.$delimiter;
- }
- }
- <?php
- namespace Symfony\Component\Finder\Iterator;
- class CustomFilterIterator extends \FilterIterator
- {
- private $filters = [];
- public function __construct(\Iterator $iterator, array $filters)
- {
- foreach ($filters as $filter) {
- if (!\is_callable($filter)) {
- throw new \InvalidArgumentException('Invalid PHP callback.');
- }
- }
- $this->filters = $filters;
- parent::__construct($iterator);
- }
- #[\ReturnTypeWillChange]
- public function accept()
- {
- $fileinfo = $this->current();
- foreach ($this->filters as $filter) {
- if (false === $filter($fileinfo)) {
- return false;
- }
- }
- return true;
- }
- }
- <?php
- namespace Symfony\Component\Finder\Iterator;
- use Symfony\Component\Finder\Comparator\DateComparator;
- class DateRangeFilterIterator extends \FilterIterator
- {
- private $comparators = [];
- public function __construct(\Iterator $iterator, array $comparators)
- {
- $this->comparators = $comparators;
- parent::__construct($iterator);
- }
- #[\ReturnTypeWillChange]
- public function accept()
- {
- $fileinfo = $this->current();
- if (!file_exists($fileinfo->getPathname())) {
- return false;
- }
- $filedate = $fileinfo->getMTime();
- foreach ($this->comparators as $compare) {
- if (!$compare->test($filedate)) {
- return false;
- }
- }
- return true;
- }
- }
- <?php
- namespace Symfony\Component\Finder\Iterator;
- class DepthRangeFilterIterator extends \FilterIterator
- {
- private $minDepth = 0;
- public function __construct(\RecursiveIteratorIterator $iterator, int $minDepth = 0, int $maxDepth = \PHP_INT_MAX)
- {
- $this->minDepth = $minDepth;
- $iterator->setMaxDepth(\PHP_INT_MAX === $maxDepth ? -1 : $maxDepth);
- parent::__construct($iterator);
- }
- #[\ReturnTypeWillChange]
- public function accept()
- {
- return $this->getInnerIterator()->getDepth() >= $this->minDepth;
- }
- }
- <?php
- namespace Symfony\Component\Finder\Iterator;
- class ExcludeDirectoryFilterIterator extends \FilterIterator implements \RecursiveIterator
- {
- private $iterator;
- private $isRecursive;
- private $excludedDirs = [];
- private $excludedPattern;
- public function __construct(\Iterator $iterator, array $directories)
- {
- $this->iterator = $iterator;
- $this->isRecursive = $iterator instanceof \RecursiveIterator;
- $patterns = [];
- foreach ($directories as $directory) {
- $directory = rtrim($directory, '/');
- if (!$this->isRecursive || str_contains($directory, '/')) {
- $patterns[] = preg_quote($directory, '#');
- } else {
- $this->excludedDirs[$directory] = true;
- }
- }
- if ($patterns) {
- $this->excludedPattern = '#(?:^|/)(?:'.implode('|', $patterns).')(?:/|$)#';
- }
- parent::__construct($iterator);
- }
- #[\ReturnTypeWillChange]
- public function accept()
- {
- if ($this->isRecursive && isset($this->excludedDirs[$this->getFilename()]) && $this->isDir()) {
- return false;
- }
- if ($this->excludedPattern) {
- $path = $this->isDir() ? $this->current()->getRelativePathname() : $this->current()->getRelativePath();
- $path = str_replace('\\', '/', $path);
- return !preg_match($this->excludedPattern, $path);
- }
- return true;
- }
- #[\ReturnTypeWillChange]
- public function hasChildren()
- {
- return $this->isRecursive && $this->iterator->hasChildren();
- }
- #[\ReturnTypeWillChange]
- public function getChildren()
- {
- $children = new self($this->iterator->getChildren(), []);
- $children->excludedDirs = $this->excludedDirs;
- $children->excludedPattern = $this->excludedPattern;
- return $children;
- }
- }
- <?php
- namespace Symfony\Component\Finder\Iterator;
- class FileTypeFilterIterator extends \FilterIterator
- {
- public const ONLY_FILES = 1;
- public const ONLY_DIRECTORIES = 2;
- private $mode;
- public function __construct(\Iterator $iterator, int $mode)
- {
- $this->mode = $mode;
- parent::__construct($iterator);
- }
- #[\ReturnTypeWillChange]
- public function accept()
- {
- $fileinfo = $this->current();
- if (self::ONLY_DIRECTORIES === (self::ONLY_DIRECTORIES & $this->mode) && $fileinfo->isFile()) {
- return false;
- } elseif (self::ONLY_FILES === (self::ONLY_FILES & $this->mode) && $fileinfo->isDir()) {
- return false;
- }
- return true;
- }
- }
- <?php
- namespace Symfony\Component\Finder\Iterator;
- class FilecontentFilterIterator extends MultiplePcreFilterIterator
- {
- #[\ReturnTypeWillChange]
- public function accept()
- {
- if (!$this->matchRegexps && !$this->noMatchRegexps) {
- return true;
- }
- $fileinfo = $this->current();
- if ($fileinfo->isDir() || !$fileinfo->isReadable()) {
- return false;
- }
- $content = $fileinfo->getContents();
- if (!$content) {
- return false;
- }
- return $this->isAccepted($content);
- }
- protected function toRegex(string $str)
- {
- return $this->isRegex($str) ? $str : '/'.preg_quote($str, '/').'/';
- }
- }
- <?php
- namespace Symfony\Component\Finder\Iterator;
- use Symfony\Component\Finder\Glob;
- class FilenameFilterIterator extends MultiplePcreFilterIterator
- {
- #[\ReturnTypeWillChange]
- public function accept()
- {
- return $this->isAccepted($this->current()->getFilename());
- }
- protected function toRegex(string $str)
- {
- return $this->isRegex($str) ? $str : Glob::toRegex($str);
- }
- }
- <?php
- namespace Symfony\Component\Finder\Iterator;
- class LazyIterator implements \IteratorAggregate
- {
- private $iteratorFactory;
- public function __construct(callable $iteratorFactory)
- {
- $this->iteratorFactory = $iteratorFactory;
- }
- public function getIterator(): \Traversable
- {
- yield from ($this->iteratorFactory)();
- }
- }
- <?php
- namespace Symfony\Component\Finder\Iterator;
- abstract class MultiplePcreFilterIterator extends \FilterIterator
- {
- protected $matchRegexps = [];
- protected $noMatchRegexps = [];
- public function __construct(\Iterator $iterator, array $matchPatterns, array $noMatchPatterns)
- {
- foreach ($matchPatterns as $pattern) {
- $this->matchRegexps[] = $this->toRegex($pattern);
- }
- foreach ($noMatchPatterns as $pattern) {
- $this->noMatchRegexps[] = $this->toRegex($pattern);
- }
- parent::__construct($iterator);
- }
- protected function isAccepted(string $string)
- {
- foreach ($this->noMatchRegexps as $regex) {
- if (preg_match($regex, $string)) {
- return false;
- }
- }
- if ($this->matchRegexps) {
- foreach ($this->matchRegexps as $regex) {
- if (preg_match($regex, $string)) {
- return true;
- }
- }
- return false;
- }
- return true;
- }
- protected function isRegex(string $str)
- {
- $availableModifiers = 'imsxuADU';
- if (\PHP_VERSION_ID >= 80200) {
- $availableModifiers .= 'n';
- }
- if (preg_match('/^(.{3,}?)['.$availableModifiers.']*$/', $str, $m)) {
- $start = substr($m[1], 0, 1);
- $end = substr($m[1], -1);
- if ($start === $end) {
- return !preg_match('/[*?[:alnum:] \\\\]/', $start);
- }
- foreach ([['{', '}'], ['(', ')'], ['[', ']'], ['<', '>']] as $delimiters) {
- if ($start === $delimiters[0] && $end === $delimiters[1]) {
- return true;
- }
- }
- }
- return false;
- }
- abstract protected function toRegex(string $str);
- }
- <?php
- namespace Symfony\Component\Finder\Iterator;
- class PathFilterIterator extends MultiplePcreFilterIterator
- {
- #[\ReturnTypeWillChange]
- public function accept()
- {
- $filename = $this->current()->getRelativePathname();
- if ('\\' === \DIRECTORY_SEPARATOR) {
- $filename = str_replace('\\', '/', $filename);
- }
- return $this->isAccepted($filename);
- }
- protected function toRegex(string $str)
- {
- return $this->isRegex($str) ? $str : '/'.preg_quote($str, '/').'/';
- }
- }
- <?php
- namespace Symfony\Component\Finder\Iterator;
- use Symfony\Component\Finder\Exception\AccessDeniedException;
- use Symfony\Component\Finder\SplFileInfo;
- class RecursiveDirectoryIterator extends \RecursiveDirectoryIterator
- {
- private $ignoreUnreadableDirs;
- private $rewindable;
- private $rootPath;
- private $subPath;
- private $directorySeparator = '/';
- public function __construct(string $path, int $flags, bool $ignoreUnreadableDirs = false)
- {
- if ($flags & (self::CURRENT_AS_PATHNAME | self::CURRENT_AS_SELF)) {
- throw new \RuntimeException('This iterator only support returning current as fileinfo.');
- }
- parent::__construct($path, $flags);
- $this->ignoreUnreadableDirs = $ignoreUnreadableDirs;
- $this->rootPath = $path;
- if ('/' !== \DIRECTORY_SEPARATOR && !($flags & self::UNIX_PATHS)) {
- $this->directorySeparator = \DIRECTORY_SEPARATOR;
- }
- }
- #[\ReturnTypeWillChange]
- public function current()
- {
- if (null === $subPathname = $this->subPath) {
- $subPathname = $this->subPath = $this->getSubPath();
- }
- if ('' !== $subPathname) {
- $subPathname .= $this->directorySeparator;
- }
- $subPathname .= $this->getFilename();
- if ('/' !== $basePath = $this->rootPath) {
- $basePath .= $this->directorySeparator;
- }
- return new SplFileInfo($basePath.$subPathname, $this->subPath, $subPathname);
- }
- #[\ReturnTypeWillChange]
- public function hasChildren($allowLinks = false)
- {
- $hasChildren = parent::hasChildren($allowLinks);
- if (!$hasChildren || !$this->ignoreUnreadableDirs) {
- return $hasChildren;
- }
- try {
- parent::getChildren();
- return true;
- } catch (\UnexpectedValueException $e) {
- return false;
- }
- }
- #[\ReturnTypeWillChange]
- public function getChildren()
- {
- try {
- $children = parent::getChildren();
- if ($children instanceof self) {
- $children->ignoreUnreadableDirs = $this->ignoreUnreadableDirs;
- $children->rewindable = &$this->rewindable;
- $children->rootPath = $this->rootPath;
- }
- return $children;
- } catch (\UnexpectedValueException $e) {
- throw new AccessDeniedException($e->getMessage(), $e->getCode(), $e);
- }
- }
- #[\ReturnTypeWillChange]
- public function rewind()
- {
- if (false === $this->isRewindable()) {
- return;
- }
- parent::rewind();
- }
- public function isRewindable()
- {
- if (null !== $this->rewindable) {
- return $this->rewindable;
- }
- if (false !== $stream = @opendir($this->getPath())) {
- $infos = stream_get_meta_data($stream);
- closedir($stream);
- if ($infos['seekable']) {
- return $this->rewindable = true;
- }
- }
- return $this->rewindable = false;
- }
- }
- <?php
- namespace Symfony\Component\Finder\Iterator;
- use Symfony\Component\Finder\Comparator\NumberComparator;
- class SizeRangeFilterIterator extends \FilterIterator
- {
- private $comparators = [];
- public function __construct(\Iterator $iterator, array $comparators)
- {
- $this->comparators = $comparators;
- parent::__construct($iterator);
- }
- #[\ReturnTypeWillChange]
- public function accept()
- {
- $fileinfo = $this->current();
- if (!$fileinfo->isFile()) {
- return true;
- }
- $filesize = $fileinfo->getSize();
- foreach ($this->comparators as $compare) {
- if (!$compare->test($filesize)) {
- return false;
- }
- }
- return true;
- }
- }
- <?php
- namespace Symfony\Component\Finder\Iterator;
- class SortableIterator implements \IteratorAggregate
- {
- public const SORT_BY_NONE = 0;
- public const SORT_BY_NAME = 1;
- public const SORT_BY_TYPE = 2;
- public const SORT_BY_ACCESSED_TIME = 3;
- public const SORT_BY_CHANGED_TIME = 4;
- public const SORT_BY_MODIFIED_TIME = 5;
- public const SORT_BY_NAME_NATURAL = 6;
- private $iterator;
- private $sort;
- public function __construct(\Traversable $iterator, $sort, bool $reverseOrder = false)
- {
- $this->iterator = $iterator;
- $order = $reverseOrder ? -1 : 1;
- if (self::SORT_BY_NAME === $sort) {
- $this->sort = static function (\SplFileInfo $a, \SplFileInfo $b) use ($order) {
- return $order * strcmp($a->getRealPath() ?: $a->getPathname(), $b->getRealPath() ?: $b->getPathname());
- };
- } elseif (self::SORT_BY_NAME_NATURAL === $sort) {
- $this->sort = static function (\SplFileInfo $a, \SplFileInfo $b) use ($order) {
- return $order * strnatcmp($a->getRealPath() ?: $a->getPathname(), $b->getRealPath() ?: $b->getPathname());
- };
- } elseif (self::SORT_BY_TYPE === $sort) {
- $this->sort = static function (\SplFileInfo $a, \SplFileInfo $b) use ($order) {
- if ($a->isDir() && $b->isFile()) {
- return -$order;
- } elseif ($a->isFile() && $b->isDir()) {
- return $order;
- }
- return $order * strcmp($a->getRealPath() ?: $a->getPathname(), $b->getRealPath() ?: $b->getPathname());
- };
- } elseif (self::SORT_BY_ACCESSED_TIME === $sort) {
- $this->sort = static function (\SplFileInfo $a, \SplFileInfo $b) use ($order) {
- return $order * ($a->getATime() - $b->getATime());
- };
- } elseif (self::SORT_BY_CHANGED_TIME === $sort) {
- $this->sort = static function (\SplFileInfo $a, \SplFileInfo $b) use ($order) {
- return $order * ($a->getCTime() - $b->getCTime());
- };
- } elseif (self::SORT_BY_MODIFIED_TIME === $sort) {
- $this->sort = static function (\SplFileInfo $a, \SplFileInfo $b) use ($order) {
- return $order * ($a->getMTime() - $b->getMTime());
- };
- } elseif (self::SORT_BY_NONE === $sort) {
- $this->sort = $order;
- } elseif (\is_callable($sort)) {
- $this->sort = $reverseOrder ? static function (\SplFileInfo $a, \SplFileInfo $b) use ($sort) { return -$sort($a, $b); } : $sort;
- } else {
- throw new \InvalidArgumentException('The SortableIterator takes a PHP callable or a valid built-in sort algorithm as an argument.');
- }
- }
- #[\ReturnTypeWillChange]
- public function getIterator()
- {
- if (1 === $this->sort) {
- return $this->iterator;
- }
- $array = iterator_to_array($this->iterator, true);
- if (-1 === $this->sort) {
- $array = array_reverse($array);
- } else {
- uasort($array, $this->sort);
- }
- return new \ArrayIterator($array);
- }
- }
- <?php
- namespace Symfony\Component\Finder\Iterator;
- use Symfony\Component\Finder\Gitignore;
- final class VcsIgnoredFilterIterator extends \FilterIterator
- {
- private $baseDir;
- private $gitignoreFilesCache = [];
- private $ignoredPathsCache = [];
- public function __construct(\Iterator $iterator, string $baseDir)
- {
- $this->baseDir = $this->normalizePath($baseDir);
- parent::__construct($iterator);
- }
- public function accept(): bool
- {
- $file = $this->current();
- $fileRealPath = $this->normalizePath($file->getRealPath());
- return !$this->isIgnored($fileRealPath);
- }
- private function isIgnored(string $fileRealPath): bool
- {
- if (is_dir($fileRealPath) && !str_ends_with($fileRealPath, '/')) {
- $fileRealPath .= '/';
- }
- if (isset($this->ignoredPathsCache[$fileRealPath])) {
- return $this->ignoredPathsCache[$fileRealPath];
- }
- $ignored = false;
- foreach ($this->parentsDirectoryDownward($fileRealPath) as $parentDirectory) {
- if ($this->isIgnored($parentDirectory)) {
- break;
- }
- $fileRelativePath = substr($fileRealPath, \strlen($parentDirectory) + 1);
- if (null === $regexps = $this->readGitignoreFile("{$parentDirectory}/.gitignore")) {
- continue;
- }
- [$exclusionRegex, $inclusionRegex] = $regexps;
- if (preg_match($exclusionRegex, $fileRelativePath)) {
- $ignored = true;
- continue;
- }
- if (preg_match($inclusionRegex, $fileRelativePath)) {
- $ignored = false;
- }
- }
- return $this->ignoredPathsCache[$fileRealPath] = $ignored;
- }
- private function parentsDirectoryDownward(string $fileRealPath): array
- {
- $parentDirectories = [];
- $parentDirectory = $fileRealPath;
- while (true) {
- $newParentDirectory = \dirname($parentDirectory);
- if ($newParentDirectory === $parentDirectory) {
- break;
- }
- $parentDirectory = $newParentDirectory;
- if (0 !== strpos($parentDirectory, $this->baseDir)) {
- break;
- }
- $parentDirectories[] = $parentDirectory;
- }
- return array_reverse($parentDirectories);
- }
- private function readGitignoreFile(string $path): ?array
- {
- if (\array_key_exists($path, $this->gitignoreFilesCache)) {
- return $this->gitignoreFilesCache[$path];
- }
- if (!file_exists($path)) {
- return $this->gitignoreFilesCache[$path] = null;
- }
- if (!is_file($path) || !is_readable($path)) {
- throw new \RuntimeException("The \"ignoreVCSIgnored\" option cannot be used by the Finder as the \"{$path}\" file is not readable.");
- }
- $gitignoreFileContent = file_get_contents($path);
- return $this->gitignoreFilesCache[$path] = [
- Gitignore::toRegex($gitignoreFileContent),
- Gitignore::toRegexMatchingNegatedPatterns($gitignoreFileContent),
- ];
- }
- private function normalizePath(string $path): string
- {
- if ('\\' === \DIRECTORY_SEPARATOR) {
- return str_replace('\\', '/', $path);
- }
- return $path;
- }
- }
- Copyright (c) 2004-2022 Fabien Potencier
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is furnished
- to do so, subject to the following conditions:
- The above copyright notice and this permission notice shall be included in all
- copies or substantial portions of the Software.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
- <?php
- namespace Symfony\Component\Finder;
- class SplFileInfo extends \SplFileInfo
- {
- private $relativePath;
- private $relativePathname;
- public function __construct(string $file, string $relativePath, string $relativePathname)
- {
- parent::__construct($file);
- $this->relativePath = $relativePath;
- $this->relativePathname = $relativePathname;
- }
- public function getRelativePath()
- {
- return $this->relativePath;
- }
- public function getRelativePathname()
- {
- return $this->relativePathname;
- }
- public function getFilenameWithoutExtension(): string
- {
- $filename = $this->getFilename();
- return pathinfo($filename, \PATHINFO_FILENAME);
- }
- public function getContents()
- {
- set_error_handler(function ($type, $msg) use (&$error) { $error = $msg; });
- try {
- $content = file_get_contents($this->getPathname());
- } finally {
- restore_error_handler();
- }
- if (false === $content) {
- throw new \RuntimeException($error);
- }
- return $content;
- }
- }
- <?php
- namespace Symfony\Polyfill\Ctype;
- final class Ctype
- {
- public static function ctype_alnum($text)
- {
- $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__);
- return \is_string($text) && '' !== $text && !preg_match('/[^A-Za-z0-9]/', $text);
- }
- public static function ctype_alpha($text)
- {
- $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__);
- return \is_string($text) && '' !== $text && !preg_match('/[^A-Za-z]/', $text);
- }
- public static function ctype_cntrl($text)
- {
- $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__);
- return \is_string($text) && '' !== $text && !preg_match('/[^\x00-\x1f\x7f]/', $text);
- }
- public static function ctype_digit($text)
- {
- $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__);
- return \is_string($text) && '' !== $text && !preg_match('/[^0-9]/', $text);
- }
- public static function ctype_graph($text)
- {
- $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__);
- return \is_string($text) && '' !== $text && !preg_match('/[^!-~]/', $text);
- }
- public static function ctype_lower($text)
- {
- $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__);
- return \is_string($text) && '' !== $text && !preg_match('/[^a-z]/', $text);
- }
- public static function ctype_print($text)
- {
- $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__);
- return \is_string($text) && '' !== $text && !preg_match('/[^ -~]/', $text);
- }
- public static function ctype_punct($text)
- {
- $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__);
- return \is_string($text) && '' !== $text && !preg_match('/[^!-\/\:-@\[-`\{-~]/', $text);
- }
- public static function ctype_space($text)
- {
- $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__);
- return \is_string($text) && '' !== $text && !preg_match('/[^\s]/', $text);
- }
- public static function ctype_upper($text)
- {
- $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__);
- return \is_string($text) && '' !== $text && !preg_match('/[^A-Z]/', $text);
- }
- public static function ctype_xdigit($text)
- {
- $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__);
- return \is_string($text) && '' !== $text && !preg_match('/[^A-Fa-f0-9]/', $text);
- }
- private static function convert_int_to_char_for_ctype($int, $function)
- {
- if (!\is_int($int)) {
- return $int;
- }
- if ($int < -128 || $int > 255) {
- return (string) $int;
- }
- if (\PHP_VERSION_ID >= 80100) {
- @trigger_error($function.'(): Argument of type int will be interpreted as string in the future', \E_USER_DEPRECATED);
- }
- if ($int < 0) {
- $int += 256;
- }
- return \chr($int);
- }
- }
- Copyright (c) 2018-2019 Fabien Potencier
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is furnished
- to do so, subject to the following conditions:
- The above copyright notice and this permission notice shall be included in all
- copies or substantial portions of the Software.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
- <?php
- use Symfony\Polyfill\Ctype as p;
- if (\PHP_VERSION_ID >= 80000) {
- return require __DIR__.'/bootstrap80.php';
- }
- if (!function_exists('ctype_alnum')) {
- function ctype_alnum($text) { return p\Ctype::ctype_alnum($text); }
- }
- if (!function_exists('ctype_alpha')) {
- function ctype_alpha($text) { return p\Ctype::ctype_alpha($text); }
- }
- if (!function_exists('ctype_cntrl')) {
- function ctype_cntrl($text) { return p\Ctype::ctype_cntrl($text); }
- }
- if (!function_exists('ctype_digit')) {
- function ctype_digit($text) { return p\Ctype::ctype_digit($text); }
- }
- if (!function_exists('ctype_graph')) {
- function ctype_graph($text) { return p\Ctype::ctype_graph($text); }
- }
- if (!function_exists('ctype_lower')) {
- function ctype_lower($text) { return p\Ctype::ctype_lower($text); }
- }
- if (!function_exists('ctype_print')) {
- function ctype_print($text) { return p\Ctype::ctype_print($text); }
- }
- if (!function_exists('ctype_punct')) {
- function ctype_punct($text) { return p\Ctype::ctype_punct($text); }
- }
- if (!function_exists('ctype_space')) {
- function ctype_space($text) { return p\Ctype::ctype_space($text); }
- }
- if (!function_exists('ctype_upper')) {
- function ctype_upper($text) { return p\Ctype::ctype_upper($text); }
- }
- if (!function_exists('ctype_xdigit')) {
- function ctype_xdigit($text) { return p\Ctype::ctype_xdigit($text); }
- }
- <?php
- use Symfony\Polyfill\Ctype as p;
- if (!function_exists('ctype_alnum')) {
- function ctype_alnum(mixed $text): bool { return p\Ctype::ctype_alnum($text); }
- }
- if (!function_exists('ctype_alpha')) {
- function ctype_alpha(mixed $text): bool { return p\Ctype::ctype_alpha($text); }
- }
- if (!function_exists('ctype_cntrl')) {
- function ctype_cntrl(mixed $text): bool { return p\Ctype::ctype_cntrl($text); }
- }
- if (!function_exists('ctype_digit')) {
- function ctype_digit(mixed $text): bool { return p\Ctype::ctype_digit($text); }
- }
- if (!function_exists('ctype_graph')) {
- function ctype_graph(mixed $text): bool { return p\Ctype::ctype_graph($text); }
- }
- if (!function_exists('ctype_lower')) {
- function ctype_lower(mixed $text): bool { return p\Ctype::ctype_lower($text); }
- }
- if (!function_exists('ctype_print')) {
- function ctype_print(mixed $text): bool { return p\Ctype::ctype_print($text); }
- }
- if (!function_exists('ctype_punct')) {
- function ctype_punct(mixed $text): bool { return p\Ctype::ctype_punct($text); }
- }
- if (!function_exists('ctype_space')) {
- function ctype_space(mixed $text): bool { return p\Ctype::ctype_space($text); }
- }
- if (!function_exists('ctype_upper')) {
- function ctype_upper(mixed $text): bool { return p\Ctype::ctype_upper($text); }
- }
- if (!function_exists('ctype_xdigit')) {
- function ctype_xdigit(mixed $text): bool { return p\Ctype::ctype_xdigit($text); }
- }
- <?php
- namespace Symfony\Polyfill\Intl\Grapheme;
- \define('SYMFONY_GRAPHEME_CLUSTER_RX', ((float) \PCRE_VERSION < 10 ? (float) \PCRE_VERSION >= 8.32 : (float) \PCRE_VERSION >= 10.39) ? '\X' : Grapheme::GRAPHEME_CLUSTER_RX);
- final class Grapheme
- {
- 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}])';
- private const CASE_FOLD = [
- ['µ', 'ſ', "\xCD\x85", 'ς', "\xCF\x90", "\xCF\x91", "\xCF\x95", "\xCF\x96", "\xCF\xB0", "\xCF\xB1", "\xCF\xB5", "\xE1\xBA\x9B", "\xE1\xBE\xBE"],
- ['μ', 's', 'ι', 'σ', 'β', 'θ', 'φ', 'π', 'κ', '�', 'ε', "\xE1\xB9\xA1", 'ι'],
- ];
- public static function grapheme_extract($s, $size, $type = \GRAPHEME_EXTR_COUNT, $start = 0, &$next = 0)
- {
- if (0 > $start) {
- $start = \strlen($s) + $start;
- }
- if (!is_scalar($s)) {
- $hasError = false;
- set_error_handler(function () use (&$hasError) { $hasError = true; });
- $next = substr($s, $start);
- restore_error_handler();
- if ($hasError) {
- substr($s, $start);
- $s = '';
- } else {
- $s = $next;
- }
- } else {
- $s = substr($s, $start);
- }
- $size = (int) $size;
- $type = (int) $type;
- $start = (int) $start;
- if (\GRAPHEME_EXTR_COUNT !== $type && \GRAPHEME_EXTR_MAXBYTES !== $type && \GRAPHEME_EXTR_MAXCHARS !== $type) {
- if (80000 > \PHP_VERSION_ID) {
- return false;
- }
- throw new \ValueError('grapheme_extract(): Argument #3 ($type) must be one of GRAPHEME_EXTR_COUNT, GRAPHEME_EXTR_MAXBYTES, or GRAPHEME_EXTR_MAXCHARS');
- }
- if (!isset($s[0]) || 0 > $size || 0 > $start) {
- return false;
- }
- if (0 === $size) {
- return '';
- }
- $next = $start;
- $s = preg_split('/('.SYMFONY_GRAPHEME_CLUSTER_RX.')/u', "\r\n".$s, $size + 1, \PREG_SPLIT_NO_EMPTY | \PREG_SPLIT_DELIM_CAPTURE);
- if (!isset($s[1])) {
- return false;
- }
- $i = 1;
- $ret = '';
- do {
- if (\GRAPHEME_EXTR_COUNT === $type) {
- --$size;
- } elseif (\GRAPHEME_EXTR_MAXBYTES === $type) {
- $size -= \strlen($s[$i]);
- } else {
- $size -= iconv_strlen($s[$i], 'UTF-8//IGNORE');
- }
- if ($size >= 0) {
- $ret .= $s[$i];
- }
- } while (isset($s[++$i]) && $size > 0);
- $next += \strlen($ret);
- return $ret;
- }
- public static function grapheme_strlen($s)
- {
- preg_replace('/'.SYMFONY_GRAPHEME_CLUSTER_RX.'/u', '', $s, -1, $len);
- return 0 === $len && '' !== $s ? null : $len;
- }
- public static function grapheme_substr($s, $start, $len = null)
- {
- if (null === $len) {
- $len = 2147483647;
- }
- preg_match_all('/'.SYMFONY_GRAPHEME_CLUSTER_RX.'/u', $s, $s);
- $slen = \count($s[0]);
- $start = (int) $start;
- if (0 > $start) {
- $start += $slen;
- }
- if (0 > $start) {
- if (\PHP_VERSION_ID < 80000) {
- return false;
- }
- $start = 0;
- }
- if ($start >= $slen) {
- return \PHP_VERSION_ID >= 80000 ? '' : false;
- }
- $rem = $slen - $start;
- if (0 > $len) {
- $len += $rem;
- }
- if (0 === $len) {
- return '';
- }
- if (0 > $len) {
- return \PHP_VERSION_ID >= 80000 ? '' : false;
- }
- if ($len > $rem) {
- $len = $rem;
- }
- return implode('', \array_slice($s[0], $start, $len));
- }
- public static function grapheme_strpos($s, $needle, $offset = 0)
- {
- return self::grapheme_position($s, $needle, $offset, 0);
- }
- public static function grapheme_stripos($s, $needle, $offset = 0)
- {
- return self::grapheme_position($s, $needle, $offset, 1);
- }
- public static function grapheme_strrpos($s, $needle, $offset = 0)
- {
- return self::grapheme_position($s, $needle, $offset, 2);
- }
- public static function grapheme_strripos($s, $needle, $offset = 0)
- {
- return self::grapheme_position($s, $needle, $offset, 3);
- }
- public static function grapheme_stristr($s, $needle, $beforeNeedle = false)
- {
- return mb_stristr($s, $needle, $beforeNeedle, 'UTF-8');
- }
- public static function grapheme_strstr($s, $needle, $beforeNeedle = false)
- {
- return mb_strstr($s, $needle, $beforeNeedle, 'UTF-8');
- }
- private static function grapheme_position($s, $needle, $offset, $mode)
- {
- $needle = (string) $needle;
- if (80000 > \PHP_VERSION_ID && !preg_match('/./us', $needle)) {
- return false;
- }
- $s = (string) $s;
- if (!preg_match('/./us', $s)) {
- return false;
- }
- if ($offset > 0) {
- $s = self::grapheme_substr($s, $offset);
- } elseif ($offset < 0) {
- if (2 > $mode) {
- $offset += self::grapheme_strlen($s);
- $s = self::grapheme_substr($s, $offset);
- if (0 > $offset) {
- $offset = 0;
- }
- } elseif (0 > $offset += self::grapheme_strlen($needle)) {
- $s = self::grapheme_substr($s, 0, $offset);
- $offset = 0;
- } else {
- $offset = 0;
- }
- }
- $caseInsensitive = $mode & 1;
- $reverse = $mode & 2;
- if ($caseInsensitive) {
- $mode = \defined('MB_CASE_FOLD_SIMPLE') ? \MB_CASE_FOLD_SIMPLE : \MB_CASE_LOWER;
- $s = mb_convert_case($s, $mode, 'UTF-8');
- $needle = mb_convert_case($needle, $mode, 'UTF-8');
- if (!\defined('MB_CASE_FOLD_SIMPLE')) {
- $s = str_replace(self::CASE_FOLD[0], self::CASE_FOLD[1], $s);
- $needle = str_replace(self::CASE_FOLD[0], self::CASE_FOLD[1], $needle);
- }
- }
- if ($reverse) {
- $needlePos = strrpos($s, $needle);
- } else {
- $needlePos = strpos($s, $needle);
- }
- return false !== $needlePos ? self::grapheme_strlen(substr($s, 0, $needlePos)) + $offset : false;
- }
- }
- Copyright (c) 2015-2019 Fabien Potencier
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is furnished
- to do so, subject to the following conditions:
- The above copyright notice and this permission notice shall be included in all
- copies or substantial portions of the Software.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
- <?php
- use Symfony\Polyfill\Intl\Grapheme as p;
- if (extension_loaded('intl')) {
- return;
- }
- if (\PHP_VERSION_ID >= 80000) {
- return require __DIR__.'/bootstrap80.php';
- }
- if (!defined('GRAPHEME_EXTR_COUNT')) {
- define('GRAPHEME_EXTR_COUNT', 0);
- }
- if (!defined('GRAPHEME_EXTR_MAXBYTES')) {
- define('GRAPHEME_EXTR_MAXBYTES', 1);
- }
- if (!defined('GRAPHEME_EXTR_MAXCHARS')) {
- define('GRAPHEME_EXTR_MAXCHARS', 2);
- }
- if (!function_exists('grapheme_extract')) {
- function grapheme_extract($haystack, $size, $type = 0, $start = 0, &$next = 0) { return p\Grapheme::grapheme_extract($haystack, $size, $type, $start, $next); }
- }
- if (!function_exists('grapheme_stripos')) {
- function grapheme_stripos($haystack, $needle, $offset = 0) { return p\Grapheme::grapheme_stripos($haystack, $needle, $offset); }
- }
- if (!function_exists('grapheme_stristr')) {
- function grapheme_stristr($haystack, $needle, $beforeNeedle = false) { return p\Grapheme::grapheme_stristr($haystack, $needle, $beforeNeedle); }
- }
- if (!function_exists('grapheme_strlen')) {
- function grapheme_strlen($input) { return p\Grapheme::grapheme_strlen($input); }
- }
- if (!function_exists('grapheme_strpos')) {
- function grapheme_strpos($haystack, $needle, $offset = 0) { return p\Grapheme::grapheme_strpos($haystack, $needle, $offset); }
- }
- if (!function_exists('grapheme_strripos')) {
- function grapheme_strripos($haystack, $needle, $offset = 0) { return p\Grapheme::grapheme_strripos($haystack, $needle, $offset); }
- }
- if (!function_exists('grapheme_strrpos')) {
- function grapheme_strrpos($haystack, $needle, $offset = 0) { return p\Grapheme::grapheme_strrpos($haystack, $needle, $offset); }
- }
- if (!function_exists('grapheme_strstr')) {
- function grapheme_strstr($haystack, $needle, $beforeNeedle = false) { return p\Grapheme::grapheme_strstr($haystack, $needle, $beforeNeedle); }
- }
- if (!function_exists('grapheme_substr')) {
- function grapheme_substr($string, $offset, $length = null) { return p\Grapheme::grapheme_substr($string, $offset, $length); }
- }
- <?php
- use Symfony\Polyfill\Intl\Grapheme as p;
- if (!defined('GRAPHEME_EXTR_COUNT')) {
- define('GRAPHEME_EXTR_COUNT', 0);
- }
- if (!defined('GRAPHEME_EXTR_MAXBYTES')) {
- define('GRAPHEME_EXTR_MAXBYTES', 1);
- }
- if (!defined('GRAPHEME_EXTR_MAXCHARS')) {
- define('GRAPHEME_EXTR_MAXCHARS', 2);
- }
- if (!function_exists('grapheme_extract')) {
- 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); }
- }
- if (!function_exists('grapheme_stripos')) {
- function grapheme_stripos(?string $haystack, ?string $needle, ?int $offset = 0): int|false { return p\Grapheme::grapheme_stripos((string) $haystack, (string) $needle, (int) $offset); }
- }
- if (!function_exists('grapheme_stristr')) {
- function grapheme_stristr(?string $haystack, ?string $needle, ?bool $beforeNeedle = false): string|false { return p\Grapheme::grapheme_stristr((string) $haystack, (string) $needle, (bool) $beforeNeedle); }
- }
- if (!function_exists('grapheme_strlen')) {
- function grapheme_strlen(?string $string): int|false|null { return p\Grapheme::grapheme_strlen((string) $string); }
- }
- if (!function_exists('grapheme_strpos')) {
- function grapheme_strpos(?string $haystack, ?string $needle, ?int $offset = 0): int|false { return p\Grapheme::grapheme_strpos((string) $haystack, (string) $needle, (int) $offset); }
- }
- if (!function_exists('grapheme_strripos')) {
- function grapheme_strripos(?string $haystack, ?string $needle, ?int $offset = 0): int|false { return p\Grapheme::grapheme_strripos((string) $haystack, (string) $needle, (int) $offset); }
- }
- if (!function_exists('grapheme_strrpos')) {
- function grapheme_strrpos(?string $haystack, ?string $needle, ?int $offset = 0): int|false { return p\Grapheme::grapheme_strrpos((string) $haystack, (string) $needle, (int) $offset); }
- }
- if (!function_exists('grapheme_strstr')) {
- function grapheme_strstr(?string $haystack, ?string $needle, ?bool $beforeNeedle = false): string|false { return p\Grapheme::grapheme_strstr((string) $haystack, (string) $needle, (bool) $beforeNeedle); }
- }
- if (!function_exists('grapheme_substr')) {
- function grapheme_substr(?string $string, ?int $offset, ?int $length = null): string|false { return p\Grapheme::grapheme_substr((string) $string, (int) $offset, $length); }
- }
- Copyright (c) 2015-2019 Fabien Potencier
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is furnished
- to do so, subject to the following conditions:
- The above copyright notice and this permission notice shall be included in all
- copies or substantial portions of the Software.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
- <?php
- namespace Symfony\Polyfill\Intl\Normalizer;
- class Normalizer
- {
- public const FORM_D = \Normalizer::FORM_D;
- public const FORM_KD = \Normalizer::FORM_KD;
- public const FORM_C = \Normalizer::FORM_C;
- public const FORM_KC = \Normalizer::FORM_KC;
- public const NFD = \Normalizer::NFD;
- public const NFKD = \Normalizer::NFKD;
- public const NFC = \Normalizer::NFC;
- public const NFKC = \Normalizer::NFKC;
- private static $C;
- private static $D;
- private static $KD;
- private static $cC;
- private static $ulenMask = ["\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4];
- 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";
- public static function isNormalized(string $s, int $form = self::FORM_C)
- {
- if (!\in_array($form, [self::NFD, self::NFKD, self::NFC, self::NFKC])) {
- return false;
- }
- if (!isset($s[strspn($s, self::$ASCII)])) {
- return true;
- }
- if (self::NFC == $form && preg_match('//u', $s) && !preg_match('/[^\x00-\x{2FF}]/u', $s)) {
- return true;
- }
- return self::normalize($s, $form) === $s;
- }
- public static function normalize(string $s, int $form = self::FORM_C)
- {
- if (!preg_match('//u', $s)) {
- return false;
- }
- switch ($form) {
- case self::NFC: $C = true; $K = false; break;
- case self::NFD: $C = false; $K = false; break;
- case self::NFKC: $C = true; $K = true; break;
- case self::NFKD: $C = false; $K = true; break;
- default:
- if (\defined('Normalizer::NONE') && \Normalizer::NONE == $form) {
- return $s;
- }
- if (80000 > \PHP_VERSION_ID) {
- return false;
- }
- throw new \ValueError('normalizer_normalize(): Argument #2 ($form) must be a a valid normalization form');
- }
- if ('' === $s) {
- return '';
- }
- if ($K && null === self::$KD) {
- self::$KD = self::getData('compatibilityDecomposition');
- }
- if (null === self::$D) {
- self::$D = self::getData('canonicalDecomposition');
- self::$cC = self::getData('combiningClass');
- }
- if (null !== $mbEncoding = (2 & (int) ini_get('mbstring.func_overload')) ? mb_internal_encoding() : null) {
- mb_internal_encoding('8bit');
- }
- $r = self::decompose($s, $K);
- if ($C) {
- if (null === self::$C) {
- self::$C = self::getData('canonicalComposition');
- }
- $r = self::recompose($r);
- }
- if (null !== $mbEncoding) {
- mb_internal_encoding($mbEncoding);
- }
- return $r;
- }
- private static function recompose($s)
- {
- $ASCII = self::$ASCII;
- $compMap = self::$C;
- $combClass = self::$cC;
- $ulenMask = self::$ulenMask;
- $result = $tail = '';
- $i = $s[0] < "\x80" ? 1 : $ulenMask[$s[0] & "\xF0"];
- $len = \strlen($s);
- $lastUchr = substr($s, 0, $i);
- $lastUcls = isset($combClass[$lastUchr]) ? 256 : 0;
- while ($i < $len) {
- if ($s[$i] < "\x80") {
- if ($tail) {
- $lastUchr .= $tail;
- $tail = '';
- }
- if ($j = strspn($s, $ASCII, $i + 1)) {
- $lastUchr .= substr($s, $i, $j);
- $i += $j;
- }
- $result .= $lastUchr;
- $lastUchr = $s[$i];
- $lastUcls = 0;
- ++$i;
- continue;
- }
- $ulen = $ulenMask[$s[$i] & "\xF0"];
- $uchr = substr($s, $i, $ulen);
- if ($lastUchr < "\xE1\x84\x80" || "\xE1\x84\x92" < $lastUchr
- || $uchr < "\xE1\x85\xA1" || "\xE1\x85\xB5" < $uchr
- || $lastUcls) {
- $ucls = $combClass[$uchr] ?? 0;
- if (isset($compMap[$lastUchr.$uchr]) && (!$lastUcls || $lastUcls < $ucls)) {
- $lastUchr = $compMap[$lastUchr.$uchr];
- } elseif ($lastUcls = $ucls) {
- $tail .= $uchr;
- } else {
- if ($tail) {
- $lastUchr .= $tail;
- $tail = '';
- }
- $result .= $lastUchr;
- $lastUchr = $uchr;
- }
- } else {
- $L = \ord($lastUchr[2]) - 0x80;
- $V = \ord($uchr[2]) - 0xA1;
- $T = 0;
- $uchr = substr($s, $i + $ulen, 3);
- if ("\xE1\x86\xA7" <= $uchr && $uchr <= "\xE1\x87\x82") {
- $T = \ord($uchr[2]) - 0xA7;
- 0 > $T && $T += 0x40;
- $ulen += 3;
- }
- $L = 0xAC00 + ($L * 21 + $V) * 28 + $T;
- $lastUchr = \chr(0xE0 | $L >> 12).\chr(0x80 | $L >> 6 & 0x3F).\chr(0x80 | $L & 0x3F);
- }
- $i += $ulen;
- }
- return $result.$lastUchr.$tail;
- }
- private static function decompose($s, $c)
- {
- $result = '';
- $ASCII = self::$ASCII;
- $decompMap = self::$D;
- $combClass = self::$cC;
- $ulenMask = self::$ulenMask;
- if ($c) {
- $compatMap = self::$KD;
- }
- $c = [];
- $i = 0;
- $len = \strlen($s);
- while ($i < $len) {
- if ($s[$i] < "\x80") {
- if ($c) {
- ksort($c);
- $result .= implode('', $c);
- $c = [];
- }
- $j = 1 + strspn($s, $ASCII, $i + 1);
- $result .= substr($s, $i, $j);
- $i += $j;
- continue;
- }
- $ulen = $ulenMask[$s[$i] & "\xF0"];
- $uchr = substr($s, $i, $ulen);
- $i += $ulen;
- if ($uchr < "\xEA\xB0\x80" || "\xED\x9E\xA3" < $uchr) {
- if ($uchr !== $j = $compatMap[$uchr] ?? ($decompMap[$uchr] ?? $uchr)) {
- $uchr = $j;
- $j = \strlen($uchr);
- $ulen = $uchr[0] < "\x80" ? 1 : $ulenMask[$uchr[0] & "\xF0"];
- if ($ulen != $j) {
- $j -= $ulen;
- $i -= $j;
- if (0 > $i) {
- $s = str_repeat(' ', -$i).$s;
- $len -= $i;
- $i = 0;
- }
- while ($j--) {
- $s[$i + $j] = $uchr[$ulen + $j];
- }
- $uchr = substr($uchr, 0, $ulen);
- }
- }
- if (isset($combClass[$uchr])) {
- if (!isset($c[$combClass[$uchr]])) {
- $c[$combClass[$uchr]] = '';
- }
- $c[$combClass[$uchr]] .= $uchr;
- continue;
- }
- } else {
- $uchr = unpack('C*', $uchr);
- $j = (($uchr[1] - 224) << 12) + (($uchr[2] - 128) << 6) + $uchr[3] - 0xAC80;
- $uchr = "\xE1\x84".\chr(0x80 + (int) ($j / 588))
- ."\xE1\x85".\chr(0xA1 + (int) (($j % 588) / 28));
- if ($j %= 28) {
- $uchr .= $j < 25
- ? ("\xE1\x86".\chr(0xA7 + $j))
- : ("\xE1\x87".\chr(0x67 + $j));
- }
- }
- if ($c) {
- ksort($c);
- $result .= implode('', $c);
- $c = [];
- }
- $result .= $uchr;
- }
- if ($c) {
- ksort($c);
- $result .= implode('', $c);
- }
- return $result;
- }
- private static function getData($file)
- {
- if (file_exists($file = __DIR__.'/Resources/unidata/'.$file.'.php')) {
- return require $file;
- }
- return false;
- }
- }
- <?php
- class Normalizer extends Symfony\Polyfill\Intl\Normalizer\Normalizer
- {
- public const NONE = 2;
- public const FORM_D = 4;
- public const FORM_KD = 8;
- public const FORM_C = 16;
- public const FORM_KC = 32;
- public const NFD = 4;
- public const NFKD = 8;
- public const NFC = 16;
- public const NFKC = 32;
- }
- <?php
- return array (
- 'À' => 'À',
- 'A�' => '�',
- 'Â' => 'Â',
- 'Ã' => 'Ã',
- 'Ä' => 'Ä',
- 'AÌŠ' => 'Ã…',
- 'Ç' => 'Ç',
- 'È' => 'È',
- 'E�' => 'É',
- 'Ê' => 'Ê',
- 'Ë' => 'Ë',
- 'Ì' => 'Ì',
- 'I�' => '�',
- 'IÌ‚' => 'ÃŽ',
- 'Ï' => '�',
- 'Ñ' => 'Ñ',
- 'OÌ€' => 'Ã’',
- 'O�' => 'Ó',
- 'Ô' => 'Ô',
- 'Õ' => 'Õ',
- 'Ö' => 'Ö',
- 'Ù' => 'Ù',
- 'U�' => 'Ú',
- 'Û' => 'Û',
- 'Ü' => 'Ü',
- 'Y�' => '�',
- 'à' => 'à ',
- 'a�' => 'á',
- 'â' => 'â',
- 'ã' => 'ã',
- 'ä' => 'ä',
- 'aÌŠ' => 'Ã¥',
- 'ç' => 'ç',
- 'è' => 'è',
- 'e�' => 'é',
- 'ê' => 'ê',
- 'ë' => 'ë',
- 'ì' => 'ì',
- 'iÌ�' => 'Ã',
- 'î' => 'î',
- 'ï' => 'ï',
- 'ñ' => 'ñ',
- 'ò' => 'ò',
- 'o�' => 'ó',
- 'ô' => 'ô',
- 'õ' => 'õ',
- 'ö' => 'ö',
- 'ù' => 'ù',
- 'u�' => 'ú',
- 'û' => 'û',
- 'ü' => 'ü',
- 'y�' => 'ý',
- 'ÿ' => 'ÿ',
- 'AÌ„' => 'Ä€',
- 'ā' => '�',
- 'Ă' => 'Ă',
- 'ă' => 'ă',
- 'Ą' => 'Ą',
- 'ą' => 'ą',
- 'C�' => 'Ć',
- 'c�' => 'ć',
- 'Ĉ' => 'Ĉ',
- 'ĉ' => 'ĉ',
- 'Ċ' => 'Ċ',
- 'ċ' => 'ċ',
- 'Č' => 'Č',
- 'č' => '�',
- 'Ď' => 'Ď',
- 'ď' => '�',
- 'EÌ„' => 'Ä’',
- 'ē' => 'ē',
- 'Ĕ' => 'Ĕ',
- 'ĕ' => 'ĕ',
- 'Ė' => 'Ė',
- 'ė' => 'ė',
- 'Ę' => 'Ę',
- 'ę' => 'ę',
- 'Ě' => 'Ě',
- 'ě' => 'ě',
- 'Ĝ' => 'Ĝ',
- 'ĝ' => '�',
- 'Ğ' => 'Ğ',
- 'ğ' => 'ğ',
- 'Ġ' => 'Ä ',
- 'ġ' => 'ġ',
- 'Ģ' => 'Ģ',
- 'ģ' => 'ģ',
- 'Ĥ' => 'Ĥ',
- 'ĥ' => 'ĥ',
- 'Ĩ' => 'Ĩ',
- 'ĩ' => 'ĩ',
- 'Ī' => 'Ī',
- 'ī' => 'ī',
- 'Ĭ' => 'Ĭ',
- 'ĭ' => 'Ä',
- 'Į' => 'Į',
- 'į' => 'į',
- 'İ' => 'İ',
- 'JÌ‚' => 'Ä´',
- 'ĵ' => 'ĵ',
- 'Ķ' => 'Ķ',
- 'ķ' => 'ķ',
- 'L�' => 'Ĺ',
- 'l�' => 'ĺ',
- 'Ļ' => 'Ļ',
- 'ļ' => 'ļ',
- 'Ľ' => 'Ľ',
- 'ľ' => 'ľ',
- 'N�' => 'Ń',
- 'n�' => 'ń',
- 'Ņ' => 'Ņ',
- 'ņ' => 'ņ',
- 'Ň' => 'Ň',
- 'ň' => 'ň',
- 'Ō' => 'Ō',
- 'ō' => '�',
- 'Ŏ' => 'Ŏ',
- 'ŏ' => '�',
- 'Ő' => '�',
- 'ő' => 'ő',
- 'R�' => 'Ŕ',
- 'r�' => 'ŕ',
- 'Ŗ' => 'Ŗ',
- 'ŗ' => 'ŗ',
- 'Ř' => 'Ř',
- 'ř' => 'ř',
- 'S�' => 'Ś',
- 's�' => 'ś',
- 'Ŝ' => 'Ŝ',
- 'ŝ' => '�',
- 'Ş' => 'Ş',
- 'ş' => 'ş',
- 'Š' => 'Š',
- 'š' => 'š',
- 'Ţ' => 'Ţ',
- 'ţ' => 'ţ',
- 'Ť' => 'Ť',
- 'ť' => 'ť',
- 'Ũ' => 'Ũ',
- 'ũ' => 'ũ',
- 'Ū' => 'Ū',
- 'ū' => 'ū',
- 'Ŭ' => 'Ŭ',
- 'ŭ' => 'Å',
- 'UÌŠ' => 'Å®',
- 'ů' => 'ů',
- 'UÌ‹' => 'Å°',
- 'ű' => 'ű',
- 'Ų' => 'Ų',
- 'ų' => 'ų',
- 'WÌ‚' => 'Å´',
- 'ŵ' => 'ŵ',
- 'Ŷ' => 'Ŷ',
- 'ŷ' => 'ŷ',
- 'Ÿ' => 'Ÿ',
- 'Z�' => 'Ź',
- 'z�' => 'ź',
- 'Ż' => 'Ż',
- 'ż' => 'ż',
- 'Ž' => 'Ž',
- 'ž' => 'ž',
- 'OÌ›' => 'Æ ',
- 'oÌ›' => 'Æ¡',
- 'Ư' => 'Ư',
- 'uÌ›' => 'Æ°',
- 'Ǎ' => '�',
- 'ǎ' => 'ǎ',
- 'Ǐ' => '�',
- 'ǐ' => '�',
- 'Ǒ' => 'Ǒ',
- 'ǒ' => 'ǒ',
- 'Ǔ' => 'Ǔ',
- 'ǔ' => 'ǔ',
- 'Ǖ' => 'Ǖ',
- 'ǖ' => 'ǖ',
- 'Ü�' => 'Ǘ',
- 'ü�' => 'ǘ',
- 'Ǚ' => 'Ǚ',
- 'ǚ' => 'ǚ',
- 'Ǜ' => 'Ǜ',
- 'ǜ' => 'ǜ',
- 'Ǟ' => 'Ǟ',
- 'ǟ' => 'ǟ',
- 'Ǡ' => 'Ç ',
- 'ǡ' => 'ǡ',
- 'Ǣ' => 'Ǣ',
- 'ǣ' => 'ǣ',
- 'Ǧ' => 'Ǧ',
- 'ǧ' => 'ǧ',
- 'Ǩ' => 'Ǩ',
- 'ǩ' => 'ǩ',
- 'Ǫ' => 'Ǫ',
- 'ǫ' => 'ǫ',
- 'Ǭ' => 'Ǭ',
- 'Ç«Ì„' => 'Ç',
- 'Ǯ' => 'Ǯ',
- 'ǯ' => 'ǯ',
- 'ǰ' => 'ǰ',
- 'G�' => 'Ǵ',
- 'g�' => 'ǵ',
- 'Ǹ' => 'Ǹ',
- 'ǹ' => 'ǹ',
- 'Å�' => 'Ǻ',
- 'å�' => 'ǻ',
- 'Æ�' => 'Ǽ',
- 'æ�' => 'ǽ',
- 'Ø�' => 'Ǿ',
- 'ø�' => 'ǿ',
- 'A�' => 'Ȁ',
- 'a�' => '�',
- 'AÌ‘' => 'È‚',
- 'ȃ' => 'ȃ',
- 'E�' => 'Ȅ',
- 'e�' => 'ȅ',
- 'Ȇ' => 'Ȇ',
- 'ȇ' => 'ȇ',
- 'I�' => 'Ȉ',
- 'i�' => 'ȉ',
- 'IÌ‘' => 'ÈŠ',
- 'ȋ' => 'ȋ',
- 'O�' => 'Ȍ',
- 'o�' => '�',
- 'OÌ‘' => 'ÈŽ',
- 'ȏ' => '�',
- 'R�' => '�',
- 'r�' => 'ȑ',
- 'RÌ‘' => 'È’',
- 'ȓ' => 'ȓ',
- 'U�' => 'Ȕ',
- 'u�' => 'ȕ',
- 'UÌ‘' => 'È–',
- 'ȗ' => 'ȗ',
- 'Ș' => 'Ș',
- 'ș' => 'ș',
- 'Ț' => 'Ț',
- 'ț' => 'ț',
- 'Ȟ' => 'Ȟ',
- 'ȟ' => 'ȟ',
- 'Ȧ' => 'Ȧ',
- 'ȧ' => 'ȧ',
- 'Ȩ' => 'Ȩ',
- 'ȩ' => 'ȩ',
- 'Ȫ' => 'Ȫ',
- 'ȫ' => 'ȫ',
- 'Ȭ' => 'Ȭ',
- 'ȭ' => 'È',
- 'Ȯ' => 'Ȯ',
- 'ȯ' => 'ȯ',
- 'Ȱ' => 'Ȱ',
- 'ȱ' => 'ȱ',
- 'Ȳ' => 'Ȳ',
- 'ȳ' => 'ȳ',
- '¨�' => '΅',
- 'Α�' => 'Ά',
- 'Ε�' => 'Έ',
- 'Η�' => 'Ή',
- 'Ι�' => 'Ί',
- 'Ο�' => 'Ό',
- 'Υ�' => 'Ύ',
- 'Ω�' => '�',
- 'ϊ�' => '�',
- 'Ϊ' => 'Ϊ',
- 'Ϋ' => 'Ϋ',
- 'α�' => 'ά',
- 'εÌ�' => 'Î',
- 'η�' => 'ή',
- 'ι�' => 'ί',
- 'ϋ�' => 'ΰ',
- 'ϊ' => 'ϊ',
- 'ϋ' => 'ϋ',
- 'ο�' => 'ό',
- 'υ�' => '�',
- 'ω�' => 'ώ',
- 'ϒ�' => 'ϓ',
- 'ϔ' => 'ϔ',
- 'Ѐ' => 'Ѐ',
- 'Ё' => '�',
- 'Г�' => 'Ѓ',
- 'Ї' => 'Ї',
- 'К�' => 'Ќ',
- 'Ѝ' => '�',
- 'Ў' => 'Ў',
- 'Й' => 'Й',
- 'й' => 'й',
- 'ѐ' => '�',
- 'ё' => 'ё',
- 'г�' => 'ѓ',
- 'ї' => 'ї',
- 'к�' => 'ќ',
- 'ѝ' => '�',
- 'ў' => 'ў',
- 'Ѵ�' => 'Ѷ',
- 'ѵ�' => 'ѷ',
- 'Ӂ' => '�',
- 'ӂ' => 'ӂ',
- '�̆' => '�',
- 'ӑ' => 'ӑ',
- '�̈' => 'Ӓ',
- 'ӓ' => 'ӓ',
- 'Ӗ' => 'Ӗ',
- 'ӗ' => 'ӗ',
- 'Ӛ' => 'Ӛ',
- 'ӛ' => 'ӛ',
- 'Ӝ' => 'Ӝ',
- 'ӝ' => '�',
- 'Ӟ' => 'Ӟ',
- 'ӟ' => 'ӟ',
- 'Ӣ' => 'Ӣ',
- 'ӣ' => 'ӣ',
- 'Ӥ' => 'Ӥ',
- 'ӥ' => 'ӥ',
- 'Ӧ' => 'Ӧ',
- 'ӧ' => 'ӧ',
- 'Ӫ' => 'Ӫ',
- 'ӫ' => 'ӫ',
- 'Ð̈' => 'Ó¬',
- 'Ñ�̈' => 'Ó',
- 'Ӯ' => 'Ӯ',
- 'ӯ' => 'ӯ',
- 'Ӱ' => 'Ӱ',
- 'ӱ' => 'ӱ',
- 'Ӳ' => 'Ӳ',
- 'ӳ' => 'ӳ',
- 'Ӵ' => 'Ӵ',
- 'ӵ' => 'ӵ',
- 'Ӹ' => 'Ӹ',
- 'ӹ' => 'ӹ',
- 'آ' => 'آ',
- 'أ' => 'أ',
- 'ؤ' => 'ؤ',
- 'إ' => 'إ',
- 'ئ' => 'ئ',
- 'Û•Ù”' => 'Û€',
- 'Û�Ù”' => 'Û‚',
- 'Û’Ù”' => 'Û“',
- 'ऩ' => 'ऩ',
- 'ऱ' => 'ऱ',
- 'ऴ' => 'ऴ',
- 'ো' => 'ো',
- 'ৌ' => 'ৌ',
- 'à‡à–' => 'àˆ',
- 'à‡à¬¾' => 'à‹',
- 'à‡à—' => 'àŒ',
- 'ஔ' => 'ஔ',
- 'ொ' => 'ொ',
- 'ோ' => 'ோ',
- 'ௌ' => 'ௌ',
- 'ై' => 'ై',
- 'ೀ' => 'ೀ',
- 'ೇ' => 'ೇ',
- 'ೈ' => 'ೈ',
- 'ೊ' => 'ೊ',
- 'ೋ' => 'ೋ',
- 'ൊ' => 'ൊ',
- 'ോ' => 'ോ',
- 'ൌ' => 'ൌ',
- 'ේ' => 'ේ',
- 'ෙ�' => 'ො',
- 'ෝ' => '�',
- 'ෞ' => 'ෞ',
- 'ဦ' => 'ဦ',
- 'ᬆ' => 'ᬆ',
- 'ᬈ' => 'ᬈ',
- 'ᬊ' => 'ᬊ',
- 'ᬌ' => 'ᬌ',
- '�ᬵ' => 'ᬎ',
- 'ᬒ' => 'ᬒ',
- 'ᬻ' => 'ᬻ',
- 'ᬽ' => 'ᬽ',
- 'ᭀ' => 'á€',
- 'ᭁ' => 'á�',
- 'á‚ᬵ' => 'áƒ',
- 'Ḁ' => 'Ḁ',
- 'ḁ' => '�',
- 'Ḃ' => 'Ḃ',
- 'ḃ' => 'ḃ',
- 'Ḅ' => 'Ḅ',
- 'ḅ' => 'ḅ',
- 'Ḇ' => 'Ḇ',
- 'ḇ' => 'ḇ',
- 'Ç�' => 'Ḉ',
- 'ç�' => 'ḉ',
- 'Ḋ' => 'Ḋ',
- 'ḋ' => 'ḋ',
- 'Ḍ' => 'Ḍ',
- 'ḍ' => '�',
- 'Ḏ' => 'Ḏ',
- 'ḏ' => '�',
- 'Ḑ' => '�',
- 'ḑ' => 'ḑ',
- 'DÌ' => 'Ḓ',
- 'dÌ' => 'ḓ',
- 'Ḕ' => 'Ḕ',
- 'ḕ' => 'ḕ',
- 'Ē�' => 'Ḗ',
- 'ē�' => 'ḗ',
- 'EÌ' => 'Ḙ',
- 'eÌ' => 'ḙ',
- 'Ḛ' => 'Ḛ',
- 'ḛ' => 'ḛ',
- 'Ḝ' => 'Ḝ',
- 'ḝ' => '�',
- 'Ḟ' => 'Ḟ',
- 'ḟ' => 'ḟ',
- 'Ḡ' => 'Ḡ',
- 'ḡ' => 'ḡ',
- 'Ḣ' => 'Ḣ',
- 'ḣ' => 'ḣ',
- 'Ḥ' => 'Ḥ',
- 'ḥ' => 'ḥ',
- 'Ḧ' => 'Ḧ',
- 'ḧ' => 'ḧ',
- 'Ḩ' => 'Ḩ',
- 'ḩ' => 'ḩ',
- 'Ḫ' => 'Ḫ',
- 'ḫ' => 'ḫ',
- 'Ḭ' => 'Ḭ',
- 'iÌ°' => 'á¸',
- '��' => 'Ḯ',
- 'ï�' => 'ḯ',
- 'K�' => 'Ḱ',
- 'k�' => 'ḱ',
- 'Ḳ' => 'Ḳ',
- 'ḳ' => 'ḳ',
- 'Ḵ' => 'Ḵ',
- 'ḵ' => 'ḵ',
- 'Ḷ' => 'Ḷ',
- 'ḷ' => 'ḷ',
- 'Ḹ' => 'Ḹ',
- 'ḹ' => 'ḹ',
- 'Ḻ' => 'Ḻ',
- 'ḻ' => 'ḻ',
- 'LÌ' => 'Ḽ',
- 'lÌ' => 'ḽ',
- 'M�' => 'Ḿ',
- 'm�' => 'ḿ',
- 'Ṁ' => 'Ṁ',
- 'ṁ' => '�',
- 'Ṃ' => 'Ṃ',
- 'ṃ' => 'ṃ',
- 'Ṅ' => 'Ṅ',
- 'ṅ' => 'ṅ',
- 'Ṇ' => 'Ṇ',
- 'ṇ' => 'ṇ',
- 'Ṉ' => 'Ṉ',
- 'ṉ' => 'ṉ',
- 'NÌ' => 'Ṋ',
- 'nÌ' => 'ṋ',
- 'Õ�' => 'Ṍ',
- 'õ�' => '�',
- 'Ṏ' => 'Ṏ',
- 'ṏ' => '�',
- 'Ṑ' => '�',
- '�̀' => 'ṑ',
- 'Ō�' => 'Ṓ',
- '��' => 'ṓ',
- 'P�' => 'Ṕ',
- 'p�' => 'ṕ',
- 'Ṗ' => 'Ṗ',
- 'ṗ' => 'ṗ',
- 'Ṙ' => 'Ṙ',
- 'ṙ' => 'ṙ',
- 'Ṛ' => 'Ṛ',
- 'ṛ' => 'ṛ',
- 'Ṝ' => 'Ṝ',
- 'ṝ' => '�',
- 'Ṟ' => 'Ṟ',
- 'ṟ' => 'ṟ',
- 'Ṡ' => 'Ṡ',
- 'ṡ' => 'ṡ',
- 'SÌ£' => 'á¹¢',
- 'ṣ' => 'ṣ',
- 'Ṥ' => 'Ṥ',
- 'ṥ' => 'ṥ',
- 'Ṧ' => 'Ṧ',
- 'ṧ' => 'ṧ',
- 'Ṩ' => 'Ṩ',
- 'ṩ' => 'ṩ',
- 'Ṫ' => 'Ṫ',
- 'ṫ' => 'ṫ',
- 'Ṭ' => 'Ṭ',
- 'tÌ£' => 'á¹',
- 'Ṯ' => 'Ṯ',
- 'ṯ' => 'ṯ',
- 'TÌ' => 'á¹°',
- 'tÌ' => 'á¹±',
- 'Ṳ' => 'Ṳ',
- 'ṳ' => 'ṳ',
- 'UÌ°' => 'á¹´',
- 'uÌ°' => 'á¹µ',
- 'UÌ' => 'Ṷ',
- 'uÌ' => 'á¹·',
- 'Ũ�' => 'Ṹ',
- 'ũ�' => 'ṹ',
- 'Ṻ' => 'Ṻ',
- 'ṻ' => 'ṻ',
- 'Ṽ' => 'Ṽ',
- 'ṽ' => 'ṽ',
- 'VÌ£' => 'á¹¾',
- 'ṿ' => 'ṿ',
- 'Ẁ' => 'Ẁ',
- 'ẁ' => '�',
- 'W�' => 'Ẃ',
- 'w�' => 'ẃ',
- 'Ẅ' => 'Ẅ',
- 'ẅ' => 'ẅ',
- 'Ẇ' => 'Ẇ',
- 'ẇ' => 'ẇ',
- 'Ẉ' => 'Ẉ',
- 'ẉ' => 'ẉ',
- 'Ẋ' => 'Ẋ',
- 'ẋ' => 'ẋ',
- 'Ẍ' => 'Ẍ',
- 'ẍ' => '�',
- 'Ẏ' => 'Ẏ',
- 'ẏ' => '�',
- 'Ẑ' => '�',
- 'ẑ' => 'ẑ',
- 'Ẓ' => 'Ẓ',
- 'ẓ' => 'ẓ',
- 'Ẕ' => 'Ẕ',
- 'ẕ' => 'ẕ',
- 'ẖ' => 'ẖ',
- 'ẗ' => 'ẗ',
- 'ẘ' => 'ẘ',
- 'ẙ' => 'ẙ',
- 'ẛ' => 'ẛ',
- 'Ạ' => 'Ạ',
- 'ạ' => 'ạ',
- 'Ả' => 'Ả',
- 'ả' => 'ả',
- 'Â�' => 'Ấ',
- 'â�' => 'ấ',
- 'Ầ' => 'Ầ',
- 'ầ' => 'ầ',
- 'Ẩ' => 'Ẩ',
- 'ẩ' => 'ẩ',
- 'Ẫ' => 'Ẫ',
- 'ẫ' => 'ẫ',
- 'Ậ' => 'Ậ',
- 'ậ' => 'áº',
- 'Ă�' => 'Ắ',
- 'ă�' => 'ắ',
- 'Ằ' => 'Ằ',
- 'ằ' => 'ằ',
- 'Ẳ' => 'Ẳ',
- 'ẳ' => 'ẳ',
- 'Ẵ' => 'Ẵ',
- 'ẵ' => 'ẵ',
- 'Ặ' => 'Ặ',
- 'ặ' => 'ặ',
- 'Ẹ' => 'Ẹ',
- 'ẹ' => 'ẹ',
- 'Ẻ' => 'Ẻ',
- 'ẻ' => 'ẻ',
- 'Ẽ' => 'Ẽ',
- 'ẽ' => 'ẽ',
- 'Ê�' => 'Ế',
- 'ê�' => 'ế',
- 'Ề' => 'Ề',
- 'ề' => '�',
- 'Ể' => 'Ể',
- 'ể' => 'ể',
- 'Ễ' => 'Ễ',
- 'ễ' => 'ễ',
- 'Ệ' => 'Ệ',
- 'ệ' => 'ệ',
- 'Ỉ' => 'Ỉ',
- 'ỉ' => 'ỉ',
- 'Ị' => 'Ị',
- 'ị' => 'ị',
- 'Ọ' => 'Ọ',
- 'ọ' => '�',
- 'Ỏ' => 'Ỏ',
- 'ỏ' => '�',
- 'Ô�' => '�',
- 'ô�' => 'ố',
- 'Ồ' => 'Ồ',
- 'ồ' => 'ồ',
- 'Ổ' => 'Ổ',
- 'ổ' => 'ổ',
- 'Ỗ' => 'Ỗ',
- 'ỗ' => 'ỗ',
- 'Ộ' => 'Ộ',
- '�̂' => 'ộ',
- 'Æ Ì�' => 'Ớ',
- 'ơ�' => 'ớ',
- 'Æ Ì€' => 'Ờ',
- 'ờ' => '�',
- 'Æ Ì‰' => 'Ở',
- 'ở' => 'ở',
- 'Æ Ìƒ' => 'á» ',
- 'ỡ' => 'ỡ',
- 'Æ Ì£' => 'Ợ',
- 'ợ' => 'ợ',
- 'Ụ' => 'Ụ',
- 'ụ' => 'ụ',
- 'Ủ' => 'Ủ',
- 'ủ' => 'ủ',
- 'Ư�' => 'Ứ',
- 'ư�' => 'ứ',
- 'Ừ' => 'Ừ',
- 'ừ' => 'ừ',
- 'Ử' => 'Ử',
- 'ử' => 'á»',
- 'Ữ' => 'Ữ',
- 'ữ' => 'ữ',
- 'Ự' => 'Ự',
- 'Æ°Ì£' => 'á»±',
- 'Ỳ' => 'Ỳ',
- 'ỳ' => 'ỳ',
- 'YÌ£' => 'á»´',
- 'ỵ' => 'ỵ',
- 'Ỷ' => 'Ỷ',
- 'ỷ' => 'ỷ',
- 'Ỹ' => 'Ỹ',
- 'ỹ' => 'ỹ',
- 'ἀ' => 'ἀ',
- 'ἁ' => '�',
- 'ἂ' => 'ἂ',
- '�̀' => 'ἃ',
- 'ἀ�' => 'ἄ',
- '��' => 'ἅ',
- 'ἆ' => 'ἆ',
- '�͂' => 'ἇ',
- 'Ἀ' => 'Ἀ',
- 'Ἁ' => 'Ἁ',
- 'Ἂ' => 'Ἂ',
- 'Ἃ' => 'Ἃ',
- 'Ἀ�' => 'Ἄ',
- 'Ἁ�' => '�',
- 'Ἆ' => 'Ἆ',
- 'Ἇ' => '�',
- 'ἐ' => '�',
- 'ἑ' => 'ἑ',
- '�̀' => 'ἒ',
- 'ἓ' => 'ἓ',
- '��' => 'ἔ',
- 'ἑ�' => 'ἕ',
- 'Ἐ' => 'Ἐ',
- 'Ἑ' => 'Ἑ',
- 'Ἒ' => 'Ἒ',
- 'Ἓ' => 'Ἓ',
- 'Ἐ�' => 'Ἔ',
- 'Ἑ�' => '�',
- 'ἠ' => 'ἠ',
- 'ἡ' => 'ἡ',
- 'ἢ' => 'ἢ',
- 'ἣ' => 'ἣ',
- 'ἠ�' => 'ἤ',
- 'ἡ�' => 'ἥ',
- 'ἦ' => 'ἦ',
- 'ἧ' => 'ἧ',
- 'Ἠ' => 'Ἠ',
- 'Ἡ' => 'Ἡ',
- 'Ἢ' => 'Ἢ',
- 'Ἣ' => 'Ἣ',
- 'Ἠ�' => 'Ἤ',
- 'ἩÌ�' => 'á¼',
- 'Ἦ' => 'Ἦ',
- 'Ἧ' => 'Ἧ',
- 'ἰ' => 'ἰ',
- 'ἱ' => 'ἱ',
- 'á¼°Ì€' => 'á¼²',
- 'ἳ' => 'ἳ',
- 'ἰ�' => 'ἴ',
- 'ἱ�' => 'ἵ',
- 'ἶ' => 'ἶ',
- 'ἷ' => 'ἷ',
- 'Ἰ' => 'Ἰ',
- 'Ἱ' => 'Ἱ',
- 'Ἲ' => 'Ἲ',
- 'Ἳ' => 'Ἳ',
- 'Ἰ�' => 'Ἴ',
- 'Ἱ�' => 'Ἵ',
- 'Ἶ' => 'Ἶ',
- 'Ἷ' => 'Ἷ',
- 'ὀ' => 'ὀ',
- 'ὁ' => '�',
- 'ὂ' => 'ὂ',
- '�̀' => 'ὃ',
- 'ὀ�' => 'ὄ',
- '��' => 'ὅ',
- 'Ὀ' => 'Ὀ',
- 'Ὁ' => 'Ὁ',
- 'Ὂ' => 'Ὂ',
- 'Ὃ' => 'Ὃ',
- 'Ὀ�' => 'Ὄ',
- 'Ὁ�' => '�',
- 'ὐ' => '�',
- 'ὑ' => 'ὑ',
- '�̀' => 'ὒ',
- 'ὓ' => 'ὓ',
- '��' => 'ὔ',
- 'ὑ�' => 'ὕ',
- '�͂' => 'ὖ',
- 'ὗ' => 'ὗ',
- 'Ὑ' => 'Ὑ',
- 'Ὓ' => 'Ὓ',
- 'Ὑ�' => '�',
- 'Ὗ' => 'Ὗ',
- 'ὠ' => 'ὠ',
- 'ὡ' => 'ὡ',
- 'ὢ' => 'ὢ',
- 'ὣ' => 'ὣ',
- 'ὠ�' => 'ὤ',
- 'ὡ�' => 'ὥ',
- 'ὦ' => 'ὦ',
- 'ὧ' => 'ὧ',
- 'Ὠ' => 'Ὠ',
- 'Ὡ' => 'Ὡ',
- 'Ὢ' => 'Ὢ',
- 'Ὣ' => 'Ὣ',
- 'Ὠ�' => 'Ὤ',
- 'ὩÌ�' => 'á½',
- 'Ὦ' => 'Ὦ',
- 'Ὧ' => 'Ὧ',
- 'ὰ' => 'ὰ',
- 'ὲ' => 'ὲ',
- 'ὴ' => 'ὴ',
- 'ὶ' => 'ὶ',
- 'ὸ' => 'ὸ',
- 'ὺ' => 'ὺ',
- 'ὼ' => 'ὼ',
- 'ᾀ' => 'ᾀ',
- '�ͅ' => '�',
- 'ᾂ' => 'ᾂ',
- 'ᾃ' => 'ᾃ',
- 'ᾄ' => 'ᾄ',
- 'á¼…Í…' => 'á¾…',
- 'ᾆ' => 'ᾆ',
- 'ᾇ' => 'ᾇ',
- 'ᾈ' => 'ᾈ',
- 'ᾉ' => 'ᾉ',
- 'ᾊ' => 'ᾊ',
- 'ᾋ' => 'ᾋ',
- 'ᾌ' => 'ᾌ',
- '�ͅ' => '�',
- 'ᾎ' => 'ᾎ',
- '�ͅ' => '�',
- 'ᾐ' => '�',
- 'ᾑ' => 'ᾑ',
- 'ᾒ' => 'ᾒ',
- 'ᾓ' => 'ᾓ',
- 'ᾔ' => 'ᾔ',
- 'ᾕ' => 'ᾕ',
- 'ᾖ' => 'ᾖ',
- 'ᾗ' => 'ᾗ',
- 'ᾘ' => 'ᾘ',
- 'ᾙ' => 'ᾙ',
- 'ᾚ' => 'ᾚ',
- 'ᾛ' => 'ᾛ',
- 'ᾜ' => 'ᾜ',
- 'á¼Í…' => 'á¾�',
- 'ᾞ' => 'ᾞ',
- 'ᾟ' => 'ᾟ',
- 'á½ Í…' => 'á¾ ',
- 'ᾡ' => 'ᾡ',
- 'ᾢ' => 'ᾢ',
- 'ᾣ' => 'ᾣ',
- 'ᾤ' => 'ᾤ',
- 'ᾥ' => 'ᾥ',
- 'ᾦ' => 'ᾦ',
- 'ᾧ' => 'ᾧ',
- 'ᾨ' => 'ᾨ',
- 'ᾩ' => 'ᾩ',
- 'ᾪ' => 'ᾪ',
- 'ᾫ' => 'ᾫ',
- 'ᾬ' => 'ᾬ',
- 'á½Í…' => 'á¾',
- 'ᾮ' => 'ᾮ',
- 'ᾯ' => 'ᾯ',
- 'ᾰ' => 'ᾰ',
- 'ᾱ' => 'ᾱ',
- 'á½°Í…' => 'á¾²',
- 'ᾳ' => 'ᾳ',
- 'ᾴ' => 'ᾴ',
- 'ᾶ' => 'ᾶ',
- 'ᾷ' => 'ᾷ',
- 'Ᾰ' => 'Ᾰ',
- 'Ᾱ' => 'Ᾱ',
- 'Ὰ' => 'Ὰ',
- 'ᾼ' => 'ᾼ',
- '῁' => '�',
- 'á½´Í…' => 'á¿‚',
- 'ῃ' => 'ῃ',
- 'ῄ' => 'ῄ',
- 'ῆ' => 'ῆ',
- 'ῇ' => 'ῇ',
- 'Ὲ' => 'Ὲ',
- 'Ὴ' => 'Ὴ',
- 'ῌ' => 'ῌ',
- '῍' => '�',
- '᾿�' => '῎',
- '῏' => '�',
- 'ῐ' => '�',
- 'ῑ' => 'ῑ',
- 'ÏŠÌ€' => 'á¿’',
- 'ῖ' => 'ῖ',
- 'ÏŠÍ‚' => 'á¿—',
- 'Ῐ' => 'Ῐ',
- 'Ῑ' => 'Ῑ',
- 'Ὶ' => 'Ὶ',
- '῝' => '�',
- '῾�' => '῞',
- '῟' => '῟',
- 'ῠ' => 'ῠ',
- 'Ï…Ì„' => 'á¿¡',
- 'Ï‹Ì€' => 'á¿¢',
- '�̓' => 'ῤ',
- '�̔' => 'ῥ',
- 'ῦ' => 'ῦ',
- 'ῧ' => 'ῧ',
- 'Ῠ' => 'Ῠ',
- 'Ῡ' => 'Ῡ',
- 'Ὺ' => 'Ὺ',
- 'Ῥ' => 'Ῥ',
- '῭' => 'á¿',
- 'ῲ' => 'ῲ',
- 'ῳ' => 'ῳ',
- 'ÏŽÍ…' => 'á¿´',
- 'ῶ' => 'ῶ',
- 'ῷ' => 'ῷ',
- 'Ὸ' => 'Ὸ',
- 'Ὼ' => 'Ὼ',
- 'ῼ' => 'ῼ',
- '�̸' => '↚',
- '↛' => '↛',
- '↮' => '↮',
- '�̸' => '�',
- '⇎' => '⇎',
- '⇏' => '�',
- '∄' => '∄',
- '∉' => '∉',
- '∌' => '∌',
- '∤' => '∤',
- '∦' => '∦',
- '≁' => '�',
- '≄' => '≄',
- '≇' => '≇',
- '≉' => '≉',
- '≠' => '≠',
- '≢' => '≢',
- 'â‰�̸' => 'â‰',
- '≮' => '≮',
- '≯' => '≯',
- '≰' => '≰',
- '≱' => '≱',
- '≴' => '≴',
- '≵' => '≵',
- '≸' => '≸',
- '≹' => '≹',
- '⊀' => '⊀',
- '⊁' => '�',
- '⊄' => '⊄',
- '⊅' => '⊅',
- '⊈' => '⊈',
- '⊉' => '⊉',
- '⊬' => '⊬',
- '⊭' => 'âŠ',
- '⊮' => '⊮',
- '⊯' => '⊯',
- '⋠' => '⋠',
- '⋡' => '⋡',
- '⋢' => '⋢',
- '⋣' => '⋣',
- '⋪' => '⋪',
- '⋫' => '⋫',
- '⋬' => '⋬',
- '⋭' => 'â‹',
- '�゙' => '�',
- '�゙' => '�',
- '�゙' => '�',
- '�゙' => '�',
- '�゙' => '�',
- '�゙' => '�',
- '�゙' => '�',
- '�゙' => '�',
- '�゙' => '�',
- '�゙' => '�',
- 'ã�Ÿã‚™' => 'ã� ',
- '�゙' => '�',
- '�゙' => '�',
- '�゙' => '�',
- '�゙' => '�',
- '�゙' => '�',
- '�゚' => '�',
- '�゙' => '�',
- '�゚' => '�',
- '�゙' => '�',
- '�゚' => '�',
- '�゙' => '�',
- '�゚' => '�',
- '�゙' => '�',
- '�゚' => '�',
- '�゙' => 'ゔ',
- '�゙' => 'ゞ',
- 'ガ' => 'ガ',
- 'ã‚ã‚™' => 'ã‚®',
- 'グ' => 'グ',
- 'ゲ' => 'ゲ',
- 'ゴ' => 'ゴ',
- 'ザ' => 'ザ',
- 'ジ' => 'ジ',
- 'ズ' => 'ズ',
- 'ゼ' => 'ゼ',
- 'ゾ' => 'ゾ',
- 'ダ' => 'ダ',
- '�゙' => 'ヂ',
- 'ヅ' => 'ヅ',
- 'デ' => 'デ',
- 'ド' => 'ド',
- '�゙' => '�',
- '�゚' => 'パ',
- 'ビ' => 'ビ',
- 'ピ' => 'ピ',
- 'ブ' => 'ブ',
- 'プ' => 'プ',
- 'ベ' => 'ベ',
- 'ペ' => 'ペ',
- 'ボ' => 'ボ',
- 'ポ' => '�',
- 'ヴ' => 'ヴ',
- 'ヷ' => 'ヷ',
- 'ヸ' => 'ヸ',
- 'ヹ' => 'ヹ',
- 'ヺ' => 'ヺ',
- 'ヾ' => 'ヾ',
- '𑂚' => '𑂚',
- '𑂜' => '𑂜',
- '𑂫' => '𑂫',
- '𑄮' => '𑄮',
- '𑄯' => '𑄯',
- '�𑌾' => '�',
- '��' => '�',
- '𑒻' => '𑒻',
- '𑒼' => '𑒼',
- '𑒾' => '𑒾',
- '𑖺' => '𑖺',
- '𑖻' => '𑖻',
- '𑤸' => '𑤸',
- );
- <?php
- return array (
- 'À' => 'À',
- '�' => 'A�',
- 'Â' => 'Â',
- 'Ã' => 'Ã',
- 'Ä' => 'Ä',
- 'Ã…' => 'AÌŠ',
- 'Ç' => 'Ç',
- 'È' => 'È',
- 'É' => 'E�',
- 'Ê' => 'Ê',
- 'Ë' => 'Ë',
- 'Ì' => 'Ì',
- '�' => 'I�',
- 'ÃŽ' => 'IÌ‚',
- '�' => 'Ï',
- 'Ñ' => 'Ñ',
- 'Ã’' => 'OÌ€',
- 'Ó' => 'O�',
- 'Ô' => 'Ô',
- 'Õ' => 'Õ',
- 'Ö' => 'Ö',
- 'Ù' => 'Ù',
- 'Ú' => 'U�',
- 'Û' => 'Û',
- 'Ü' => 'Ü',
- '�' => 'Y�',
- 'à ' => 'à',
- 'á' => 'a�',
- 'â' => 'â',
- 'ã' => 'ã',
- 'ä' => 'ä',
- 'Ã¥' => 'aÌŠ',
- 'ç' => 'ç',
- 'è' => 'è',
- 'é' => 'e�',
- 'ê' => 'ê',
- 'ë' => 'ë',
- 'ì' => 'ì',
- 'Ã' => 'iÌ�',
- 'î' => 'î',
- 'ï' => 'ï',
- 'ñ' => 'ñ',
- 'ò' => 'ò',
- 'ó' => 'o�',
- 'ô' => 'ô',
- 'õ' => 'õ',
- 'ö' => 'ö',
- 'ù' => 'ù',
- 'ú' => 'u�',
- 'û' => 'û',
- 'ü' => 'ü',
- 'ý' => 'y�',
- 'ÿ' => 'ÿ',
- 'Ä€' => 'AÌ„',
- '�' => 'ā',
- 'Ă' => 'Ă',
- 'ă' => 'ă',
- 'Ą' => 'Ą',
- 'ą' => 'ą',
- 'Ć' => 'C�',
- 'ć' => 'c�',
- 'Ĉ' => 'Ĉ',
- 'ĉ' => 'ĉ',
- 'Ċ' => 'Ċ',
- 'ċ' => 'ċ',
- 'Č' => 'Č',
- '�' => 'č',
- 'Ď' => 'Ď',
- '�' => 'ď',
- 'Ä’' => 'EÌ„',
- 'ē' => 'ē',
- 'Ĕ' => 'Ĕ',
- 'ĕ' => 'ĕ',
- 'Ė' => 'Ė',
- 'ė' => 'ė',
- 'Ę' => 'Ę',
- 'ę' => 'ę',
- 'Ě' => 'Ě',
- 'ě' => 'ě',
- 'Ĝ' => 'Ĝ',
- '�' => 'ĝ',
- 'Ğ' => 'Ğ',
- 'ğ' => 'ğ',
- 'Ä ' => 'Ġ',
- 'ġ' => 'ġ',
- 'Ģ' => 'Ģ',
- 'ģ' => 'ģ',
- 'Ĥ' => 'Ĥ',
- 'ĥ' => 'ĥ',
- 'Ĩ' => 'Ĩ',
- 'ĩ' => 'ĩ',
- 'Ī' => 'Ī',
- 'ī' => 'ī',
- 'Ĭ' => 'Ĭ',
- 'Ä' => 'ĭ',
- 'Į' => 'Į',
- 'į' => 'į',
- 'İ' => 'İ',
- 'Ä´' => 'JÌ‚',
- 'ĵ' => 'ĵ',
- 'Ķ' => 'Ķ',
- 'ķ' => 'ķ',
- 'Ĺ' => 'L�',
- 'ĺ' => 'l�',
- 'Ļ' => 'Ļ',
- 'ļ' => 'ļ',
- 'Ľ' => 'Ľ',
- 'ľ' => 'ľ',
- 'Ń' => 'N�',
- 'ń' => 'n�',
- 'Ņ' => 'Ņ',
- 'ņ' => 'ņ',
- 'Ň' => 'Ň',
- 'ň' => 'ň',
- 'Ō' => 'Ō',
- '�' => 'ō',
- 'Ŏ' => 'Ŏ',
- '�' => 'ŏ',
- '�' => 'Ő',
- 'ő' => 'ő',
- 'Ŕ' => 'R�',
- 'ŕ' => 'r�',
- 'Ŗ' => 'Ŗ',
- 'ŗ' => 'ŗ',
- 'Ř' => 'Ř',
- 'ř' => 'ř',
- 'Ś' => 'S�',
- 'ś' => 's�',
- 'Ŝ' => 'Ŝ',
- '�' => 'ŝ',
- 'Ş' => 'Ş',
- 'ş' => 'ş',
- 'Š' => 'Š',
- 'š' => 'š',
- 'Ţ' => 'Ţ',
- 'ţ' => 'ţ',
- 'Ť' => 'Ť',
- 'ť' => 'ť',
- 'Ũ' => 'Ũ',
- 'ũ' => 'ũ',
- 'Ū' => 'Ū',
- 'ū' => 'ū',
- 'Ŭ' => 'Ŭ',
- 'Å' => 'ŭ',
- 'Å®' => 'UÌŠ',
- 'ů' => 'ů',
- 'Å°' => 'UÌ‹',
- 'ű' => 'ű',
- 'Ų' => 'Ų',
- 'ų' => 'ų',
- 'Å´' => 'WÌ‚',
- 'ŵ' => 'ŵ',
- 'Ŷ' => 'Ŷ',
- 'ŷ' => 'ŷ',
- 'Ÿ' => 'Ÿ',
- 'Ź' => 'Z�',
- 'ź' => 'z�',
- 'Ż' => 'Ż',
- 'ż' => 'ż',
- 'Ž' => 'Ž',
- 'ž' => 'ž',
- 'Æ ' => 'OÌ›',
- 'Æ¡' => 'oÌ›',
- 'Ư' => 'Ư',
- 'Æ°' => 'uÌ›',
- '�' => 'Ǎ',
- 'ǎ' => 'ǎ',
- '�' => 'Ǐ',
- '�' => 'ǐ',
- 'Ǒ' => 'Ǒ',
- 'ǒ' => 'ǒ',
- 'Ǔ' => 'Ǔ',
- 'ǔ' => 'ǔ',
- 'Ǖ' => 'Ǖ',
- 'ǖ' => 'ǖ',
- 'Ǘ' => 'Ü�',
- 'ǘ' => 'ü�',
- 'Ǚ' => 'Ǚ',
- 'ǚ' => 'ǚ',
- 'Ǜ' => 'Ǜ',
- 'ǜ' => 'ǜ',
- 'Ǟ' => 'Ǟ',
- 'ǟ' => 'ǟ',
- 'Ç ' => 'Ǡ',
- 'ǡ' => 'ǡ',
- 'Ǣ' => 'Ǣ',
- 'ǣ' => 'ǣ',
- 'Ǧ' => 'Ǧ',
- 'ǧ' => 'ǧ',
- 'Ǩ' => 'Ǩ',
- 'ǩ' => 'ǩ',
- 'Ǫ' => 'Ǫ',
- 'ǫ' => 'ǫ',
- 'Ǭ' => 'Ǭ',
- 'Ç' => 'ǭ',
- 'Ǯ' => 'Ǯ',
- 'ǯ' => 'ǯ',
- 'ǰ' => 'ǰ',
- 'Ǵ' => 'G�',
- 'ǵ' => 'g�',
- 'Ǹ' => 'Ǹ',
- 'ǹ' => 'ǹ',
- 'Ǻ' => 'Å�',
- 'ǻ' => 'å�',
- 'Ǽ' => 'Æ�',
- 'ǽ' => 'æ�',
- 'Ǿ' => 'Ø�',
- 'ǿ' => 'ø�',
- 'Ȁ' => 'A�',
- '�' => 'a�',
- 'È‚' => 'AÌ‘',
- 'ȃ' => 'ȃ',
- 'Ȅ' => 'E�',
- 'ȅ' => 'e�',
- 'Ȇ' => 'Ȇ',
- 'ȇ' => 'ȇ',
- 'Ȉ' => 'I�',
- 'ȉ' => 'i�',
- 'ÈŠ' => 'IÌ‘',
- 'ȋ' => 'ȋ',
- 'Ȍ' => 'O�',
- '�' => 'o�',
- 'ÈŽ' => 'OÌ‘',
- '�' => 'ȏ',
- '�' => 'R�',
- 'ȑ' => 'r�',
- 'È’' => 'RÌ‘',
- 'ȓ' => 'ȓ',
- 'Ȕ' => 'U�',
- 'ȕ' => 'u�',
- 'È–' => 'UÌ‘',
- 'ȗ' => 'ȗ',
- 'Ș' => 'Ș',
- 'ș' => 'ș',
- 'Ț' => 'Ț',
- 'ț' => 'ț',
- 'Ȟ' => 'Ȟ',
- 'ȟ' => 'ȟ',
- 'Ȧ' => 'Ȧ',
- 'ȧ' => 'ȧ',
- 'Ȩ' => 'Ȩ',
- 'ȩ' => 'ȩ',
- 'Ȫ' => 'Ȫ',
- 'ȫ' => 'ȫ',
- 'Ȭ' => 'Ȭ',
- 'È' => 'ȭ',
- 'Ȯ' => 'Ȯ',
- 'ȯ' => 'ȯ',
- 'Ȱ' => 'Ȱ',
- 'ȱ' => 'ȱ',
- 'Ȳ' => 'Ȳ',
- 'ȳ' => 'ȳ',
- 'Í€' => 'Ì€',
- '�' => '�',
- '̓' => '̓',
- '̈́' => '̈�',
- 'ʹ' => 'ʹ',
- ';' => ';',
- '΅' => '¨�',
- 'Ά' => 'Α�',
- '·' => '·',
- 'Έ' => 'Ε�',
- 'Ή' => 'Η�',
- 'Ί' => 'Ι�',
- 'Ό' => 'Ο�',
- 'Ύ' => 'Υ�',
- '�' => 'Ω�',
- '�' => 'ϊ�',
- 'Ϊ' => 'Ϊ',
- 'Ϋ' => 'Ϋ',
- 'ά' => 'α�',
- 'Î' => 'εÌ�',
- 'ή' => 'η�',
- 'ί' => 'ι�',
- 'ΰ' => 'ϋ�',
- 'ϊ' => 'ϊ',
- 'ϋ' => 'ϋ',
- 'ό' => 'ο�',
- '�' => 'υ�',
- 'ώ' => 'ω�',
- 'ϓ' => 'ϒ�',
- 'ϔ' => 'ϔ',
- 'Ѐ' => 'Ѐ',
- '�' => 'Ё',
- 'Ѓ' => 'Г�',
- 'Ї' => 'Ї',
- 'Ќ' => 'К�',
- '�' => 'Ѝ',
- 'Ў' => 'Ў',
- 'Й' => 'Й',
- 'й' => 'й',
- '�' => 'ѐ',
- 'ё' => 'ё',
- 'ѓ' => 'г�',
- 'ї' => 'ї',
- 'ќ' => 'к�',
- '�' => 'ѝ',
- 'ў' => 'ў',
- 'Ѷ' => 'Ѵ�',
- 'ѷ' => 'ѵ�',
- '�' => 'Ӂ',
- 'ӂ' => 'ӂ',
- '�' => '�̆',
- 'ӑ' => 'ӑ',
- 'Ӓ' => '�̈',
- 'ӓ' => 'ӓ',
- 'Ӗ' => 'Ӗ',
- 'ӗ' => 'ӗ',
- 'Ӛ' => 'Ӛ',
- 'ӛ' => 'ӛ',
- 'Ӝ' => 'Ӝ',
- '�' => 'ӝ',
- 'Ӟ' => 'Ӟ',
- 'ӟ' => 'ӟ',
- 'Ӣ' => 'Ӣ',
- 'ӣ' => 'ӣ',
- 'Ӥ' => 'Ӥ',
- 'ӥ' => 'ӥ',
- 'Ӧ' => 'Ӧ',
- 'ӧ' => 'ӧ',
- 'Ӫ' => 'Ӫ',
- 'ӫ' => 'ӫ',
- 'Ó¬' => 'Ð̈',
- 'Ó' => 'Ñ�̈',
- 'Ӯ' => 'Ӯ',
- 'ӯ' => 'ӯ',
- 'Ӱ' => 'Ӱ',
- 'ӱ' => 'ӱ',
- 'Ӳ' => 'Ӳ',
- 'ӳ' => 'ӳ',
- 'Ӵ' => 'Ӵ',
- 'ӵ' => 'ӵ',
- 'Ӹ' => 'Ӹ',
- 'ӹ' => 'ӹ',
- 'آ' => 'آ',
- 'أ' => 'أ',
- 'ؤ' => 'ؤ',
- 'إ' => 'إ',
- 'ئ' => 'ئ',
- 'Û€' => 'Û•Ù”',
- 'Û‚' => 'Û�Ù”',
- 'Û“' => 'Û’Ù”',
- 'ऩ' => 'ऩ',
- 'ऱ' => 'ऱ',
- 'ऴ' => 'ऴ',
- 'क़' => 'क़',
- 'ख़' => 'ख़',
- 'ग़' => 'ग़',
- 'ज़' => 'ज़',
- 'ड़' => 'ड़',
- '�' => 'ढ़',
- 'फ़' => 'फ़',
- 'य़' => 'य़',
- 'ো' => 'ো',
- 'ৌ' => 'ৌ',
- 'ড়' => 'ড়',
- '�' => 'ঢ়',
- 'য়' => 'য়',
- 'ਲ਼' => 'ਲ਼',
- 'ਸ਼' => 'ਸ਼',
- 'ਖ਼' => 'ਖ਼',
- 'ਗ਼' => 'ਗ਼',
- 'ਜ਼' => 'ਜ਼',
- 'ਫ਼' => 'ਫ਼',
- 'àˆ' => 'à‡à–',
- 'à‹' => 'à‡à¬¾',
- 'àŒ' => 'à‡à—',
- 'àœ' => 'ଡ଼',
- 'à�' => 'ଢ଼',
- 'ஔ' => 'ஔ',
- 'ொ' => 'ொ',
- 'ோ' => 'ோ',
- 'ௌ' => 'ௌ',
- 'ై' => 'ై',
- 'ೀ' => 'ೀ',
- 'ೇ' => 'ೇ',
- 'ೈ' => 'ೈ',
- 'ೊ' => 'ೊ',
- 'ೋ' => 'ೋ',
- 'ൊ' => 'ൊ',
- 'ോ' => 'ോ',
- 'ൌ' => 'ൌ',
- 'ේ' => 'ේ',
- 'ො' => 'ෙ�',
- '�' => 'ෙ�්',
- 'ෞ' => 'ෞ',
- 'གྷ' => 'གྷ',
- '�' => 'ཌྷ',
- 'དྷ' => 'དྷ',
- 'བྷ' => 'བྷ',
- 'ཛྷ' => 'ཛྷ',
- 'ཀྵ' => 'ཀྵ',
- 'ཱི' => 'ཱི',
- 'ཱུ' => 'ཱུ',
- 'ྲྀ' => 'ྲྀ',
- 'ླྀ' => 'ླྀ',
- '�' => 'ཱྀ',
- 'ྒྷ' => 'ྒྷ',
- '�' => 'ྜྷ',
- 'ྡྷ' => 'ྡྷ',
- 'ྦྷ' => 'ྦྷ',
- 'ྫྷ' => 'ྫྷ',
- 'ྐྵ' => '�ྵ',
- 'ဦ' => 'ဦ',
- 'ᬆ' => 'ᬆ',
- 'ᬈ' => 'ᬈ',
- 'ᬊ' => 'ᬊ',
- 'ᬌ' => 'ᬌ',
- 'ᬎ' => '�ᬵ',
- 'ᬒ' => 'ᬒ',
- 'ᬻ' => 'ᬻ',
- 'ᬽ' => 'ᬽ',
- 'á€' => 'ᭀ',
- 'á�' => 'ᭁ',
- 'áƒ' => 'á‚ᬵ',
- 'Ḁ' => 'Ḁ',
- '�' => 'ḁ',
- 'Ḃ' => 'Ḃ',
- 'ḃ' => 'ḃ',
- 'Ḅ' => 'Ḅ',
- 'ḅ' => 'ḅ',
- 'Ḇ' => 'Ḇ',
- 'ḇ' => 'ḇ',
- 'Ḉ' => 'Ç�',
- 'ḉ' => 'ç�',
- 'Ḋ' => 'Ḋ',
- 'ḋ' => 'ḋ',
- 'Ḍ' => 'Ḍ',
- '�' => 'ḍ',
- 'Ḏ' => 'Ḏ',
- '�' => 'ḏ',
- '�' => 'Ḑ',
- 'ḑ' => 'ḑ',
- 'Ḓ' => 'DÌ',
- 'ḓ' => 'dÌ',
- 'Ḕ' => 'Ḕ',
- 'ḕ' => 'ḕ',
- 'Ḗ' => 'Ē�',
- 'ḗ' => 'ē�',
- 'Ḙ' => 'EÌ',
- 'ḙ' => 'eÌ',
- 'Ḛ' => 'Ḛ',
- 'ḛ' => 'ḛ',
- 'Ḝ' => 'Ḝ',
- '�' => 'ḝ',
- 'Ḟ' => 'Ḟ',
- 'ḟ' => 'ḟ',
- 'Ḡ' => 'Ḡ',
- 'ḡ' => 'ḡ',
- 'Ḣ' => 'Ḣ',
- 'ḣ' => 'ḣ',
- 'Ḥ' => 'Ḥ',
- 'ḥ' => 'ḥ',
- 'Ḧ' => 'Ḧ',
- 'ḧ' => 'ḧ',
- 'Ḩ' => 'Ḩ',
- 'ḩ' => 'ḩ',
- 'Ḫ' => 'Ḫ',
- 'ḫ' => 'ḫ',
- 'Ḭ' => 'Ḭ',
- 'á¸' => 'iÌ°',
- 'Ḯ' => 'Ï�',
- 'ḯ' => 'ï�',
- 'Ḱ' => 'K�',
- 'ḱ' => 'k�',
- 'Ḳ' => 'Ḳ',
- 'ḳ' => 'ḳ',
- 'Ḵ' => 'Ḵ',
- 'ḵ' => 'ḵ',
- 'Ḷ' => 'Ḷ',
- 'ḷ' => 'ḷ',
- 'Ḹ' => 'Ḹ',
- 'ḹ' => 'ḹ',
- 'Ḻ' => 'Ḻ',
- 'ḻ' => 'ḻ',
- 'Ḽ' => 'LÌ',
- 'ḽ' => 'lÌ',
- 'Ḿ' => 'M�',
- 'ḿ' => 'm�',
- 'Ṁ' => 'Ṁ',
- '�' => 'ṁ',
- 'Ṃ' => 'Ṃ',
- 'ṃ' => 'ṃ',
- 'Ṅ' => 'Ṅ',
- 'ṅ' => 'ṅ',
- 'Ṇ' => 'Ṇ',
- 'ṇ' => 'ṇ',
- 'Ṉ' => 'Ṉ',
- 'ṉ' => 'ṉ',
- 'Ṋ' => 'NÌ',
- 'ṋ' => 'nÌ',
- 'Ṍ' => 'Õ�',
- '�' => 'õ�',
- 'Ṏ' => 'Ṏ',
- '�' => 'ṏ',
- '�' => 'Ṑ',
- 'ṑ' => 'ṑ',
- 'Ṓ' => 'Ō�',
- 'ṓ' => 'ō�',
- 'Ṕ' => 'P�',
- 'ṕ' => 'p�',
- 'Ṗ' => 'Ṗ',
- 'ṗ' => 'ṗ',
- 'Ṙ' => 'Ṙ',
- 'ṙ' => 'ṙ',
- 'Ṛ' => 'Ṛ',
- 'ṛ' => 'ṛ',
- 'Ṝ' => 'Ṝ',
- '�' => 'ṝ',
- 'Ṟ' => 'Ṟ',
- 'ṟ' => 'ṟ',
- 'Ṡ' => 'Ṡ',
- 'ṡ' => 'ṡ',
- 'á¹¢' => 'SÌ£',
- 'ṣ' => 'ṣ',
- 'Ṥ' => 'S�̇',
- 'ṥ' => 's�̇',
- 'Ṧ' => 'Ṧ',
- 'ṧ' => 'ṧ',
- 'Ṩ' => 'Ṩ',
- 'ṩ' => 'ṩ',
- 'Ṫ' => 'Ṫ',
- 'ṫ' => 'ṫ',
- 'Ṭ' => 'Ṭ',
- 'á¹' => 'tÌ£',
- 'Ṯ' => 'Ṯ',
- 'ṯ' => 'ṯ',
- 'á¹°' => 'TÌ',
- 'á¹±' => 'tÌ',
- 'Ṳ' => 'Ṳ',
- 'ṳ' => 'ṳ',
- 'á¹´' => 'UÌ°',
- 'á¹µ' => 'uÌ°',
- 'Ṷ' => 'UÌ',
- 'á¹·' => 'uÌ',
- 'Ṹ' => 'Ũ�',
- 'ṹ' => 'ũ�',
- 'Ṻ' => 'Ṻ',
- 'ṻ' => 'ṻ',
- 'Ṽ' => 'Ṽ',
- 'ṽ' => 'ṽ',
- 'á¹¾' => 'VÌ£',
- 'ṿ' => 'ṿ',
- 'Ẁ' => 'Ẁ',
- '�' => 'ẁ',
- 'Ẃ' => 'W�',
- 'ẃ' => 'w�',
- 'Ẅ' => 'Ẅ',
- 'ẅ' => 'ẅ',
- 'Ẇ' => 'Ẇ',
- 'ẇ' => 'ẇ',
- 'Ẉ' => 'Ẉ',
- 'ẉ' => 'ẉ',
- 'Ẋ' => 'Ẋ',
- 'ẋ' => 'ẋ',
- 'Ẍ' => 'Ẍ',
- '�' => 'ẍ',
- 'Ẏ' => 'Ẏ',
- '�' => 'ẏ',
- '�' => 'Ẑ',
- 'ẑ' => 'ẑ',
- 'Ẓ' => 'Ẓ',
- 'ẓ' => 'ẓ',
- 'Ẕ' => 'Ẕ',
- 'ẕ' => 'ẕ',
- 'ẖ' => 'ẖ',
- 'ẗ' => 'ẗ',
- 'ẘ' => 'ẘ',
- 'ẙ' => 'ẙ',
- 'ẛ' => 'ẛ',
- 'Ạ' => 'Ạ',
- 'ạ' => 'ạ',
- 'Ả' => 'Ả',
- 'ả' => 'ả',
- 'Ấ' => 'Â�',
- 'ấ' => 'â�',
- 'Ầ' => 'Ầ',
- 'ầ' => 'ầ',
- 'Ẩ' => 'Ẩ',
- 'ẩ' => 'ẩ',
- 'Ẫ' => 'Ẫ',
- 'ẫ' => 'ẫ',
- 'Ậ' => 'Ậ',
- 'áº' => 'ậ',
- 'Ắ' => 'Ă�',
- 'ắ' => 'ă�',
- 'Ằ' => 'Ằ',
- 'ằ' => 'ằ',
- 'Ẳ' => 'Ẳ',
- 'ẳ' => 'ẳ',
- 'Ẵ' => 'Ẵ',
- 'ẵ' => 'ẵ',
- 'Ặ' => 'Ặ',
- 'ặ' => 'ặ',
- 'Ẹ' => 'Ẹ',
- 'ẹ' => 'ẹ',
- 'Ẻ' => 'Ẻ',
- 'ẻ' => 'ẻ',
- 'Ẽ' => 'Ẽ',
- 'ẽ' => 'ẽ',
- 'Ế' => 'Ê�',
- 'ế' => 'ê�',
- 'Ề' => 'Ề',
- '�' => 'ề',
- 'Ể' => 'Ể',
- 'ể' => 'ể',
- 'Ễ' => 'Ễ',
- 'ễ' => 'ễ',
- 'Ệ' => 'Ệ',
- 'ệ' => 'ệ',
- 'Ỉ' => 'Ỉ',
- 'ỉ' => 'ỉ',
- 'Ị' => 'Ị',
- 'ị' => 'ị',
- 'Ọ' => 'Ọ',
- '�' => 'ọ',
- 'Ỏ' => 'Ỏ',
- '�' => 'ỏ',
- '�' => 'Ô�',
- 'ố' => 'ô�',
- 'á»’' => 'OÌ‚Ì€',
- 'ồ' => 'ồ',
- 'Ổ' => 'Ổ',
- 'ổ' => 'ổ',
- 'Ỗ' => 'Ỗ',
- 'ỗ' => 'ỗ',
- 'Ộ' => 'Ộ',
- 'ộ' => 'ộ',
- 'Ớ' => 'Ơ�',
- 'ớ' => 'ơ�',
- 'Ờ' => 'Ờ',
- '�' => 'ờ',
- 'Ở' => 'Ở',
- 'ở' => 'ở',
- 'Ỡ' => 'Ỡ',
- 'ỡ' => 'ỡ',
- 'Ợ' => 'Ợ',
- 'ợ' => 'ợ',
- 'Ụ' => 'Ụ',
- 'ụ' => 'ụ',
- 'Ủ' => 'Ủ',
- 'ủ' => 'ủ',
- 'Ứ' => 'Ư�',
- 'ứ' => 'ư�',
- 'Ừ' => 'Ừ',
- 'ừ' => 'ừ',
- 'Ử' => 'Ử',
- 'á»' => 'ử',
- 'Ữ' => 'Ữ',
- 'ữ' => 'ữ',
- 'Ự' => 'Ự',
- 'ự' => 'ự',
- 'Ỳ' => 'Ỳ',
- 'ỳ' => 'ỳ',
- 'á»´' => 'YÌ£',
- 'ỵ' => 'ỵ',
- 'Ỷ' => 'Ỷ',
- 'ỷ' => 'ỷ',
- 'Ỹ' => 'Ỹ',
- 'ỹ' => 'ỹ',
- 'ἀ' => 'ἀ',
- '�' => 'ἁ',
- 'ἂ' => 'ἂ',
- 'ἃ' => 'ἃ',
- 'ἄ' => 'ἀ�',
- 'ἅ' => 'ἁ�',
- 'ἆ' => 'ἆ',
- 'ἇ' => 'ἇ',
- 'Ἀ' => 'Ἀ',
- 'Ἁ' => 'Ἁ',
- 'Ἂ' => 'Ἂ',
- 'Ἃ' => 'Ἃ',
- 'Ἄ' => 'Ἀ�',
- '�' => 'Ἁ�',
- 'Ἆ' => 'Ἆ',
- '�' => 'Ἇ',
- '�' => 'ἐ',
- 'ἑ' => 'ἑ',
- 'ἒ' => 'ἒ',
- 'ἓ' => 'ἓ',
- 'ἔ' => 'ἐ�',
- 'ἕ' => 'ἑ�',
- 'Ἐ' => 'Ἐ',
- 'Ἑ' => 'Ἑ',
- 'Ἒ' => 'Ἒ',
- 'Ἓ' => 'Ἓ',
- 'Ἔ' => 'Ἐ�',
- '�' => 'Ἑ�',
- 'ἠ' => 'ἠ',
- 'ἡ' => 'ἡ',
- 'ἢ' => 'ἢ',
- 'ἣ' => 'ἣ',
- 'ἤ' => 'ἠ�',
- 'ἥ' => 'ἡ�',
- 'ἦ' => 'ἦ',
- 'ἧ' => 'ἧ',
- 'Ἠ' => 'Ἠ',
- 'Ἡ' => 'Ἡ',
- 'Ἢ' => 'Ἢ',
- 'Ἣ' => 'Ἣ',
- 'Ἤ' => 'Ἠ�',
- 'á¼' => 'ἩÌ�',
- 'Ἦ' => 'Ἦ',
- 'Ἧ' => 'Ἧ',
- 'ἰ' => 'ἰ',
- 'ἱ' => 'ἱ',
- 'ἲ' => 'ἲ',
- 'ἳ' => 'ἳ',
- 'ἴ' => 'ἰ�',
- 'ἵ' => 'ἱ�',
- 'ἶ' => 'ἶ',
- 'ἷ' => 'ἷ',
- 'Ἰ' => 'Ἰ',
- 'Ἱ' => 'Ἱ',
- 'Ἲ' => 'Ἲ',
- 'Ἳ' => 'Ἳ',
- 'Ἴ' => 'Ἰ�',
- 'Ἵ' => 'Ἱ�',
- 'Ἶ' => 'Ἶ',
- 'Ἷ' => 'Ἷ',
- 'ὀ' => 'ὀ',
- '�' => 'ὁ',
- 'ὂ' => 'ὂ',
- 'ὃ' => 'ὃ',
- 'ὄ' => 'ὀ�',
- 'ὅ' => 'ὁ�',
- 'Ὀ' => 'Ὀ',
- 'Ὁ' => 'Ὁ',
- 'Ὂ' => 'Ὂ',
- 'Ὃ' => 'Ὃ',
- 'Ὄ' => 'Ὀ�',
- '�' => 'Ὁ�',
- '�' => 'ὐ',
- 'ὑ' => 'ὑ',
- 'á½’' => 'Ï…Ì“Ì€',
- 'ὓ' => 'ὓ',
- 'ὔ' => 'ὐ�',
- 'ὕ' => 'ὑ�',
- 'á½–' => 'Ï…Ì“Í‚',
- 'ὗ' => 'ὗ',
- 'Ὑ' => 'Ὑ',
- 'Ὓ' => 'Ὓ',
- '�' => 'Ὑ�',
- 'Ὗ' => 'Ὗ',
- 'ὠ' => 'ὠ',
- 'ὡ' => 'ὡ',
- 'ὢ' => 'ὢ',
- 'ὣ' => 'ὣ',
- 'ὤ' => 'ὠ�',
- 'ὥ' => 'ὡ�',
- 'ὦ' => 'ὦ',
- 'ὧ' => 'ὧ',
- 'Ὠ' => 'Ὠ',
- 'Ὡ' => 'Ὡ',
- 'Ὢ' => 'Ὢ',
- 'Ὣ' => 'Ὣ',
- 'Ὤ' => 'Ὠ�',
- 'á½' => 'ὩÌ�',
- 'Ὦ' => 'Ὦ',
- 'Ὧ' => 'Ὧ',
- 'ὰ' => 'ὰ',
- 'ά' => 'α�',
- 'ὲ' => 'ὲ',
- 'έ' => 'ε�',
- 'ὴ' => 'ὴ',
- 'ή' => 'η�',
- 'ὶ' => 'ὶ',
- 'ί' => 'ι�',
- 'ὸ' => 'ὸ',
- 'ό' => 'ο�',
- 'ὺ' => 'ὺ',
- 'ύ' => 'υ�',
- 'ὼ' => 'ὼ',
- 'ώ' => 'ω�',
- 'ᾀ' => 'ᾀ',
- '�' => 'ᾁ',
- 'ᾂ' => 'ᾂ',
- 'ᾃ' => 'ᾃ',
- 'ᾄ' => 'ἀ�ͅ',
- 'ᾅ' => 'ἁ�ͅ',
- 'ᾆ' => 'ᾆ',
- 'ᾇ' => 'ᾇ',
- 'ᾈ' => 'ᾈ',
- 'ᾉ' => 'ᾉ',
- 'ᾊ' => 'ᾊ',
- 'ᾋ' => 'ᾋ',
- 'ᾌ' => 'Ἀ�ͅ',
- '�' => 'Ἁ�ͅ',
- 'ᾎ' => 'ᾎ',
- '�' => 'ᾏ',
- '�' => 'ᾐ',
- 'ᾑ' => 'ᾑ',
- 'ᾒ' => 'ᾒ',
- 'ᾓ' => 'ᾓ',
- 'ᾔ' => 'ἠ�ͅ',
- 'ᾕ' => 'ἡ�ͅ',
- 'ᾖ' => 'ᾖ',
- 'ᾗ' => 'ᾗ',
- 'ᾘ' => 'ᾘ',
- 'ᾙ' => 'ᾙ',
- 'ᾚ' => 'ᾚ',
- 'ᾛ' => 'ᾛ',
- 'ᾜ' => 'Ἠ�ͅ',
- '�' => 'Ἡ�ͅ',
- 'ᾞ' => 'ᾞ',
- 'ᾟ' => 'ᾟ',
- 'ᾠ' => 'ᾠ',
- 'ᾡ' => 'ᾡ',
- 'ᾢ' => 'ᾢ',
- 'ᾣ' => 'ᾣ',
- 'ᾤ' => 'ὠ�ͅ',
- 'ᾥ' => 'ὡ�ͅ',
- 'ᾦ' => 'ᾦ',
- 'ᾧ' => 'ᾧ',
- 'ᾨ' => 'ᾨ',
- 'ᾩ' => 'ᾩ',
- 'ᾪ' => 'ᾪ',
- 'ᾫ' => 'ᾫ',
- 'ᾬ' => 'Ὠ�ͅ',
- 'á¾' => 'ὩÌ�Í…',
- 'ᾮ' => 'ᾮ',
- 'ᾯ' => 'ᾯ',
- 'ᾰ' => 'ᾰ',
- 'ᾱ' => 'ᾱ',
- 'ᾲ' => 'ᾲ',
- 'ᾳ' => 'ᾳ',
- 'ᾴ' => 'α�ͅ',
- 'ᾶ' => 'ᾶ',
- 'ᾷ' => 'ᾷ',
- 'Ᾰ' => 'Ᾰ',
- 'Ᾱ' => 'Ᾱ',
- 'Ὰ' => 'Ὰ',
- 'Ά' => 'Α�',
- 'ᾼ' => 'ᾼ',
- 'ι' => 'ι',
- '�' => '῁',
- 'ῂ' => 'ῂ',
- 'ῃ' => 'ῃ',
- 'ῄ' => 'η�ͅ',
- 'ῆ' => 'ῆ',
- 'ῇ' => 'ῇ',
- 'Ὲ' => 'Ὲ',
- 'Έ' => 'Ε�',
- 'Ὴ' => 'Ὴ',
- 'Ή' => 'Η�',
- 'ῌ' => 'ῌ',
- '�' => '῍',
- '῎' => '᾿�',
- '�' => '῏',
- '�' => 'ῐ',
- 'ῑ' => 'ῑ',
- 'ῒ' => 'ῒ',
- 'ΐ' => 'ϊ�',
- 'ῖ' => 'ῖ',
- 'ῗ' => 'ῗ',
- 'Ῐ' => 'Ῐ',
- 'Ῑ' => 'Ῑ',
- 'Ὶ' => 'Ὶ',
- 'Ί' => 'Ι�',
- '�' => '῝',
- '῞' => '῾�',
- '῟' => '῟',
- 'ῠ' => 'ῠ',
- 'á¿¡' => 'Ï…Ì„',
- 'ῢ' => 'ῢ',
- 'ΰ' => 'ϋ�',
- 'ῤ' => '�̓',
- 'ῥ' => '�̔',
- 'ῦ' => 'ῦ',
- 'ῧ' => 'ῧ',
- 'Ῠ' => 'Ῠ',
- 'Ῡ' => 'Ῡ',
- 'Ὺ' => 'Ὺ',
- 'Ύ' => 'Υ�',
- 'Ῥ' => 'Ῥ',
- 'á¿' => '῭',
- '΅' => '¨�',
- '`' => '`',
- 'ῲ' => 'ῲ',
- 'ῳ' => 'ῳ',
- 'ῴ' => 'ω�ͅ',
- 'ῶ' => 'ῶ',
- 'ῷ' => 'ῷ',
- 'Ὸ' => 'Ὸ',
- 'Ό' => 'Ο�',
- 'Ὼ' => 'Ὼ',
- 'Ώ' => 'Ω�',
- 'ῼ' => 'ῼ',
- '´' => '´',
- ' ' => ' ',
- '�' => ' ',
- 'Ω' => 'Ω',
- 'K' => 'K',
- 'â„«' => 'AÌŠ',
- '↚' => '�̸',
- '↛' => '↛',
- '↮' => '↮',
- '�' => '�̸',
- '⇎' => '⇎',
- '�' => '⇏',
- '∄' => '∄',
- '∉' => '∉',
- '∌' => '∌',
- '∤' => '∤',
- '∦' => '∦',
- '�' => '≁',
- '≄' => '≄',
- '≇' => '≇',
- '≉' => '≉',
- '≠' => '≠',
- '≢' => '≢',
- 'â‰' => 'â‰�̸',
- '≮' => '≮',
- '≯' => '≯',
- '≰' => '≰',
- '≱' => '≱',
- '≴' => '≴',
- '≵' => '≵',
- '≸' => '≸',
- '≹' => '≹',
- '⊀' => '⊀',
- '�' => '⊁',
- '⊄' => '⊄',
- '⊅' => '⊅',
- '⊈' => '⊈',
- '⊉' => '⊉',
- '⊬' => '⊬',
- 'âŠ' => '⊭',
- '⊮' => '⊮',
- '⊯' => '⊯',
- '⋠' => '⋠',
- '⋡' => '⋡',
- '⋢' => '⋢',
- '⋣' => '⋣',
- '⋪' => '⋪',
- '⋫' => '⋫',
- '⋬' => '⋬',
- 'â‹' => '⋭',
- '〈' => '〈',
- '〉' => '〉',
- '⫝̸' => '�̸',
- '�' => '�゙',
- '�' => '�゙',
- '�' => '�゙',
- '�' => '�゙',
- '�' => '�゙',
- '�' => '�゙',
- '�' => '�゙',
- '�' => '�゙',
- '�' => '�゙',
- '�' => '�゙',
- 'ã� ' => 'ã�Ÿã‚™',
- '�' => '�゙',
- '�' => '�゙',
- '�' => '�゙',
- '�' => '�゙',
- '�' => '�゙',
- '�' => '�゚',
- '�' => '�゙',
- '�' => '�゚',
- '�' => '�゙',
- '�' => '�゚',
- '�' => '�゙',
- '�' => '�゚',
- '�' => '�゙',
- '�' => '�゚',
- 'ゔ' => '�゙',
- 'ゞ' => '�゙',
- 'ガ' => 'ガ',
- 'ã‚®' => 'ã‚ã‚™',
- 'グ' => 'グ',
- 'ゲ' => 'ゲ',
- 'ゴ' => 'ゴ',
- 'ザ' => 'ザ',
- 'ジ' => 'ジ',
- 'ズ' => 'ズ',
- 'ゼ' => 'ゼ',
- 'ゾ' => 'ゾ',
- 'ダ' => 'ダ',
- 'ヂ' => '�゙',
- 'ヅ' => 'ヅ',
- 'デ' => 'デ',
- 'ド' => 'ド',
- '�' => '�゙',
- 'パ' => '�゚',
- 'ビ' => 'ビ',
- 'ピ' => 'ピ',
- 'ブ' => 'ブ',
- 'プ' => 'プ',
- 'ベ' => 'ベ',
- 'ペ' => 'ペ',
- 'ボ' => 'ボ',
- '�' => 'ポ',
- 'ヴ' => 'ヴ',
- 'ヷ' => 'ヷ',
- 'ヸ' => 'ヸ',
- 'ヹ' => 'ヹ',
- 'ヺ' => 'ヺ',
- 'ヾ' => 'ヾ',
- '豈' => '豈',
- '�' => '更',
- '車' => '車',
- '賈' => '賈',
- '滑' => '滑',
- '串' => '串',
- '句' => '�',
- '龜' => '龜',
- '龜' => '龜',
- '契' => '契',
- '金' => '金',
- '喇' => '喇',
- '奈' => '奈',
- '�' => '懶',
- '癩' => '癩',
- '�' => '羅',
- '�' => '蘿',
- '螺' => '螺',
- '裸' => '裸',
- '邏' => '�',
- '樂' => '樂',
- '洛' => '洛',
- '烙' => '烙',
- '珞' => '�',
- '落' => '�',
- '酪' => '酪',
- '駱' => '駱',
- '亂' => '亂',
- '卵' => '�',
- '�' => '欄',
- '爛' => '爛',
- '蘭' => 'è˜',
- 'ï¤ ' => '鸞',
- '嵐' => '�',
- '濫' => '濫',
- '藍' => '�',
- '襤' => '襤',
- '拉' => '拉',
- '臘' => '臘',
- '蠟' => 'è Ÿ',
- '廊' => '廊',
- '朗' => '朗',
- '浪' => '浪',
- '狼' => '狼',
- '郎' => '郎',
- 'ï¤' => '來',
- '冷' => '冷',
- '勞' => '勞',
- '擄' => '擄',
- '櫓' => '櫓',
- '爐' => '�',
- '盧' => '盧',
- '老' => '�',
- '蘆' => '蘆',
- '虜' => '虜',
- '路' => '路',
- '露' => '露',
- '魯' => 'é¯',
- '鷺' => '鷺',
- '碌' => '碌',
- '祿' => '祿',
- '綠' => 'ç¶ ',
- '菉' => '�',
- '錄' => '錄',
- '鹿' => '鹿',
- '�' => '論',
- '壟' => '壟',
- '弄' => '弄',
- '籠' => 'ç± ',
- '聾' => '�',
- '牢' => '牢',
- '磊' => '磊',
- '賂' => '賂',
- '雷' => '雷',
- '壘' => '壘',
- '屢' => '屢',
- '樓' => '樓',
- '�' => '淚',
- '漏' => '�',
- '�' => '累',
- '�' => '縷',
- '陋' => '陋',
- '勒' => '勒',
- '肋' => '肋',
- '凜' => '凜',
- '凌' => '凌',
- '稜' => '稜',
- '綾' => '綾',
- '菱' => '�',
- '陵' => '陵',
- '讀' => '讀',
- '拏' => '�',
- '樂' => '樂',
- '�' => '諾',
- '丹' => '丹',
- '寧' => '寧',
- 'ï¥ ' => '怒',
- '率' => '率',
- '異' => '異',
- '北' => '北',
- '磻' => '磻',
- '便' => '便',
- '復' => '復',
- '不' => '�',
- '泌' => '泌',
- '數' => '數',
- '索' => '索',
- '參' => '�',
- '塞' => '塞',
- 'ï¥' => 'çœ�',
- '葉' => '葉',
- '說' => '說',
- '殺' => '殺',
- '辰' => '辰',
- '沈' => '沈',
- '拾' => '拾',
- '若' => '若',
- '掠' => 'æŽ ',
- '略' => '略',
- '亮' => '亮',
- '兩' => '兩',
- '凉' => '凉',
- '梁' => '�',
- '糧' => '糧',
- '良' => '良',
- '諒' => '諒',
- '量' => '�',
- '勵' => '勵',
- '呂' => '呂',
- '�' => '女',
- '廬' => '廬',
- '旅' => '旅',
- '濾' => '濾',
- '礪' => '礪',
- '閭' => 'é–',
- '驪' => '驪',
- '麗' => '麗',
- '黎' => '黎',
- '力' => '力',
- '曆' => '曆',
- '歷' => 'æ·',
- '�' => '轢',
- '年' => '年',
- '�' => '�',
- '�' => '戀',
- '撚' => '撚',
- '漣' => '漣',
- '煉' => '煉',
- '璉' => '璉',
- '秊' => '秊',
- '練' => '練',
- '聯' => '�',
- '輦' => '輦',
- '蓮' => '蓮',
- '連' => '連',
- '鍊' => '�',
- '列' => '列',
- '�' => '劣',
- '咽' => '咽',
- '烈' => '烈',
- 'ï¦ ' => '裂',
- '說' => '說',
- '廉' => '廉',
- '念' => '念',
- '捻' => '�',
- '殮' => '殮',
- '簾' => '簾',
- '獵' => '�',
- '令' => '令',
- '囹' => '囹',
- '寧' => '寧',
- '嶺' => '嶺',
- '怜' => '怜',
- 'ï¦' => '玲',
- '瑩' => '瑩',
- '羚' => '羚',
- '聆' => '�',
- '鈴' => '鈴',
- '零' => '零',
- '靈' => '�',
- '領' => 'é ˜',
- '例' => '例',
- '禮' => '禮',
- '醴' => '醴',
- '隸' => '隸',
- '惡' => '惡',
- '了' => '了',
- '僚' => '僚',
- '寮' => '寮',
- '尿' => '尿',
- '料' => '料',
- '樂' => '樂',
- '燎' => '燎',
- '�' => '療',
- '蓼' => '蓼',
- '遼' => '�',
- '龍' => '�',
- '暈' => '暈',
- '阮' => '阮',
- '劉' => '劉',
- '杻' => '�',
- '柳' => '柳',
- '流' => '�',
- '溜' => '溜',
- '琉' => '�',
- '�' => '留',
- '硫' => '硫',
- '�' => '�',
- '�' => '類',
- '六' => 'å…',
- '戮' => '戮',
- '陸' => '陸',
- '倫' => '倫',
- '崙' => '崙',
- '淪' => '淪',
- '輪' => '輪',
- '律' => '律',
- '慄' => '慄',
- '栗' => 'æ —',
- '率' => '率',
- '隆' => '隆',
- '�' => '利',
- '吏' => '�',
- '履' => '履',
- 'ï§ ' => '易',
- '李' => '�',
- '梨' => '梨',
- '泥' => '泥',
- '理' => '�',
- '痢' => '痢',
- '罹' => '罹',
- '裏' => '�',
- '裡' => '裡',
- '里' => '里',
- '離' => '離',
- '匿' => '匿',
- '溺' => '溺',
- 'ï§' => 'å��',
- '燐' => '�',
- '璘' => '璘',
- '藺' => '藺',
- '隣' => '隣',
- '鱗' => '鱗',
- '麟' => '麟',
- '林' => '林',
- '淋' => '淋',
- '臨' => '臨',
- '立' => '立',
- '笠' => 'ç¬ ',
- '粒' => '粒',
- '狀' => '狀',
- '炙' => '炙',
- '識' => 'è˜',
- '什' => '什',
- '茶' => '茶',
- '刺' => '刺',
- '切' => '切',
- '�' => '度',
- '拓' => '拓',
- '糖' => '糖',
- '宅' => '宅',
- '洞' => '洞',
- '暴' => '暴',
- '輻' => '輻',
- '行' => '行',
- '降' => '�',
- '見' => '見',
- '廓' => '廓',
- '兀' => '兀',
- '�' => '嗀',
- '�' => '塚',
- '晴' => '晴',
- '凞' => '凞',
- '猪' => '猪',
- '益' => '益',
- '礼' => '礼',
- '神' => '神',
- '祥' => '祥',
- '福' => '�',
- '靖' => '�',
- '�' => '精',
- '羽' => '羽',
- 'ï¨ ' => '蘒',
- '諸' => '諸',
- '逸' => '逸',
- '都' => '都',
- '飯' => '飯',
- '飼' => '飼',
- '館' => '館',
- 'ï¨' => '鶴',
- '郞' => '郞',
- '隷' => '隷',
- '侮' => '侮',
- '僧' => '僧',
- '免' => '�',
- '勉' => '勉',
- '勤' => '勤',
- '卑' => '�',
- '喝' => '�',
- '嘆' => '嘆',
- '器' => '器',
- '塀' => '塀',
- '墨' => '墨',
- '層' => '層',
- '屮' => '屮',
- '悔' => '悔',
- '慨' => '慨',
- '憎' => '憎',
- '懲' => '懲',
- '�' => '�',
- 'ï©‚' => 'æ—¢',
- '暑' => '暑',
- '梅' => '梅',
- 'ï©…' => 'æµ·',
- '渚' => '渚',
- '漢' => '漢',
- '煮' => '煮',
- '爫' => '爫',
- '琢' => '�',
- '碑' => '碑',
- '社' => '社',
- '�' => '祉',
- '祈' => '祈',
- '�' => '�',
- '�' => '祖',
- '祝' => '�',
- '禍' => '�',
- '禎' => '禎',
- 'ï©”' => 'ç©€',
- '突' => '�',
- '節' => '節',
- 'ï©—' => 'ç·´',
- '縉' => '縉',
- '繁' => '�',
- 'ï©š' => 'ç½²',
- '者' => '者',
- 'ï©œ' => 'è‡',
- '�' => '艹',
- '艹' => '艹',
- 'ï©Ÿ' => 'è‘—',
- 'ï© ' => 'è¤�',
- '視' => '視',
- '謁' => '�',
- '謹' => '謹',
- '賓' => '賓',
- 'ï©¥' => 'è´ˆ',
- '辶' => '辶',
- '逸' => '逸',
- '難' => '難',
- '響' => '響',
- '頻' => 'é »',
- '恵' => '�',
- '𤋮' => '𤋮',
- 'ï©' => '舘',
- '並' => '並',
- '况' => '况',
- '全' => '全',
- '侀' => '侀',
- 'ï©´' => 'å……',
- '冀' => '冀',
- '勇' => '勇',
- '勺' => '勺',
- '喝' => '�',
- '啕' => '啕',
- '喙' => '喙',
- 'ï©»' => 'å—¢',
- '塚' => '塚',
- '墳' => '墳',
- '奄' => '奄',
- '奔' => '奔',
- '婢' => '婢',
- '�' => '嬨',
- '廒' => '廒',
- '廙' => '廙',
- '彩' => '彩',
- '徭' => 'å¾',
- '惘' => '惘',
- '慎' => '慎',
- '愈' => '愈',
- '憎' => '憎',
- '慠' => 'æ… ',
- '懲' => '懲',
- '戴' => '戴',
- '�' => '�',
- '搜' => '�',
- '�' => '摒',
- '�' => '敖',
- '晴' => '晴',
- '朗' => '朗',
- '望' => '望',
- '杖' => '�',
- '歹' => 'æ¹',
- '殺' => '殺',
- '流' => '�',
- '滛' => '滛',
- '滋' => '滋',
- '漢' => '漢',
- '瀞' => '瀞',
- '煮' => '煮',
- '�' => '瞧',
- '爵' => '爵',
- '犯' => '犯',
- 'ïª ' => '猪',
- '瑱' => '瑱',
- '甆' => '甆',
- '画' => '画',
- '瘝' => '�',
- '瘟' => '瘟',
- '益' => '益',
- '盛' => '盛',
- '直' => '直',
- '睊' => '�',
- '着' => '�',
- '磌' => '磌',
- '窱' => '窱',
- 'ïª' => '節',
- '类' => '类',
- '絛' => '絛',
- '練' => '練',
- '缾' => '缾',
- '者' => '者',
- '荒' => '�',
- '華' => '�',
- '蝹' => '�',
- '襁' => '�',
- '覆' => '覆',
- '視' => '視',
- '調' => '調',
- '諸' => '諸',
- '請' => '請',
- '謁' => '�',
- '諾' => '諾',
- '諭' => 'è«',
- '謹' => '謹',
- '變' => '變',
- '�' => '贈',
- '輸' => '輸',
- '遲' => '�',
- '醙' => '醙',
- '鉶' => '鉶',
- '陼' => '陼',
- '難' => '難',
- '靖' => '�',
- '韛' => '韛',
- '響' => '響',
- 'ï«‹' => 'é ‹',
- 'ï«Œ' => 'é »',
- '�' => '鬒',
- '龜' => '龜',
- '�' => '𢡊',
- '�' => '𢡄',
- '𣏕' => '�',
- '㮝' => '�',
- '䀘' => '䀘',
- '䀹' => '䀹',
- '𥉉' => '𥉉',
- '𥳐' => '�',
- '𧻓' => '𧻓',
- '齃' => '齃',
- '龎' => '龎',
- '�' => 'יִ',
- 'ײַ' => 'ײַ',
- 'שׁ' => 'ש�',
- 'שׂ' => 'שׂ',
- 'שּׁ' => 'שּ�',
- 'ï¬' => 'שּׂ',
- 'אַ' => '�ַ',
- 'אָ' => '�ָ',
- 'אּ' => '�ּ',
- 'בּ' => 'בּ',
- 'גּ' => 'גּ',
- 'דּ' => 'דּ',
- 'הּ' => 'הּ',
- 'וּ' => 'וּ',
- 'זּ' => 'זּ',
- 'טּ' => 'טּ',
- 'יּ' => 'יּ',
- 'ךּ' => 'ךּ',
- 'כּ' => 'כּ',
- 'לּ' => 'לּ',
- 'מּ' => 'מּ',
- 'ï€' => '× Ö¼',
- 'ï�' => 'סּ',
- 'ïƒ' => '×£Ö¼',
- 'ï„' => 'פּ',
- 'ï†' => 'צּ',
- 'ï‡' => 'קּ',
- 'ïˆ' => 'רּ',
- 'ï‰' => 'שּ',
- 'ïŠ' => 'תּ',
- 'ï‹' => 'וֹ',
- 'ïŒ' => 'בֿ',
- 'ï�' => '×›Ö¿',
- 'ïŽ' => 'פֿ',
- '𑂚' => '𑂚',
- '𑂜' => '𑂜',
- '𑂫' => '𑂫',
- '𑄮' => '𑄮',
- '𑄯' => '𑄯',
- '�' => '�𑌾',
- '�' => '��',
- '𑒻' => '𑒻',
- '𑒼' => '𑒼',
- '𑒾' => '𑒾',
- '𑖺' => '𑖺',
- '𑖻' => '𑖻',
- '𑤸' => '𑤸',
- '�' => '��',
- '�' => '��',
- 'ð�… ' => 'ð�…˜ð�…¥ð�…®',
- '�' => '���',
- '�' => '���',
- '�' => '���',
- '�' => '���',
- '�' => '��',
- '�' => '��',
- '�' => '���',
- '�' => '���',
- '�' => '���',
- '�' => '���',
- '丽' => '丽',
- 'ð¯ �' => '丸',
- '乁' => '�',
- '𠄢' => '𠄢',
- '你' => 'ä½ ',
- '侮' => '侮',
- '侻' => '侻',
- '倂' => '倂',
- '偺' => '�',
- '備' => '備',
- '僧' => '僧',
- '像' => '�',
- '㒞' => '㒞',
- 'ð¯ �' => '𠘺',
- '免' => '�',
- 'ð¯ �' => 'å…”',
- 'ð¯ �' => 'å…¤',
- '具' => '具',
- '𠔜' => '𠔜',
- '㒹' => '㒹',
- '內' => '內',
- '再' => '�',
- '𠕋' => '𠕋',
- '冗' => '冗',
- '冤' => '冤',
- '仌' => '仌',
- '冬' => '冬',
- '况' => '况',
- '𩇟' => '𩇟',
- 'ð¯ �' => '凵',
- '刃' => '刃',
- '㓟' => '㓟',
- 'ð¯ ' => '刻',
- '剆' => '剆',
- '割' => '割',
- '剷' => '剷',
- '㔕' => '㔕',
- '勇' => '勇',
- '勉' => '勉',
- '勤' => '勤',
- '勺' => '勺',
- '包' => '包',
- '匆' => '匆',
- '北' => '北',
- '卉' => '�',
- 'ð¯ ' => 'å�‘',
- '博' => '�',
- '即' => '�',
- '卽' => '�',
- '卿' => '�',
- '卿' => '�',
- '卿' => '�',
- '𠨬' => '𠨬',
- '灰' => '�',
- '及' => '�',
- '叟' => '�',
- '𠭣' => 'ð £',
- '叫' => '�',
- '叱' => '�',
- '吆' => '�',
- '咞' => '咞',
- '吸' => '�',
- '呈' => '呈',
- '周' => '周',
- '咢' => '咢',
- '�' => '哶',
- '唐' => '�',
- '啓' => '啓',
- '啣' => '啣',
- '善' => '善',
- '善' => '善',
- '喙' => '喙',
- '喫' => '喫',
- '喳' => '喳',
- '嗂' => '嗂',
- '圖' => '圖',
- '嘆' => '嘆',
- '�' => '圗',
- '噑' => '噑',
- '�' => '噴',
- '�' => '切',
- '壮' => '壮',
- '城' => '城',
- '埴' => '埴',
- '堍' => 'å �',
- '型' => '型',
- '堲' => 'å ²',
- '報' => 'å ±',
- '墬' => '墬',
- '𡓤' => '𡓤',
- '売' => '売',
- '壷' => '壷',
- '夆' => '夆',
- '�' => '多',
- '夢' => '夢',
- '奢' => '奢',
- '𡚨' => '𡚨',
- '𡛪' => '𡛪',
- '姬' => '姬',
- '娛' => '娛',
- '娧' => '娧',
- '姘' => '姘',
- '婦' => '婦',
- '㛮' => '㛮',
- '㛼' => '㛼',
- '嬈' => '嬈',
- '嬾' => '嬾',
- '嬾' => '嬾',
- '𡧈' => '𡧈',
- 'ð¯¡' => '寃',
- '寘' => '寘',
- '寧' => '寧',
- '寳' => '寳',
- '𡬘' => '𡬘',
- '寿' => '寿',
- '将' => '将',
- '当' => '当',
- '尢' => '尢',
- '㞁' => '�',
- '屠' => 'å± ',
- '屮' => '屮',
- '峀' => '峀',
- '岍' => '�',
- '𡷤' => '𡷤',
- '嵃' => '嵃',
- '𡷦' => '𡷦',
- '嵮' => '嵮',
- '嵫' => '嵫',
- '嵼' => '嵼',
- '�' => '巡',
- '巢' => '巢',
- '㠯' => '㠯',
- '巽' => '巽',
- '帨' => '帨',
- '帽' => '帽',
- '幩' => '幩',
- '㡢' => '㡢',
- '𢆃' => '𢆃',
- '㡼' => '㡼',
- '庰' => '庰',
- '庳' => '庳',
- '�' => '庶',
- '廊' => '廊',
- '�' => '𪎒',
- '�' => '廾',
- '𢌱' => '𢌱',
- '𢌱' => '𢌱',
- '舁' => '�',
- '弢' => '弢',
- '弢' => '弢',
- '㣇' => '㣇',
- '𣊸' => '𣊸',
- '𦇚' => '𦇚',
- '形' => '形',
- '彫' => '彫',
- '㣣' => '㣣',
- '徚' => '徚',
- '�' => '�',
- '志' => '志',
- '忹' => '忹',
- '悁' => '�',
- '㤺' => '㤺',
- '㤜' => '㤜',
- '悔' => '悔',
- '𢛔' => '𢛔',
- '惇' => '惇',
- '慈' => '慈',
- '慌' => '慌',
- '慎' => '慎',
- '慌' => '慌',
- '慺' => '慺',
- '憎' => '憎',
- '憲' => '憲',
- 'ð¯¢' => '憤',
- '憯' => '憯',
- '懞' => '懞',
- '懲' => '懲',
- '懶' => '懶',
- '成' => '�',
- '戛' => '戛',
- '扝' => '�',
- '抱' => '抱',
- '拔' => '拔',
- '捐' => '�',
- '𢬌' => '𢬌',
- '挽' => '挽',
- '拼' => '拼',
- '捨' => '�',
- '掃' => '掃',
- '揤' => '�',
- '𢯱' => '𢯱',
- '搢' => '�',
- '揅' => '�',
- '�' => '掩',
- '㨮' => '㨮',
- '摩' => '摩',
- '摾' => '摾',
- '撝' => '�',
- '摷' => '摷',
- '㩬' => '㩬',
- '敏' => '�',
- '敬' => '敬',
- '𣀊' => '𣀊',
- '旣' => '旣',
- '書' => '書',
- '�' => '晉',
- '㬙' => '㬙',
- '�' => '暑',
- '�' => '㬈',
- '㫤' => '㫤',
- '冒' => '冒',
- '冕' => '冕',
- '最' => '最',
- '暜' => '暜',
- '肭' => 'è‚',
- '䏙' => '�',
- '朗' => '朗',
- '望' => '望',
- '朡' => '朡',
- '杞' => '�',
- '杓' => '�',
- '�' => '�',
- '㭉' => 'ã‰',
- '柺' => '柺',
- '枅' => '枅',
- '桒' => '桒',
- '梅' => '梅',
- '𣑭' => 'ð£‘',
- '梎' => '梎',
- '栟' => 'æ Ÿ',
- '椔' => '椔',
- '㮝' => '�',
- '楂' => '楂',
- '榣' => '榣',
- '槪' => '槪',
- '檨' => '檨',
- '𣚣' => '𣚣',
- 'ð¯£' => 'æ«›',
- '㰘' => '㰘',
- '次' => '次',
- '𣢧' => '𣢧',
- '歔' => 'æ”',
- '㱎' => '㱎',
- '歲' => 'æ²',
- '殟' => '殟',
- '殺' => '殺',
- '殻' => '殻',
- '𣪍' => '�',
- '𡴋' => '𡴋',
- '𣫺' => '𣫺',
- '汎' => '汎',
- '𣲼' => '𣲼',
- '沿' => '沿',
- '泍' => '�',
- '汧' => '汧',
- '洖' => '洖',
- '派' => '派',
- '�' => '海',
- '流' => '�',
- '浩' => '浩',
- '浸' => '浸',
- '涅' => '涅',
- '𣴞' => '𣴞',
- '洴' => '洴',
- '港' => '港',
- '湮' => '湮',
- '㴳' => '㴳',
- '滋' => '滋',
- '滇' => '滇',
- '�' => '𣻑',
- '淹' => '淹',
- '�' => '潮',
- '�' => '𣽞',
- '𣾎' => '𣾎',
- '濆' => '濆',
- '瀹' => '瀹',
- '瀞' => '瀞',
- '瀛' => '瀛',
- '㶖' => '㶖',
- '灊' => '�',
- '災' => '�',
- '灷' => '�',
- '炭' => 'ç‚',
- '𠔥' => '𠔥',
- '煅' => '煅',
- '�' => '𤉣',
- '熜' => '熜',
- '𤎫' => '𤎫',
- '爨' => '爨',
- '爵' => '爵',
- '牐' => '�',
- '𤘈' => '𤘈',
- '犀' => '犀',
- '犕' => '犕',
- '𤜵' => '𤜵',
- '𤠔' => '𤠔',
- '獺' => '�',
- '王' => '王',
- '㺬' => '㺬',
- '玥' => '玥',
- '㺸' => '㺸',
- 'ð¯¤' => '㺸',
- '瑇' => '瑇',
- '瑜' => '瑜',
- '瑱' => '瑱',
- '璅' => '璅',
- '瓊' => '瓊',
- '㼛' => '㼛',
- '甤' => '甤',
- '𤰶' => '𤰶',
- '甾' => '甾',
- '𤲒' => '𤲒',
- '異' => '異',
- '𢆟' => '𢆟',
- '瘐' => '�',
- '𤾡' => '𤾡',
- '𤾸' => '𤾸',
- '𥁄' => '�',
- '㿼' => '㿼',
- '䀈' => '䀈',
- '直' => '直',
- '�' => '𥃳',
- '𥃲' => '𥃲',
- '𥄙' => '𥄙',
- '𥄳' => '𥄳',
- '眞' => '眞',
- '真' => '真',
- '真' => '真',
- '睊' => '�',
- '䀹' => '䀹',
- '瞋' => '瞋',
- '䁆' => '�',
- '䂖' => '䂖',
- '�' => '�',
- '硎' => '硎',
- '�' => '碌',
- '�' => '磌',
- '䃣' => '䃣',
- '𥘦' => '𥘦',
- '祖' => '祖',
- '𥚚' => '𥚚',
- '𥛅' => '𥛅',
- '福' => '�',
- '秫' => '秫',
- '䄯' => '䄯',
- '穀' => '穀',
- '穊' => '穊',
- '穏' => '�',
- '𥥼' => '𥥼',
- '�' => '𥪧',
- '𥪧' => '𥪧',
- '竮' => '竮',
- '䈂' => '䈂',
- '𥮫' => '𥮫',
- '篆' => '篆',
- '築' => '築',
- '䈧' => '䈧',
- '𥲀' => '𥲀',
- '糒' => '糒',
- '䊠' => 'äŠ ',
- '糨' => '糨',
- '糣' => '糣',
- '紀' => '紀',
- '𥾆' => '𥾆',
- '絣' => '絣',
- 'ð¯¥' => 'äŒ�',
- '緇' => '緇',
- '縂' => '縂',
- '繅' => '繅',
- '䌴' => '䌴',
- '𦈨' => '𦈨',
- '𦉇' => '𦉇',
- '䍙' => '�',
- '𦋙' => '𦋙',
- '罺' => '罺',
- '𦌾' => '𦌾',
- '羕' => '羕',
- '翺' => '翺',
- '者' => '者',
- '𦓚' => '𦓚',
- '𦔣' => '𦔣',
- '聠' => 'è� ',
- '𦖨' => '𦖨',
- '聰' => '�',
- '𣍟' => '�',
- '�' => '�',
- '育' => '育',
- '脃' => '脃',
- '䐋' => '�',
- '脾' => '脾',
- '媵' => '媵',
- '𦞧' => '𦞧',
- '𦞵' => '𦞵',
- '𣎓' => '𣎓',
- '𣎜' => '𣎜',
- '舁' => '�',
- '舄' => '舄',
- '�' => '辞',
- '䑫' => '䑫',
- '�' => '芑',
- '�' => '芋',
- '芝' => '�',
- '劳' => '劳',
- '花' => '花',
- '芳' => '芳',
- '芽' => '芽',
- '苦' => '苦',
- '𦬼' => '𦬼',
- '若' => '若',
- '茝' => '�',
- '荣' => '�',
- '莭' => 'èŽ',
- '茣' => '茣',
- '�' => '莽',
- '菧' => '�',
- '著' => '著',
- '荓' => '�',
- '菊' => '�',
- '菌' => '�',
- '菜' => '�',
- '𦰶' => '𦰶',
- '𦵫' => '𦵫',
- '𦳕' => '𦳕',
- '䔫' => '䔫',
- '蓱' => '蓱',
- '蓳' => '蓳',
- '蔖' => '蔖',
- '𧏊' => '�',
- '蕤' => '蕤',
- 'ð¯¦' => '𦼬',
- '䕝' => '�',
- '䕡' => '䕡',
- '𦾱' => '𦾱',
- '𧃒' => '𧃒',
- '䕫' => '䕫',
- '虐' => '�',
- '虜' => '虜',
- '虧' => '虧',
- '虩' => '虩',
- '蚩' => '蚩',
- '蚈' => '蚈',
- '蜎' => '蜎',
- '蛢' => '蛢',
- '蝹' => '�',
- '蜨' => '蜨',
- '蝫' => '�',
- '螆' => '螆',
- '䗗' => '䗗',
- '蟡' => '蟡',
- 'ð¯§�' => 'è �',
- '䗹' => '䗹',
- '衠' => 'è¡ ',
- '衣' => '衣',
- '𧙧' => '𧙧',
- '裗' => '裗',
- '裞' => '裞',
- '䘵' => '䘵',
- '裺' => '裺',
- '㒻' => '㒻',
- '𧢮' => '𧢮',
- '𧥦' => '𧥦',
- '�' => '䚾',
- '䛇' => '䛇',
- 'ð¯§�' => 'èª ',
- 'ð¯§�' => 'è«',
- '變' => '變',
- '豕' => '豕',
- '𧲨' => '𧲨',
- '貫' => '貫',
- '賁' => '�',
- '贛' => '贛',
- '起' => '起',
- '𧼯' => '𧼯',
- '𠠄' => 'ð „',
- '跋' => '跋',
- '趼' => '趼',
- '跰' => '跰',
- '�' => '𠣞',
- '軔' => '軔',
- '輸' => '輸',
- '𨗒' => '𨗒',
- '𨗭' => 'ð¨—',
- '邔' => '邔',
- '郱' => '郱',
- '鄑' => '鄑',
- '𨜮' => '𨜮',
- '鄛' => '鄛',
- '鈸' => '鈸',
- '鋗' => '鋗',
- '鋘' => '鋘',
- '鉼' => '鉼',
- '鏹' => '�',
- '鐕' => '�',
- 'ð¯§' => '𨯺',
- '開' => '開',
- '䦕' => '䦕',
- '閷' => '閷',
- '𨵷' => '𨵷',
- '䧦' => '䧦',
- '雃' => '雃',
- '嶲' => '嶲',
- '霣' => '霣',
- '𩅅' => '𩅅',
- '𩈚' => '𩈚',
- '䩮' => '䩮',
- '䩶' => '䩶',
- '韠' => 'éŸ ',
- '𩐊' => '�',
- '䪲' => '䪲',
- '𩒖' => '𩒖',
- '頋' => 'é ‹',
- '頋' => 'é ‹',
- '頩' => 'é ©',
- '�' => '𩖶',
- '飢' => '飢',
- '䬳' => '䬳',
- '餩' => '餩',
- '馧' => '馧',
- '駂' => '駂',
- '駾' => '駾',
- '䯎' => '䯎',
- '𩬰' => '𩬰',
- '鬒' => '鬒',
- '鱀' => '鱀',
- '鳽' => '鳽',
- '�' => '䳎',
- '䳭' => 'ä³',
- '�' => '鵧',
- '�' => '𪃎',
- '䳸' => '䳸',
- '𪄅' => '𪄅',
- '𪈎' => '𪈎',
- '𪊑' => '𪊑',
- '麻' => '麻',
- '䵖' => '䵖',
- '黹' => '黹',
- '黾' => '黾',
- '鼅' => '鼅',
- '鼏' => '�',
- '鼖' => '鼖',
- '鼻' => '鼻',
- '�' => '𪘀',
- );
- <?php
- return array (
- 'Ì€' => 230,
- '�' => 230,
- 'Ì‚' => 230,
- '̃' => 230,
- 'Ì„' => 230,
- 'Ì…' => 230,
- '̆' => 230,
- '̇' => 230,
- '̈' => 230,
- '̉' => 230,
- 'ÌŠ' => 230,
- 'Ì‹' => 230,
- '̌' => 230,
- '�' => 230,
- 'ÌŽ' => 230,
- '�' => 230,
- '�' => 230,
- 'Ì‘' => 230,
- 'Ì’' => 230,
- 'Ì“' => 230,
- 'Ì”' => 230,
- 'Ì•' => 232,
- 'Ì–' => 220,
- 'Ì—' => 220,
- '̘' => 220,
- 'Ì™' => 220,
- 'Ìš' => 232,
- 'Ì›' => 216,
- '̜' => 220,
- '�' => 220,
- 'Ìž' => 220,
- 'ÌŸ' => 220,
- 'Ì ' => 220,
- 'Ì¡' => 202,
- 'Ì¢' => 202,
- 'Ì£' => 220,
- '̤' => 220,
- 'Ì¥' => 220,
- '̦' => 220,
- '̧' => 202,
- '̨' => 202,
- 'Ì©' => 220,
- '̪' => 220,
- 'Ì«' => 220,
- '̬' => 220,
- 'Ì' => 220,
- 'Ì®' => 220,
- '̯' => 220,
- 'Ì°' => 220,
- '̱' => 220,
- '̲' => 220,
- '̳' => 220,
- 'Ì´' => 1,
- '̵' => 1,
- '̶' => 1,
- 'Ì·' => 1,
- '̸' => 1,
- '̹' => 220,
- '̺' => 220,
- 'Ì»' => 220,
- '̼' => 220,
- '̽' => 230,
- '̾' => 230,
- 'Ì¿' => 230,
- 'Í€' => 230,
- '�' => 230,
- 'Í‚' => 230,
- '̓' => 230,
- 'Í„' => 230,
- 'Í…' => 240,
- '͆' => 230,
- '͇' => 220,
- '͈' => 220,
- '͉' => 220,
- 'ÍŠ' => 230,
- 'Í‹' => 230,
- '͌' => 230,
- '�' => 220,
- 'ÍŽ' => 220,
- '�' => 230,
- 'Í‘' => 230,
- 'Í’' => 230,
- 'Í“' => 220,
- 'Í”' => 220,
- 'Í•' => 220,
- 'Í–' => 220,
- 'Í—' => 230,
- '͘' => 232,
- 'Í™' => 220,
- 'Íš' => 220,
- 'Í›' => 230,
- '͜' => 233,
- '�' => 234,
- 'Íž' => 234,
- 'ÍŸ' => 233,
- 'Í ' => 234,
- 'Í¡' => 234,
- 'Í¢' => 233,
- 'Í£' => 230,
- 'ͤ' => 230,
- 'Í¥' => 230,
- 'ͦ' => 230,
- 'ͧ' => 230,
- 'ͨ' => 230,
- 'Í©' => 230,
- 'ͪ' => 230,
- 'Í«' => 230,
- 'ͬ' => 230,
- 'Í' => 230,
- 'Í®' => 230,
- 'ͯ' => 230,
- 'Òƒ' => 230,
- 'Ò„' => 230,
- 'Ò…' => 230,
- 'Ò†' => 230,
- 'Ò‡' => 230,
- 'Ö‘' => 220,
- 'Ö’' => 230,
- 'Ö“' => 230,
- 'Ö”' => 230,
- 'Ö•' => 230,
- 'Ö–' => 220,
- 'Ö—' => 230,
- 'Ö˜' => 230,
- 'Ö™' => 230,
- 'Öš' => 222,
- 'Ö›' => 220,
- '֜' => 230,
- 'Ö�' => 230,
- 'Öž' => 230,
- 'ÖŸ' => 230,
- 'Ö ' => 230,
- 'Ö¡' => 230,
- 'Ö¢' => 220,
- 'Ö£' => 220,
- 'Ö¤' => 220,
- 'Ö¥' => 220,
- 'Ö¦' => 220,
- 'Ö§' => 220,
- 'Ö¨' => 230,
- 'Ö©' => 230,
- 'Öª' => 220,
- 'Ö«' => 230,
- 'Ö¬' => 230,
- 'Ö' => 222,
- 'Ö®' => 228,
- 'Ö¯' => 230,
- 'Ö°' => 10,
- 'Ö±' => 11,
- 'Ö²' => 12,
- 'Ö³' => 13,
- 'Ö´' => 14,
- 'Öµ' => 15,
- 'Ö¶' => 16,
- 'Ö·' => 17,
- 'Ö¸' => 18,
- 'Ö¹' => 19,
- 'Öº' => 19,
- 'Ö»' => 20,
- 'Ö¼' => 21,
- 'Ö½' => 22,
- 'Ö¿' => 23,
- '�' => 24,
- 'ׂ' => 25,
- 'ׄ' => 230,
- '×…' => 220,
- 'ׇ' => 18,
- '�' => 230,
- 'Ø‘' => 230,
- 'Ø’' => 230,
- 'Ø“' => 230,
- 'Ø”' => 230,
- 'Ø•' => 230,
- 'Ø–' => 230,
- 'Ø—' => 230,
- 'ؘ' => 30,
- 'Ø™' => 31,
- 'Øš' => 32,
- 'Ù‹' => 27,
- 'ٌ' => 28,
- 'Ù�' => 29,
- 'ÙŽ' => 30,
- 'Ù�' => 31,
- 'Ù�' => 32,
- 'Ù‘' => 33,
- 'Ù’' => 34,
- 'Ù“' => 230,
- 'Ù”' => 230,
- 'Ù•' => 220,
- 'Ù–' => 220,
- 'Ù—' => 230,
- 'Ù˜' => 230,
- 'Ù™' => 230,
- 'Ùš' => 230,
- 'Ù›' => 230,
- 'ٜ' => 220,
- 'Ù�' => 230,
- 'Ùž' => 230,
- 'ÙŸ' => 220,
- 'Ù°' => 35,
- 'Û–' => 230,
- 'Û—' => 230,
- 'Û˜' => 230,
- 'Û™' => 230,
- 'Ûš' => 230,
- 'Û›' => 230,
- 'ۜ' => 230,
- 'ÛŸ' => 230,
- 'Û ' => 230,
- 'Û¡' => 230,
- 'Û¢' => 230,
- 'Û£' => 220,
- 'Û¤' => 230,
- 'Û§' => 230,
- 'Û¨' => 230,
- 'Ûª' => 220,
- 'Û«' => 230,
- 'Û¬' => 230,
- 'Û' => 220,
- 'Ü‘' => 36,
- 'Ü°' => 230,
- 'ܱ' => 220,
- 'ܲ' => 230,
- 'ܳ' => 230,
- 'Ü´' => 220,
- 'ܵ' => 230,
- 'ܶ' => 230,
- 'Ü·' => 220,
- 'ܸ' => 220,
- 'ܹ' => 220,
- 'ܺ' => 230,
- 'Ü»' => 220,
- 'ܼ' => 220,
- 'ܽ' => 230,
- 'ܾ' => 220,
- 'Ü¿' => 230,
- 'Ý€' => 230,
- '�' => 230,
- 'Ý‚' => 220,
- '݃' => 230,
- 'Ý„' => 220,
- 'Ý…' => 230,
- '݆' => 220,
- '݇' => 230,
- '݈' => 220,
- '݉' => 230,
- 'ÝŠ' => 230,
- 'ß«' => 230,
- '߬' => 230,
- 'ß' => 230,
- 'ß®' => 230,
- '߯' => 230,
- 'ß°' => 230,
- 'ß±' => 230,
- 'ß²' => 220,
- 'ß³' => 230,
- 'ß½' => 220,
- 'à –' => 230,
- 'à —' => 230,
- 'à ˜' => 230,
- 'à ™' => 230,
- 'à ›' => 230,
- 'à œ' => 230,
- 'à �' => 230,
- 'à ž' => 230,
- 'à Ÿ' => 230,
- 'à ' => 230,
- 'à ¡' => 230,
- 'à ¢' => 230,
- 'à £' => 230,
- 'à ¥' => 230,
- 'à ¦' => 230,
- 'à §' => 230,
- 'à ©' => 230,
- 'à ª' => 230,
- 'à «' => 230,
- 'à ¬' => 230,
- 'à ' => 230,
- 'à¡™' => 220,
- 'à¡š' => 220,
- 'à¡›' => 220,
- '࣓' => 220,
- 'ࣔ' => 230,
- 'ࣕ' => 230,
- 'ࣖ' => 230,
- 'ࣗ' => 230,
- 'ࣘ' => 230,
- 'ࣙ' => 230,
- 'ࣚ' => 230,
- 'ࣛ' => 230,
- 'ࣜ' => 230,
- '�' => 230,
- 'ࣞ' => 230,
- 'ࣟ' => 230,
- '࣠' => 230,
- '࣡' => 230,
- 'ࣣ' => 220,
- 'ࣤ' => 230,
- 'ࣥ' => 230,
- 'ࣦ' => 220,
- 'ࣧ' => 230,
- 'ࣨ' => 230,
- 'ࣩ' => 220,
- '࣪' => 230,
- '࣫' => 230,
- '࣬' => 230,
- 'à£' => 220,
- '࣮' => 220,
- '࣯' => 220,
- 'ࣰ' => 27,
- 'ࣱ' => 28,
- 'ࣲ' => 29,
- 'ࣳ' => 230,
- 'ࣴ' => 230,
- 'ࣵ' => 230,
- 'ࣶ' => 220,
- 'ࣷ' => 230,
- 'ࣸ' => 230,
- 'ࣹ' => 220,
- 'ࣺ' => 220,
- 'ࣻ' => 230,
- 'ࣼ' => 230,
- 'ࣽ' => 230,
- 'ࣾ' => 230,
- 'ࣿ' => 230,
- '़' => 7,
- '�' => 9,
- '॑' => 230,
- '॒' => 220,
- '॓' => 230,
- '॔' => 230,
- '়' => 7,
- '�' => 9,
- '৾' => 230,
- '਼' => 7,
- '�' => 9,
- '઼' => 7,
- '�' => 9,
- '଼' => 7,
- 'à�' => 9,
- '�' => 9,
- '�' => 9,
- 'ౕ' => 84,
- 'à±–' => 91,
- '಼' => 7,
- '�' => 9,
- 'à´»' => 9,
- 'à´¼' => 9,
- '�' => 9,
- 'à·Š' => 9,
- 'ุ' => 103,
- 'ู' => 103,
- 'ฺ' => 9,
- '่' => 107,
- '้' => 107,
- '๊' => 107,
- '๋' => 107,
- 'ຸ' => 118,
- 'ູ' => 118,
- '຺' => 9,
- '່' => 122,
- '້' => 122,
- '໊' => 122,
- '໋' => 122,
- '༘' => 220,
- '༙' => 220,
- '༵' => 220,
- '༷' => 220,
- '༹' => 216,
- 'ཱ' => 129,
- 'ི' => 130,
- 'ུ' => 132,
- 'ེ' => 130,
- 'ཻ' => 130,
- 'ོ' => 130,
- 'ཽ' => 130,
- 'ྀ' => 130,
- 'ྂ' => 230,
- 'ྃ' => 230,
- '྄' => 9,
- '྆' => 230,
- '྇' => 230,
- '࿆' => 220,
- '့' => 7,
- '္' => 9,
- '်' => 9,
- '�' => 220,
- '�' => 230,
- '�' => 230,
- '�' => 230,
- '᜔' => 9,
- '᜴' => 9,
- '្' => 9,
- '�' => 230,
- 'ᢩ' => 228,
- '᤹' => 222,
- '᤺' => 230,
- '᤻' => 220,
- 'ᨗ' => 230,
- 'ᨘ' => 220,
- 'á© ' => 9,
- '᩵' => 230,
- '᩶' => 230,
- 'á©·' => 230,
- '᩸' => 230,
- '᩹' => 230,
- '᩺' => 230,
- 'á©»' => 230,
- '᩼' => 230,
- 'á©¿' => 220,
- '᪰' => 230,
- '᪱' => 230,
- '᪲' => 230,
- '᪳' => 230,
- '᪴' => 230,
- '᪵' => 220,
- '᪶' => 220,
- '᪷' => 220,
- '᪸' => 220,
- '᪹' => 220,
- '᪺' => 220,
- '᪻' => 230,
- '᪼' => 230,
- '᪽' => 220,
- 'ᪿ' => 220,
- 'á«€' => 220,
- '᬴' => 7,
- 'á„' => 9,
- 'á«' => 230,
- 'á¬' => 220,
- 'á' => 230,
- 'á®' => 230,
- 'á¯' => 230,
- 'á°' => 230,
- 'á±' => 230,
- 'á²' => 230,
- 'á³' => 230,
- '᮪' => 9,
- '᮫' => 9,
- '᯦' => 7,
- '᯲' => 9,
- '᯳' => 9,
- 'á°·' => 7,
- '�' => 230,
- '᳑' => 230,
- 'á³’' => 230,
- 'á³”' => 1,
- '᳕' => 220,
- 'á³–' => 220,
- 'á³—' => 220,
- '᳘' => 220,
- 'á³™' => 220,
- '᳚' => 230,
- 'á³›' => 230,
- '᳜' => 220,
- '�' => 220,
- '᳞' => 220,
- '᳟' => 220,
- 'á³ ' => 230,
- 'á³¢' => 1,
- 'á³£' => 1,
- '᳤' => 1,
- 'á³¥' => 1,
- '᳦' => 1,
- '᳧' => 1,
- '᳨' => 1,
- 'á³' => 220,
- 'á³´' => 230,
- '᳸' => 230,
- 'á³¹' => 230,
- 'á·€' => 230,
- 'á·�' => 230,
- 'á·‚' => 220,
- 'á·ƒ' => 230,
- 'á·„' => 230,
- 'á·…' => 230,
- 'á·†' => 230,
- 'á·‡' => 230,
- 'á·ˆ' => 230,
- 'á·‰' => 230,
- 'á·Š' => 220,
- 'á·‹' => 230,
- '᷌' => 230,
- 'á·�' => 234,
- 'á·Ž' => 214,
- 'á·�' => 220,
- 'á·�' => 202,
- 'á·‘' => 230,
- 'á·’' => 230,
- 'á·“' => 230,
- 'á·”' => 230,
- 'á·•' => 230,
- 'á·–' => 230,
- 'á·—' => 230,
- 'á·˜' => 230,
- 'á·™' => 230,
- 'á·š' => 230,
- 'á·›' => 230,
- 'ᷜ' => 230,
- 'á·�' => 230,
- 'á·ž' => 230,
- 'á·Ÿ' => 230,
- 'á· ' => 230,
- 'á·¡' => 230,
- 'á·¢' => 230,
- 'á·£' => 230,
- 'á·¤' => 230,
- 'á·¥' => 230,
- 'á·¦' => 230,
- 'á·§' => 230,
- 'á·¨' => 230,
- 'á·©' => 230,
- 'á·ª' => 230,
- 'á·«' => 230,
- 'á·¬' => 230,
- 'á·' => 230,
- 'á·®' => 230,
- 'á·¯' => 230,
- 'á·°' => 230,
- 'á·±' => 230,
- 'á·²' => 230,
- 'á·³' => 230,
- 'á·´' => 230,
- 'á·µ' => 230,
- 'á·¶' => 232,
- 'á··' => 228,
- 'á·¸' => 228,
- 'á·¹' => 220,
- 'á·»' => 230,
- 'á·¼' => 233,
- 'á·½' => 220,
- 'á·¾' => 230,
- 'á·¿' => 220,
- '�' => 230,
- '⃑' => 230,
- '⃒' => 1,
- '⃓' => 1,
- '⃔' => 230,
- '⃕' => 230,
- '⃖' => 230,
- '⃗' => 230,
- '⃘' => 1,
- '⃙' => 1,
- '⃚' => 1,
- '⃛' => 230,
- '⃜' => 230,
- '⃡' => 230,
- '⃥' => 1,
- '⃦' => 1,
- '⃧' => 230,
- '⃨' => 220,
- '⃩' => 230,
- '⃪' => 1,
- '⃫' => 1,
- '⃬' => 220,
- 'âƒ' => 220,
- '⃮' => 220,
- '⃯' => 220,
- '⃰' => 230,
- '⳯' => 230,
- 'â³°' => 230,
- 'â³±' => 230,
- '⵿' => 9,
- 'â· ' => 230,
- 'â·¡' => 230,
- 'â·¢' => 230,
- 'â·£' => 230,
- 'â·¤' => 230,
- 'â·¥' => 230,
- 'â·¦' => 230,
- 'â·§' => 230,
- 'â·¨' => 230,
- 'â·©' => 230,
- 'â·ª' => 230,
- 'â·«' => 230,
- 'â·¬' => 230,
- 'â·' => 230,
- 'â·®' => 230,
- 'â·¯' => 230,
- 'â·°' => 230,
- 'â·±' => 230,
- 'â·²' => 230,
- 'â·³' => 230,
- 'â·´' => 230,
- 'â·µ' => 230,
- 'â·¶' => 230,
- 'â··' => 230,
- 'â·¸' => 230,
- 'â·¹' => 230,
- 'â·º' => 230,
- 'â·»' => 230,
- 'â·¼' => 230,
- 'â·½' => 230,
- 'â·¾' => 230,
- 'â·¿' => 230,
- '〪' => 218,
- '〫' => 228,
- '〬' => 232,
- 'ã€' => 222,
- '〮' => 224,
- '〯' => 224,
- 'ã‚™' => 8,
- 'ã‚š' => 8,
- '꙯' => 230,
- 'ê™´' => 230,
- 'ꙵ' => 230,
- 'ꙶ' => 230,
- 'ê™·' => 230,
- 'ꙸ' => 230,
- 'ꙹ' => 230,
- 'ꙺ' => 230,
- 'ê™»' => 230,
- '꙼' => 230,
- '꙽' => 230,
- 'êšž' => 230,
- 'ꚟ' => 230,
- 'ê›°' => 230,
- 'ê›±' => 230,
- 'ê †' => 9,
- 'ê ¬' => 9,
- '꣄' => 9,
- 'ê£ ' => 230,
- '꣡' => 230,
- '꣢' => 230,
- '꣣' => 230,
- '꣤' => 230,
- '꣥' => 230,
- '꣦' => 230,
- '꣧' => 230,
- '꣨' => 230,
- '꣩' => 230,
- '꣪' => 230,
- '꣫' => 230,
- '꣬' => 230,
- 'ê£' => 230,
- '꣮' => 230,
- '꣯' => 230,
- '꣰' => 230,
- '꣱' => 230,
- '꤫' => 220,
- '꤬' => 220,
- 'ê¤' => 220,
- '꥓' => 9,
- '꦳' => 7,
- '꧀' => 9,
- 'ꪰ' => 230,
- 'ꪲ' => 230,
- 'ꪳ' => 230,
- 'ꪴ' => 220,
- 'ꪷ' => 230,
- 'ꪸ' => 230,
- 'ꪾ' => 230,
- '꪿' => 230,
- '�' => 230,
- '꫶' => 9,
- 'ê¯' => 9,
- 'ﬞ' => 26,
- 'ï¸ ' => 230,
- '︡' => 230,
- '︢' => 230,
- '︣' => 230,
- '︤' => 230,
- '︥' => 230,
- '︦' => 230,
- '︧' => 220,
- '︨' => 220,
- '︩' => 220,
- '︪' => 220,
- '︫' => 220,
- '︬' => 220,
- 'ï¸' => 220,
- '︮' => 230,
- '︯' => 230,
- '�' => 220,
- 'ð�‹ ' => 220,
- '�' => 230,
- '�' => 230,
- '�' => 230,
- '�' => 230,
- '�' => 230,
- '�' => 220,
- '�' => 230,
- '�' => 230,
- '�' => 1,
- '�' => 220,
- '�' => 9,
- '�' => 230,
- '�' => 220,
- '�' => 230,
- '�' => 230,
- '�' => 230,
- '�' => 230,
- '�' => 230,
- '�' => 230,
- '�' => 220,
- '�' => 220,
- '�' => 230,
- '�' => 230,
- '�' => 230,
- '�' => 220,
- '�' => 230,
- '�' => 220,
- '�' => 220,
- '�' => 220,
- '�' => 220,
- '�' => 9,
- '�' => 9,
- 'ð‘‚¹' => 9,
- '𑂺' => 7,
- 'ð‘„€' => 230,
- '�' => 230,
- 'ð‘„‚' => 230,
- 'ð‘„³' => 9,
- 'ð‘„´' => 9,
- 'ð‘…³' => 7,
- '𑇀' => 9,
- '𑇊' => 7,
- '𑈵' => 9,
- '𑈶' => 7,
- 'ð‘‹©' => 7,
- '𑋪' => 9,
- '𑌻' => 7,
- '𑌼' => 7,
- '�' => 9,
- '�' => 230,
- '�' => 230,
- '�' => 230,
- '�' => 230,
- '�' => 230,
- '�' => 230,
- '�' => 230,
- '�' => 230,
- '�' => 230,
- '�' => 230,
- '�' => 230,
- '�' => 230,
- 'ð‘‘‚' => 9,
- '𑑆' => 7,
- 'ð‘‘ž' => 230,
- 'ð‘“‚' => 9,
- '𑓃' => 7,
- 'ð‘–¿' => 9,
- 'ð‘—€' => 7,
- '𑘿' => 9,
- '𑚶' => 9,
- 'ð‘š·' => 7,
- '𑜫' => 9,
- 'ð‘ ¹' => 9,
- 'ð‘ º' => 7,
- '𑤽' => 9,
- '𑤾' => 9,
- '𑥃' => 7,
- '𑧠' => 9,
- '𑨴' => 9,
- '𑩇' => 9,
- '𑪙' => 9,
- 'ð‘°¿' => 9,
- '𑵂' => 7,
- '𑵄' => 9,
- '𑵅' => 9,
- '𑶗' => 9,
- 'ð–«°' => 1,
- 'ð–«±' => 1,
- 'ð–«²' => 1,
- 'ð–«³' => 1,
- 'ð–«´' => 1,
- 'ð–¬°' => 230,
- '𖬱' => 230,
- '𖬲' => 230,
- '𖬳' => 230,
- 'ð–¬´' => 230,
- '𖬵' => 230,
- '𖬶' => 230,
- 'ð–¿°' => 6,
- 'ð–¿±' => 6,
- '𛲞' => 1,
- '�' => 216,
- '�' => 216,
- '�' => 1,
- '�' => 1,
- '�' => 1,
- 'ð�…' => 226,
- '�' => 216,
- '�' => 216,
- '�' => 216,
- '�' => 216,
- '�' => 216,
- '�' => 220,
- '�' => 220,
- '�' => 220,
- '�' => 220,
- '�' => 220,
- '�' => 220,
- '�' => 220,
- '�' => 220,
- '�' => 230,
- '�' => 230,
- '�' => 230,
- '�' => 230,
- '�' => 230,
- '�' => 220,
- '�' => 220,
- '�' => 230,
- '�' => 230,
- '�' => 230,
- 'ð�†' => 230,
- '�' => 230,
- '�' => 230,
- '�' => 230,
- '𞀀' => 230,
- '�' => 230,
- '𞀂' => 230,
- '𞀃' => 230,
- '𞀄' => 230,
- '𞀅' => 230,
- '𞀆' => 230,
- '𞀈' => 230,
- '𞀉' => 230,
- '𞀊' => 230,
- '𞀋' => 230,
- '𞀌' => 230,
- '�' => 230,
- '𞀎' => 230,
- '�' => 230,
- '�' => 230,
- '𞀑' => 230,
- '𞀒' => 230,
- '𞀓' => 230,
- '𞀔' => 230,
- '𞀕' => 230,
- '𞀖' => 230,
- '𞀗' => 230,
- '𞀘' => 230,
- '𞀛' => 230,
- '𞀜' => 230,
- '�' => 230,
- '𞀞' => 230,
- '𞀟' => 230,
- '𞀠' => 230,
- '𞀡' => 230,
- '𞀣' => 230,
- '𞀤' => 230,
- '𞀦' => 230,
- '𞀧' => 230,
- '𞀨' => 230,
- '𞀩' => 230,
- '𞀪' => 230,
- 'ðž„°' => 230,
- '𞄱' => 230,
- '𞄲' => 230,
- '𞄳' => 230,
- 'ðž„´' => 230,
- '𞄵' => 230,
- '𞄶' => 230,
- '𞋬' => 230,
- 'ðž‹' => 230,
- 'ðž‹®' => 230,
- '𞋯' => 230,
- '�' => 220,
- '𞣑' => 220,
- '𞣒' => 220,
- '𞣓' => 220,
- '𞣔' => 220,
- '𞣕' => 220,
- '𞣖' => 220,
- '𞥄' => 230,
- '𞥅' => 230,
- '𞥆' => 230,
- '𞥇' => 230,
- '𞥈' => 230,
- '𞥉' => 230,
- '𞥊' => 7,
- );
- <?php
- return array (
- 'Â ' => ' ',
- '¨' => ' ̈',
- 'ª' => 'a',
- '¯' => ' ̄',
- '²' => '2',
- '³' => '3',
- '´' => ' �',
- 'µ' => 'μ',
- '¸' => ' ̧',
- '¹' => '1',
- 'º' => 'o',
- '¼' => '1�4',
- '½' => '1�2',
- '¾' => '3�4',
- 'IJ' => 'IJ',
- 'ij' => 'ij',
- 'Ŀ' => 'L·',
- 'ŀ' => 'l·',
- 'ʼn' => 'ʼn',
- 'Å¿' => 's',
- 'DŽ' => 'DŽ',
- 'Dž' => 'Dž',
- 'dž' => 'dž',
- 'LJ' => 'LJ',
- 'Lj' => 'Lj',
- 'lj' => 'lj',
- 'ÇŠ' => 'NJ',
- 'Ç‹' => 'Nj',
- 'nj' => 'nj',
- 'DZ' => 'DZ',
- 'Dz' => 'Dz',
- 'dz' => 'dz',
- 'Ê°' => 'h',
- 'ʱ' => 'ɦ',
- 'ʲ' => 'j',
- 'ʳ' => 'r',
- 'ʴ' => 'ɹ',
- 'ʵ' => 'ɻ',
- 'ʶ' => '�',
- 'Ê·' => 'w',
- 'ʸ' => 'y',
- '˘' => ' ̆',
- '˙' => ' ̇',
- 'Ëš' => ' ÌŠ',
- '˛' => ' ̨',
- '˜' => ' ̃',
- '�' => ' ̋',
- 'Ë ' => 'É£',
- 'Ë¡' => 'l',
- 'Ë¢' => 's',
- 'Ë£' => 'x',
- 'ˤ' => 'ʕ',
- 'ͺ' => ' ͅ',
- '΄' => ' �',
- '΅' => ' ̈�',
- '�' => 'β',
- 'ϑ' => 'θ',
- 'Ï’' => 'Î¥',
- 'ϓ' => 'Υ�',
- 'ϔ' => 'Ϋ',
- 'ϕ' => 'φ',
- 'Ï–' => 'Ï€',
- 'ϰ' => 'κ',
- 'ϱ' => '�',
- 'ϲ' => 'ς',
- 'ϴ' => 'Θ',
- 'ϵ' => 'ε',
- 'Ϲ' => 'Σ',
- 'Ö‡' => 'Õ¥Ö‚',
- 'ٵ' => 'اٴ',
- 'ٶ' => 'وٴ',
- 'Ù·' => 'Û‡Ù´',
- 'ٸ' => 'يٴ',
- 'ำ' => '�า',
- 'ຳ' => '�າ',
- 'ໜ' => 'ຫນ',
- '�' => 'ຫມ',
- '༌' => '་',
- 'ཷ' => 'ྲཱྀ',
- 'ཹ' => 'ླཱྀ',
- 'ჼ' => 'ნ',
- 'á´¬' => 'A',
- 'á´' => 'Æ',
- 'á´®' => 'B',
- 'á´°' => 'D',
- 'á´±' => 'E',
- 'á´²' => 'ÆŽ',
- 'á´³' => 'G',
- 'á´´' => 'H',
- 'á´µ' => 'I',
- 'á´¶' => 'J',
- 'á´·' => 'K',
- 'á´¸' => 'L',
- 'á´¹' => 'M',
- 'á´º' => 'N',
- 'á´¼' => 'O',
- 'á´½' => 'È¢',
- 'á´¾' => 'P',
- 'á´¿' => 'R',
- 'áµ€' => 'T',
- '�' => 'U',
- 'ᵂ' => 'W',
- 'ᵃ' => 'a',
- 'ᵄ' => '�',
- 'áµ…' => 'É‘',
- 'ᵆ' => 'ᴂ',
- 'ᵇ' => 'b',
- 'ᵈ' => 'd',
- 'ᵉ' => 'e',
- 'ᵊ' => 'ə',
- 'ᵋ' => 'ɛ',
- 'ᵌ' => 'ɜ',
- '�' => 'g',
- '�' => 'k',
- '�' => 'm',
- 'ᵑ' => 'ŋ',
- 'áµ’' => 'o',
- 'ᵓ' => 'ɔ',
- 'áµ”' => 'á´–',
- 'ᵕ' => 'ᴗ',
- 'áµ–' => 'p',
- 'áµ—' => 't',
- 'ᵘ' => 'u',
- 'áµ™' => 'á´�',
- 'ᵚ' => 'ɯ',
- 'áµ›' => 'v',
- 'ᵜ' => 'ᴥ',
- '�' => 'β',
- 'ᵞ' => 'γ',
- 'ᵟ' => 'δ',
- 'ᵠ' => 'φ',
- 'ᵡ' => 'χ',
- 'áµ¢' => 'i',
- 'áµ£' => 'r',
- 'ᵤ' => 'u',
- 'áµ¥' => 'v',
- 'ᵦ' => 'β',
- 'ᵧ' => 'γ',
- 'ᵨ' => '�',
- 'ᵩ' => 'φ',
- 'ᵪ' => 'χ',
- 'ᵸ' => 'н',
- 'ᶛ' => 'ɒ',
- 'ᶜ' => 'c',
- '�' => 'ɕ',
- 'ᶞ' => 'ð',
- 'ᶟ' => 'ɜ',
- 'ᶠ' => 'f',
- 'ᶡ' => 'ɟ',
- 'ᶢ' => 'ɡ',
- 'ᶣ' => 'ɥ',
- 'ᶤ' => 'ɨ',
- 'ᶥ' => 'ɩ',
- 'ᶦ' => 'ɪ',
- 'ᶧ' => 'ᵻ',
- 'ᶨ' => '�',
- 'ᶩ' => 'É',
- 'ᶪ' => 'ᶅ',
- 'ᶫ' => 'ʟ',
- 'ᶬ' => 'ɱ',
- 'á¶' => 'É°',
- 'ᶮ' => 'ɲ',
- 'ᶯ' => 'ɳ',
- 'ᶰ' => 'ɴ',
- 'ᶱ' => 'ɵ',
- 'ᶲ' => 'ɸ',
- 'ᶳ' => 'ʂ',
- 'ᶴ' => 'ʃ',
- 'ᶵ' => 'ƫ',
- 'ᶶ' => 'ʉ',
- 'ᶷ' => 'ʊ',
- 'ᶸ' => 'ᴜ',
- 'ᶹ' => 'ʋ',
- 'ᶺ' => 'ʌ',
- 'ᶻ' => 'z',
- 'ᶼ' => '�',
- 'ᶽ' => 'ʑ',
- 'ᶾ' => 'ʒ',
- 'ᶿ' => 'θ',
- 'ẚ' => 'aʾ',
- 'ẛ' => 'ṡ',
- 'á¾½' => ' Ì“',
- '᾿' => ' ̓',
- 'á¿€' => ' Í‚',
- '�' => ' ̈͂',
- '�' => ' ̓̀',
- '῎' => ' ̓�',
- '�' => ' ̓͂',
- '�' => ' ̔̀',
- '῞' => ' ̔�',
- '῟' => ' ̔͂',
- 'á¿' => ' ̈̀',
- '΅' => ' ̈�',
- '´' => ' �',
- '῾' => ' ̔',
- ' ' => ' ',
- '�' => ' ',
- ' ' => ' ',
- ' ' => ' ',
- ' ' => ' ',
- ' ' => ' ',
- ' ' => ' ',
- ' ' => ' ',
- ' ' => ' ',
- ' ' => ' ',
- ' ' => ' ',
- '‑' => '�',
- '‗' => ' ̳',
- '․' => '.',
- '‥' => '..',
- '…' => '...',
- ' ' => ' ',
- '″' => '′′',
- '‴' => '′′′',
- '‶' => '‵‵',
- '‷' => '‵‵‵',
- '‼' => '!!',
- '‾' => ' ̅',
- '�' => '??',
- '�' => '?!',
- '�' => '!?',
- '�' => '′′′′',
- '�' => ' ',
- '�' => '0',
- '�' => 'i',
- '�' => '4',
- '�' => '5',
- '�' => '6',
- '�' => '7',
- '�' => '8',
- '�' => '9',
- '�' => '+',
- '�' => '−',
- '�' => '=',
- '�' => '(',
- '�' => ')',
- '�' => 'n',
- 'â‚€' => '0',
- '�' => '1',
- 'â‚‚' => '2',
- '₃' => '3',
- 'â‚„' => '4',
- 'â‚…' => '5',
- '₆' => '6',
- '₇' => '7',
- '₈' => '8',
- '₉' => '9',
- 'â‚Š' => '+',
- '₋' => '−',
- '₌' => '=',
- '�' => '(',
- 'â‚Ž' => ')',
- '�' => 'a',
- 'â‚‘' => 'e',
- 'â‚’' => 'o',
- 'â‚“' => 'x',
- 'â‚”' => 'É™',
- 'â‚•' => 'h',
- 'â‚–' => 'k',
- 'â‚—' => 'l',
- 'ₘ' => 'm',
- 'â‚™' => 'n',
- 'â‚š' => 'p',
- 'â‚›' => 's',
- 'ₜ' => 't',
- '₨' => 'Rs',
- 'â„€' => 'a/c',
- '�' => 'a/s',
- 'â„‚' => 'C',
- '℃' => '°C',
- 'â„…' => 'c/o',
- '℆' => 'c/u',
- 'ℇ' => '�',
- '℉' => '°F',
- 'â„Š' => 'g',
- 'â„‹' => 'H',
- 'ℌ' => 'H',
- '�' => 'H',
- 'â„Ž' => 'h',
- '�' => 'ħ',
- '�' => 'I',
- 'â„‘' => 'I',
- 'â„’' => 'L',
- 'â„“' => 'l',
- 'â„•' => 'N',
- 'â„–' => 'No',
- 'â„™' => 'P',
- 'â„š' => 'Q',
- 'â„›' => 'R',
- 'ℜ' => 'R',
- '�' => 'R',
- 'â„ ' => 'SM',
- 'â„¡' => 'TEL',
- 'â„¢' => 'TM',
- 'ℤ' => 'Z',
- 'ℨ' => 'Z',
- 'ℬ' => 'B',
- 'â„' => 'C',
- 'ℯ' => 'e',
- 'â„°' => 'E',
- 'ℱ' => 'F',
- 'ℳ' => 'M',
- 'â„´' => 'o',
- 'ℵ' => '�',
- 'ℶ' => 'ב',
- 'â„·' => '×’',
- 'ℸ' => 'ד',
- 'ℹ' => 'i',
- 'â„»' => 'FAX',
- 'ℼ' => 'π',
- 'ℽ' => 'γ',
- 'ℾ' => 'Γ',
- 'â„¿' => 'Î ',
- '⅀' => '∑',
- 'â……' => 'D',
- 'â…†' => 'd',
- 'â…‡' => 'e',
- 'â…ˆ' => 'i',
- 'â…‰' => 'j',
- '�' => '1�7',
- '⅑' => '1�9',
- '⅒' => '1�10',
- '⅓' => '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�',
- 'â… ' => 'I',
- 'â…¡' => 'II',
- 'â…¢' => 'III',
- 'â…£' => 'IV',
- 'â…¤' => 'V',
- 'â…¥' => 'VI',
- 'â…¦' => 'VII',
- 'â…§' => 'VIII',
- 'â…¨' => 'IX',
- 'â…©' => 'X',
- 'â…ª' => 'XI',
- 'â…«' => 'XII',
- 'â…¬' => 'L',
- 'â…' => 'C',
- 'â…®' => 'D',
- 'â…¯' => 'M',
- 'â…°' => 'i',
- 'â…±' => 'ii',
- 'â…²' => 'iii',
- 'â…³' => 'iv',
- 'â…´' => 'v',
- 'â…µ' => 'vi',
- 'â…¶' => 'vii',
- 'â…·' => 'viii',
- 'â…¸' => 'ix',
- 'â…¹' => 'x',
- 'â…º' => 'xi',
- 'â…»' => 'xii',
- 'â…¼' => 'l',
- 'â…½' => 'c',
- 'â…¾' => 'd',
- 'â…¿' => 'm',
- '↉' => '0�3',
- '∬' => '∫∫',
- 'âˆ' => '∫∫∫',
- '∯' => '∮∮',
- '∰' => '∮∮∮',
- 'â‘ ' => '1',
- 'â‘¡' => '2',
- 'â‘¢' => '3',
- 'â‘£' => '4',
- '⑤' => '5',
- 'â‘¥' => '6',
- '⑦' => '7',
- '⑧' => '8',
- '⑨' => '9',
- 'â‘©' => '10',
- '⑪' => '11',
- 'â‘«' => '12',
- '⑬' => '13',
- 'â‘' => '14',
- 'â‘®' => '15',
- '⑯' => '16',
- 'â‘°' => '17',
- '⑱' => '18',
- '⑲' => '19',
- '⑳' => '20',
- 'â‘´' => '(1)',
- '⑵' => '(2)',
- '⑶' => '(3)',
- 'â‘·' => '(4)',
- '⑸' => '(5)',
- '⑹' => '(6)',
- '⑺' => '(7)',
- 'â‘»' => '(8)',
- '⑼' => '(9)',
- '⑽' => '(10)',
- '⑾' => '(11)',
- 'â‘¿' => '(12)',
- 'â’€' => '(13)',
- 'â’�' => '(14)',
- 'â’‚' => '(15)',
- 'â’ƒ' => '(16)',
- 'â’„' => '(17)',
- 'â’…' => '(18)',
- 'â’†' => '(19)',
- 'â’‡' => '(20)',
- 'â’ˆ' => '1.',
- 'â’‰' => '2.',
- 'â’Š' => '3.',
- 'â’‹' => '4.',
- '⒌' => '5.',
- 'â’�' => '6.',
- 'â’Ž' => '7.',
- 'â’�' => '8.',
- 'â’�' => '9.',
- 'â’‘' => '10.',
- 'â’’' => '11.',
- 'â’“' => '12.',
- 'â’”' => '13.',
- 'â’•' => '14.',
- 'â’–' => '15.',
- 'â’—' => '16.',
- 'â’˜' => '17.',
- 'â’™' => '18.',
- 'â’š' => '19.',
- 'â’›' => '20.',
- '⒜' => '(a)',
- 'â’�' => '(b)',
- 'â’ž' => '(c)',
- 'â’Ÿ' => '(d)',
- 'â’ ' => '(e)',
- 'â’¡' => '(f)',
- 'â’¢' => '(g)',
- 'â’£' => '(h)',
- 'â’¤' => '(i)',
- 'â’¥' => '(j)',
- 'â’¦' => '(k)',
- 'â’§' => '(l)',
- 'â’¨' => '(m)',
- 'â’©' => '(n)',
- 'â’ª' => '(o)',
- 'â’«' => '(p)',
- 'â’¬' => '(q)',
- 'â’' => '(r)',
- 'â’®' => '(s)',
- 'â’¯' => '(t)',
- 'â’°' => '(u)',
- 'â’±' => '(v)',
- 'â’²' => '(w)',
- 'â’³' => '(x)',
- 'â’´' => '(y)',
- 'â’µ' => '(z)',
- 'â’¶' => 'A',
- 'â’·' => 'B',
- 'â’¸' => 'C',
- 'â’¹' => 'D',
- 'â’º' => 'E',
- 'â’»' => 'F',
- 'â’¼' => 'G',
- 'â’½' => 'H',
- 'â’¾' => 'I',
- 'â’¿' => 'J',
- 'â“€' => 'K',
- '�' => 'L',
- 'â“‚' => 'M',
- 'Ⓝ' => 'N',
- 'â“„' => 'O',
- 'â“…' => 'P',
- 'Ⓠ' => 'Q',
- 'Ⓡ' => 'R',
- 'Ⓢ' => 'S',
- 'Ⓣ' => 'T',
- 'â“Š' => 'U',
- 'â“‹' => 'V',
- 'Ⓦ' => 'W',
- '�' => 'X',
- 'â“Ž' => 'Y',
- '�' => 'Z',
- '�' => 'a',
- 'â“‘' => 'b',
- 'â“’' => 'c',
- 'â““' => 'd',
- 'â“”' => 'e',
- 'â“•' => 'f',
- 'â“–' => 'g',
- 'â“—' => 'h',
- 'ⓘ' => 'i',
- 'â“™' => 'j',
- 'â“š' => 'k',
- 'â“›' => 'l',
- 'ⓜ' => 'm',
- '�' => 'n',
- 'â“ž' => 'o',
- 'â“Ÿ' => 'p',
- 'â“ ' => 'q',
- 'â“¡' => 'r',
- 'â“¢' => 's',
- 'â“£' => 't',
- 'ⓤ' => 'u',
- 'â“¥' => 'v',
- 'ⓦ' => 'w',
- 'ⓧ' => 'x',
- 'ⓨ' => 'y',
- 'â“©' => 'z',
- '⓪' => '0',
- '⨌' => '∫∫∫∫',
- 'â©´' => '::=',
- '⩵' => '==',
- '⩶' => '===',
- 'â±¼' => 'j',
- 'â±½' => 'V',
- 'ⵯ' => 'ⵡ',
- '⺟' => '�',
- '⻳' => '龟',
- '⼀' => '一',
- '�' => '丨',
- '⼂' => '丶',
- '⼃' => '丿',
- '⼄' => '乙',
- '⼅' => '亅',
- '⼆' => '二',
- '⼇' => 'äº ',
- '⼈' => '人',
- '⼉' => '儿',
- '⼊' => '入',
- '⼋' => '八',
- '⼌' => '冂',
- '�' => '冖',
- '⼎' => '冫',
- 'â¼�' => 'å‡ ',
- '�' => '凵',
- '⼑' => '刀',
- '⼒' => '力',
- '⼓' => '勹',
- '⼔' => '匕',
- '⼕' => '匚',
- '⼖' => '匸',
- '⼗' => '�',
- '⼘' => '�',
- '⼙' => '�',
- '⼚' => '厂',
- '⼛' => '厶',
- '⼜' => '�',
- '�' => '�',
- '⼞' => '囗',
- '⼟' => '土',
- '⼠' => '士',
- '⼡' => '夂',
- '⼢' => '夊',
- '⼣' => '夕',
- '⼤' => '大',
- '⼥' => '女',
- '⼦' => 'å�',
- '⼧' => '宀',
- '⼨' => '寸',
- '⼩' => '�',
- '⼪' => '尢',
- '⼫' => '尸',
- '⼬' => '屮',
- 'â¼' => 'å±±',
- 'â¼®' => 'å·›',
- '⼯' => '工',
- 'â¼°' => 'å·±',
- 'â¼±' => 'å·¾',
- 'â¼²' => 'å¹²',
- '⼳' => '幺',
- '⼴' => '广',
- 'â¼µ' => 'å»´',
- '⼶' => '廾',
- '⼷' => '弋',
- '⼸' => '弓',
- '⼹' => '�',
- '⼺' => '彡',
- 'â¼»' => 'å½³',
- '⼼' => '心',
- '⼽' => '戈',
- '⼾' => '戶',
- '⼿' => '手',
- '⽀' => '支',
- '�' => '攴',
- '⽂' => '文',
- '⽃' => '斗',
- '⽄' => '斤',
- 'â½…' => 'æ–¹',
- '⽆' => 'æ— ',
- '⽇' => '日',
- '⽈' => '曰',
- '⽉' => '月',
- '⽊' => '木',
- '⽋' => 'æ¬ ',
- '⽌' => 'æ¢',
- 'â½�' => 'æ¹',
- '⽎' => '殳',
- '�' => '毋',
- '�' => '比',
- '⽑' => '毛',
- 'â½’' => 'æ°�',
- '⽓' => '气',
- 'â½”' => 'æ°´',
- '⽕' => '�',
- '⽖' => '爪',
- '⽗' => '父',
- '⽘' => '爻',
- '⽙' => '爿',
- '⽚' => '片',
- '⽛' => '牙',
- '⽜' => '牛',
- '�' => '犬',
- '⽞' => '玄',
- '⽟' => '玉',
- '⽠' => '瓜',
- '⽡' => '瓦',
- '⽢' => '甘',
- '⽣' => '生',
- '⽤' => '用',
- 'â½¥' => 'ç”°',
- '⽦' => '疋',
- '⽧' => '疒',
- '⽨' => '癶',
- '⽩' => '白',
- '⽪' => '皮',
- '⽫' => '皿',
- '⽬' => '目',
- 'â½' => '矛',
- '⽮' => '矢',
- '⽯' => '石',
- '⽰' => '示',
- '⽱' => '禸',
- '⽲' => '禾',
- 'â½³' => 'ç©´',
- 'â½´' => 'ç«‹',
- '⽵' => '竹',
- '⽶' => '米',
- '⽷' => '糸',
- '⽸' => '缶',
- '⽹' => '网',
- '⽺' => '羊',
- 'â½»' => 'ç¾½',
- '⽼' => '�',
- '⽽' => '而',
- '⽾' => '耒',
- '⽿' => '耳',
- '⾀' => '�',
- '�' => '肉',
- '⾂' => '臣',
- '⾃' => '自',
- '⾄' => '至',
- '⾅' => '臼',
- '⾆' => '舌',
- '⾇' => '舛',
- '⾈' => '舟',
- '⾉' => '艮',
- '⾊' => '色',
- '⾋' => '艸',
- '⾌' => '�',
- '�' => '虫',
- '⾎' => '血',
- '�' => '行',
- '�' => '衣',
- '⾑' => '襾',
- '⾒' => '見',
- '⾓' => '角',
- '⾔' => '言',
- '⾕' => '谷',
- '⾖' => '豆',
- '⾗' => '豕',
- '⾘' => '豸',
- '⾙' => '�',
- '⾚' => '赤',
- 'â¾›' => 'èµ°',
- '⾜' => '足',
- '�' => '身',
- '⾞' => '車',
- '⾟' => '辛',
- 'â¾ ' => 'è¾°',
- '⾡' => '辵',
- 'â¾¢' => 'é‚‘',
- 'â¾£' => 'é…‰',
- '⾤' => '釆',
- '⾥' => '里',
- '⾦' => '金',
- '⾧' => '長',
- '⾨' => '門',
- '⾩' => '阜',
- '⾪' => '隶',
- '⾫' => '隹',
- '⾬' => '雨',
- 'â¾' => 'é�‘',
- '⾮' => '�',
- '⾯' => '�',
- '⾰' => '�',
- '⾱' => '韋',
- 'â¾²' => 'éŸ',
- '⾳' => '音',
- 'â¾´' => 'é �',
- '⾵' => '風',
- '⾶' => '飛',
- '⾷' => '食',
- '⾸' => '首',
- '⾹' => '香',
- '⾺' => '馬',
- '⾻' => '骨',
- '⾼' => '高',
- 'â¾½' => 'é«Ÿ',
- '⾾' => '鬥',
- '⾿' => '鬯',
- '⿀' => '鬲',
- '�' => '鬼',
- 'â¿‚' => 'éš',
- '⿃' => '鳥',
- 'â¿„' => 'é¹µ',
- '⿅' => '鹿',
- '⿆' => '麥',
- '⿇' => '麻',
- '⿈' => '黃',
- '⿉' => '�',
- '⿊' => '黑',
- '⿋' => '黹',
- '⿌' => '黽',
- '�' => '鼎',
- '⿎' => '鼓',
- 'â¿�' => 'é¼ ',
- '�' => '鼻',
- '⿑' => '齊',
- 'â¿’' => 'é½’',
- '⿓' => '�',
- '⿔' => '龜',
- 'â¿•' => 'é¾ ',
- ' ' => ' ',
- '〶' => '〒',
- '〸' => '�',
- '〹' => '�',
- '〺' => '�',
- 'ã‚›' => ' ã‚™',
- '゜' => ' ゚',
- 'ゟ' => 'より',
- 'ヿ' => 'コト',
- 'ㄱ' => 'ᄀ',
- 'ㄲ' => '�',
- 'ㄳ' => 'ᆪ',
- 'ã„´' => 'á„‚',
- 'ㄵ' => 'ᆬ',
- 'ㄶ' => 'á†',
- 'ㄷ' => 'ᄃ',
- 'ㄸ' => 'ᄄ',
- 'ㄹ' => 'ᄅ',
- 'ㄺ' => 'ᆰ',
- 'ㄻ' => 'ᆱ',
- 'ㄼ' => 'ᆲ',
- 'ㄽ' => 'ᆳ',
- 'ㄾ' => 'ᆴ',
- 'ㄿ' => 'ᆵ',
- 'ã…€' => 'á„š',
- '�' => 'ᄆ',
- 'ㅂ' => 'ᄇ',
- 'ㅃ' => 'ᄈ',
- 'ã…„' => 'á„¡',
- 'ㅅ' => 'ᄉ',
- 'ã…†' => 'á„Š',
- 'ã…‡' => 'á„‹',
- 'ㅈ' => 'ᄌ',
- 'ㅉ' => '�',
- 'ã…Š' => 'á„Ž',
- 'ㅋ' => '�',
- 'ㅌ' => '�',
- 'ã…�' => 'á„‘',
- 'ã…Ž' => 'á„’',
- 'ã…�' => 'á…¡',
- 'ã…�' => 'á…¢',
- 'ã…‘' => 'á…£',
- 'ã…’' => 'á…¤',
- 'ã…“' => 'á…¥',
- 'ã…”' => 'á…¦',
- 'ã…•' => 'á…§',
- 'ã…–' => 'á…¨',
- 'ã…—' => 'á…©',
- 'ã…˜' => 'á…ª',
- 'ã…™' => 'á…«',
- 'ã…š' => 'á…¬',
- 'ã…›' => 'á…',
- 'ㅜ' => 'ᅮ',
- 'ã…�' => 'á…¯',
- 'ã…ž' => 'á…°',
- 'ã…Ÿ' => 'á…±',
- 'ã… ' => 'á…²',
- 'ã…¡' => 'á…³',
- 'ã…¢' => 'á…´',
- 'ã…£' => 'á…µ',
- 'ã…¤' => 'á… ',
- 'ã…¥' => 'á„”',
- 'ã…¦' => 'á„•',
- 'ㅧ' => 'ᇇ',
- 'ㅨ' => 'ᇈ',
- 'ㅩ' => 'ᇌ',
- 'ㅪ' => 'ᇎ',
- 'ㅫ' => 'ᇓ',
- 'ㅬ' => 'ᇗ',
- 'ã…' => 'ᇙ',
- 'ㅮ' => 'ᄜ',
- 'ㅯ' => '�',
- 'ㅰ' => 'ᇟ',
- 'ㅱ' => '�',
- 'ã…²' => 'á„ž',
- 'ã…³' => 'á„ ',
- 'ã…´' => 'á„¢',
- 'ã…µ' => 'á„£',
- 'ㅶ' => 'ᄧ',
- 'ã…·' => 'á„©',
- 'ã…¸' => 'á„«',
- 'ㅹ' => 'ᄬ',
- 'ã…º' => 'á„',
- 'ã…»' => 'á„®',
- 'ㅼ' => 'ᄯ',
- 'ㅽ' => 'ᄲ',
- 'ㅾ' => 'ᄶ',
- 'ã…¿' => 'á…€',
- 'ㆀ' => 'ᅇ',
- '�' => 'ᅌ',
- 'ㆂ' => 'ᇱ',
- 'ㆃ' => 'ᇲ',
- 'ㆄ' => 'ᅗ',
- 'ㆅ' => 'ᅘ',
- 'ㆆ' => 'ᅙ',
- 'ㆇ' => 'ᆄ',
- 'ㆈ' => 'ᆅ',
- 'ㆉ' => 'ᆈ',
- 'ㆊ' => 'ᆑ',
- 'ㆋ' => 'ᆒ',
- 'ㆌ' => 'ᆔ',
- '�' => 'ᆞ',
- 'ㆎ' => 'ᆡ',
- '㆒' => '一',
- '㆓' => '二',
- '㆔' => '三',
- '㆕' => '四',
- '㆖' => '上',
- '㆗' => 'ä¸',
- '㆘' => '下',
- '㆙' => '甲',
- '㆚' => '乙',
- '㆛' => '丙',
- '㆜' => '�',
- '�' => '天',
- '㆞' => '地',
- '㆟' => '人',
- '㈀' => '(ᄀ)',
- '�' => '(ᄂ)',
- '㈂' => '(ᄃ)',
- '㈃' => '(ᄅ)',
- '㈄' => '(ᄆ)',
- '㈅' => '(ᄇ)',
- '㈆' => '(ᄉ)',
- '㈇' => '(ᄋ)',
- '㈈' => '(ᄌ)',
- '㈉' => '(ᄎ)',
- '㈊' => '(�)',
- '㈋' => '(�)',
- '㈌' => '(ᄑ)',
- '�' => '(ᄒ)',
- '㈎' => '(가)',
- '�' => '(나)',
- '�' => '(다)',
- '㈑' => '(라)',
- '㈒' => '(마)',
- '㈓' => '(바)',
- '㈔' => '(사)',
- '㈕' => '(아)',
- '㈖' => '(자)',
- '㈗' => '(차)',
- '㈘' => '(�ᅡ)',
- '㈙' => '(�ᅡ)',
- '㈚' => '(파)',
- '㈛' => '(하)',
- '㈜' => '(주)',
- '�' => '(오전)',
- '㈞' => '(오후)',
- '㈠' => '(一)',
- '㈡' => '(二)',
- '㈢' => '(三)',
- '㈣' => '(四)',
- '㈤' => '(五)',
- '㈥' => '(å…)',
- '㈦' => '(七)',
- '㈧' => '(八)',
- '㈨' => '(�)',
- '㈩' => '(�)',
- '㈪' => '(月)',
- '㈫' => '(�)',
- '㈬' => '(水)',
- 'ãˆ' => '(木)',
- '㈮' => '(金)',
- '㈯' => '(土)',
- '㈰' => '(日)',
- '㈱' => '(æ ª)',
- '㈲' => '(有)',
- '㈳' => '(社)',
- '㈴' => '(�)',
- '㈵' => '(特)',
- '㈶' => '(財)',
- '㈷' => '(�)',
- '㈸' => '(労)',
- '㈹' => '(代)',
- '㈺' => '(呼)',
- '㈻' => '(å¦)',
- '㈼' => '(監)',
- '㈽' => '(�)',
- '㈾' => '(資)',
- '㈿' => '(�)',
- '㉀' => '(ç¥)',
- '�' => '(休)',
- '㉂' => '(自)',
- '㉃' => '(至)',
- '㉄' => '�',
- '㉅' => '幼',
- '㉆' => '文',
- '㉇' => '�',
- '�' => 'PTE',
- '㉑' => '21',
- '㉒' => '22',
- '㉓' => '23',
- '㉔' => '24',
- '㉕' => '25',
- '㉖' => '26',
- '㉗' => '27',
- '㉘' => '28',
- '㉙' => '29',
- '㉚' => '30',
- '㉛' => '31',
- '㉜' => '32',
- '�' => '33',
- '㉞' => '34',
- '㉟' => '35',
- '㉠' => 'ᄀ',
- '㉡' => 'ᄂ',
- '㉢' => 'ᄃ',
- '㉣' => 'ᄅ',
- '㉤' => 'ᄆ',
- '㉥' => 'ᄇ',
- '㉦' => 'ᄉ',
- '㉧' => 'ᄋ',
- '㉨' => 'ᄌ',
- '㉩' => 'ᄎ',
- '㉪' => '�',
- '㉫' => '�',
- '㉬' => 'ᄑ',
- 'ã‰' => 'á„’',
- '㉮' => '가',
- '㉯' => '나',
- '㉰' => '다',
- '㉱' => '라',
- '㉲' => '마',
- '㉳' => '바',
- '㉴' => '사',
- '㉵' => '아',
- '㉶' => '자',
- '㉷' => '차',
- '㉸' => '�ᅡ',
- '㉹' => '�ᅡ',
- '㉺' => '파',
- '㉻' => '하',
- '㉼' => '참고',
- '㉽' => '주의',
- '㉾' => '우',
- '㊀' => '一',
- '�' => '二',
- '㊂' => '三',
- '㊃' => '四',
- '㊄' => '五',
- '㊅' => 'å…',
- '㊆' => '七',
- '㊇' => '八',
- '㊈' => '�',
- '㊉' => '�',
- '㊊' => '月',
- '㊋' => '�',
- '㊌' => '水',
- '�' => '木',
- '㊎' => '金',
- '�' => '土',
- '�' => '日',
- '㊑' => 'æ ª',
- '㊒' => '有',
- '㊓' => '社',
- '㊔' => '�',
- '㊕' => '特',
- '㊖' => '財',
- '㊗' => '�',
- '㊘' => '労',
- '㊙' => '秘',
- '㊚' => '男',
- '㊛' => '女',
- '㊜' => '�',
- '�' => '優',
- '㊞' => '�',
- '㊟' => '注',
- '㊠' => 'é …',
- '㊡' => '休',
- '㊢' => '写',
- '㊣' => 'æ£',
- '㊤' => '上',
- '㊥' => 'ä¸',
- '㊦' => '下',
- '㊧' => '左',
- '㊨' => '�',
- '㊩' => '医',
- '㊪' => '宗',
- '㊫' => 'å¦',
- '㊬' => '監',
- 'ãŠ' => 'ä¼�',
- '㊮' => '資',
- '㊯' => '�',
- '㊰' => '夜',
- '㊱' => '36',
- '㊲' => '37',
- '㊳' => '38',
- '㊴' => '39',
- '㊵' => '40',
- '㊶' => '41',
- '㊷' => '42',
- '㊸' => '43',
- '㊹' => '44',
- '㊺' => '45',
- '㊻' => '46',
- '㊼' => '47',
- '㊽' => '48',
- '㊾' => '49',
- '㊿' => '50',
- '㋀' => '1月',
- '�' => '2月',
- '㋂' => '3月',
- '㋃' => '4月',
- '㋄' => '5月',
- '㋅' => '6月',
- '㋆' => '7月',
- '㋇' => '8月',
- '㋈' => '9月',
- '㋉' => '10月',
- '㋊' => '11月',
- '㋋' => '12月',
- '㋌' => 'Hg',
- '�' => 'erg',
- 'ã‹Ž' => 'eV',
- '�' => 'LTD',
- '�' => 'ア',
- '㋑' => 'イ',
- '㋒' => 'ウ',
- '㋓' => 'エ',
- '㋔' => 'オ',
- 'ã‹•' => 'ã‚«',
- 'ã‹–' => 'ã‚',
- '㋗' => 'ク',
- '㋘' => 'ケ',
- '㋙' => 'コ',
- '㋚' => 'サ',
- 'ã‹›' => 'ã‚·',
- '㋜' => 'ス',
- '�' => 'セ',
- '㋞' => 'ソ',
- 'ã‹Ÿ' => 'ã‚¿',
- '㋠' => '�',
- '㋡' => 'ツ',
- '㋢' => 'テ',
- '㋣' => 'ト',
- '㋤' => 'ナ',
- '㋥' => 'ニ',
- '㋦' => 'ヌ',
- '㋧' => '�',
- '㋨' => 'ノ',
- '㋩' => '�',
- '㋪' => 'ヒ',
- '㋫' => 'フ',
- '㋬' => 'ヘ',
- 'ã‹' => 'ホ',
- '㋮' => 'マ',
- '㋯' => 'ミ',
- '㋰' => 'ム',
- '㋱' => 'メ',
- '㋲' => 'モ',
- '㋳' => 'ヤ',
- '㋴' => 'ユ',
- '㋵' => 'ヨ',
- '㋶' => 'ラ',
- '㋷' => 'リ',
- '㋸' => 'ル',
- '㋹' => 'レ',
- '㋺' => 'ãƒ',
- '㋻' => 'ワ',
- '㋼' => 'ヰ',
- '㋽' => 'ヱ',
- '㋾' => 'ヲ',
- '㋿' => '令和',
- '㌀' => 'ア�゚ート',
- '�' => 'アルファ',
- '㌂' => 'アンペア',
- '㌃' => 'アール',
- '㌄' => 'イニング',
- '㌅' => 'イン�',
- '㌆' => 'ウォン',
- '㌇' => 'エスクード',
- '㌈' => 'エーカー',
- '㌉' => 'オンス',
- '㌊' => 'オーム',
- '㌋' => 'カイリ',
- '㌌' => 'カラット',
- 'ãŒ�' => 'ã‚«ãƒãƒªãƒ¼',
- '㌎' => 'ã‚«ã‚™ãƒãƒ³',
- '�' => 'ガンマ',
- 'ãŒ�' => 'ã‚゙ガ',
- '㌑' => 'ã‚゙ニー',
- '㌒' => 'ã‚ュリー',
- '㌓' => 'ã‚゙ルダー',
- '㌔' => 'ã‚ãƒ',
- '㌕' => 'ã‚ãƒã‚¯ã‚™ãƒ©ãƒ ',
- '㌖' => 'ã‚ãƒãƒ¡ãƒ¼ãƒˆãƒ«',
- '㌗' => 'ã‚ãƒãƒ¯ãƒƒãƒˆ',
- '㌘' => 'グラム',
- '㌙' => 'グラムトン',
- '㌚' => 'クルゼイãƒ',
- '㌛' => 'クãƒãƒ¼ãƒ�',
- '㌜' => 'ケース',
- '�' => 'コルナ',
- '㌞' => 'コーポ',
- '㌟' => 'サイクル',
- '㌠' => 'サン�ーム',
- '㌡' => 'シリング',
- '㌢' => 'セン�',
- '㌣' => 'セント',
- '㌤' => 'ダース',
- '㌥' => 'デシ',
- '㌦' => 'ドル',
- '㌧' => 'トン',
- '㌨' => 'ナノ',
- '㌩' => 'ノット',
- '㌪' => '�イツ',
- '㌫' => '�゚ーセント',
- '㌬' => '�゚ーツ',
- 'ãŒ' => 'ãƒ�゙ーレル',
- '㌮' => 'ピアストル',
- '㌯' => 'ピクル',
- '㌰' => 'ピコ',
- '㌱' => 'ビル',
- '㌲' => 'ファラッド',
- '㌳' => 'フィート',
- '㌴' => 'ブッシェル',
- '㌵' => 'フラン',
- '㌶' => 'ヘクタール',
- '㌷' => 'ペソ',
- '㌸' => 'ペニヒ',
- '㌹' => 'ヘルツ',
- '㌺' => 'ペンス',
- '㌻' => 'ページ',
- '㌼' => 'ベータ',
- '㌽' => 'ポイント',
- '㌾' => 'ボルト',
- '㌿' => 'ホン',
- '�' => 'ポンド',
- '�' => 'ホール',
- '�' => 'ホーン',
- 'ã�ƒ' => 'マイクãƒ',
- '�' => 'マイル',
- '�' => 'マッ�',
- '�' => 'マルク',
- '�' => 'マンション',
- 'ã�ˆ' => 'ミクãƒãƒ³',
- '�' => 'ミリ',
- '�' => 'ミリ�゙ール',
- '�' => 'メガ',
- '�' => 'メガトン',
- '�' => 'メートル',
- '�' => 'ヤード',
- '�' => 'ヤール',
- '�' => 'ユアン',
- '�' => 'リットル',
- '�' => 'リラ',
- '�' => 'ルピー',
- '�' => 'ルーブル',
- '�' => 'レム',
- '�' => 'レントゲン',
- '�' => 'ワット',
- '�' => '0点',
- '�' => '1点',
- '�' => '2点',
- '�' => '3点',
- '�' => '4点',
- '�' => '5点',
- '�' => '6点',
- '�' => '7点',
- 'ã� ' => '8点',
- '�' => '9点',
- '�' => '10点',
- '�' => '11点',
- '�' => '12点',
- '�' => '13点',
- '�' => '14点',
- '�' => '15点',
- '�' => '16点',
- '�' => '17点',
- '�' => '18点',
- '�' => '19点',
- '�' => '20点',
- 'ã�' => '21点',
- '�' => '22点',
- '�' => '23点',
- '�' => '24点',
- '�' => 'hPa',
- '�' => 'da',
- '�' => 'AU',
- '�' => 'bar',
- '�' => 'oV',
- '�' => 'pc',
- '�' => 'dm',
- '�' => 'dm2',
- '�' => 'dm3',
- '�' => 'IU',
- '�' => '平�',
- 'ã�¼' => 'æ˜å’Œ',
- 'ã�½' => '大æ£',
- '�' => '明治',
- 'ã�¿' => 'æ ªå¼�会社',
- '㎀' => 'pA',
- '�' => 'nA',
- '㎂' => 'μA',
- '㎃' => 'mA',
- '㎄' => 'kA',
- '㎅' => 'KB',
- '㎆' => 'MB',
- '㎇' => 'GB',
- '㎈' => 'cal',
- '㎉' => 'kcal',
- '㎊' => 'pF',
- '㎋' => 'nF',
- '㎌' => 'μF',
- '�' => 'μg',
- '㎎' => 'mg',
- '�' => 'kg',
- '�' => 'Hz',
- '㎑' => 'kHz',
- '㎒' => 'MHz',
- '㎓' => 'GHz',
- '㎔' => 'THz',
- '㎕' => 'μl',
- '㎖' => 'ml',
- '㎗' => 'dl',
- '㎘' => 'kl',
- '㎙' => 'fm',
- '㎚' => 'nm',
- '㎛' => 'μm',
- '㎜' => 'mm',
- '�' => 'cm',
- '㎞' => 'km',
- '㎟' => 'mm2',
- '㎠' => 'cm2',
- '㎡' => 'm2',
- '㎢' => 'km2',
- '㎣' => 'mm3',
- '㎤' => 'cm3',
- '㎥' => 'm3',
- '㎦' => 'km3',
- '㎧' => 'm∕s',
- '㎨' => 'm∕s2',
- '㎩' => 'Pa',
- '㎪' => 'kPa',
- '㎫' => 'MPa',
- '㎬' => 'GPa',
- 'ãŽ' => 'rad',
- '㎮' => 'rad∕s',
- '㎯' => 'rad∕s2',
- '㎰' => 'ps',
- '㎱' => 'ns',
- '㎲' => 'μs',
- '㎳' => 'ms',
- '㎴' => 'pV',
- '㎵' => 'nV',
- '㎶' => 'μV',
- '㎷' => 'mV',
- '㎸' => 'kV',
- '㎹' => 'MV',
- '㎺' => 'pW',
- '㎻' => 'nW',
- '㎼' => 'μW',
- '㎽' => 'mW',
- '㎾' => 'kW',
- '㎿' => 'MW',
- '�' => 'kΩ',
- '�' => 'MΩ',
- '�' => 'a.m.',
- '�' => 'Bq',
- '�' => 'cc',
- '�' => 'cd',
- '�' => 'C∕kg',
- '�' => 'Co.',
- '�' => 'dB',
- '�' => 'Gy',
- '�' => 'ha',
- '�' => 'HP',
- '�' => 'in',
- '�' => 'KK',
- '�' => 'KM',
- '�' => 'kt',
- '�' => 'lm',
- '�' => 'ln',
- '�' => 'log',
- '�' => 'lx',
- '�' => 'mb',
- '�' => 'mil',
- '�' => 'mol',
- '�' => 'PH',
- '�' => 'p.m.',
- '�' => 'PPM',
- '�' => 'PR',
- '�' => 'sr',
- '�' => 'Sv',
- '�' => 'Wb',
- '�' => 'V∕m',
- '�' => 'A∕m',
- 'ã� ' => '1æ—¥',
- '�' => '2日',
- '�' => '3日',
- '�' => '4日',
- '�' => '5日',
- '�' => '6日',
- '�' => '7日',
- '�' => '8日',
- '�' => '9日',
- '�' => '10日',
- '�' => '11日',
- '�' => '12日',
- '�' => '13日',
- 'ã�' => '14æ—¥',
- '�' => '15日',
- '�' => '16日',
- '�' => '17日',
- '�' => '18日',
- '�' => '19日',
- '�' => '20日',
- '�' => '21日',
- '�' => '22日',
- '�' => '23日',
- '�' => '24日',
- '�' => '25日',
- '�' => '26日',
- '�' => '27日',
- '�' => '28日',
- '�' => '29日',
- '�' => '30日',
- '�' => '31日',
- '�' => 'gal',
- 'ꚜ' => 'ъ',
- '�' => 'ь',
- '�' => '�',
- 'ꟸ' => 'Ħ',
- 'ꟹ' => 'œ',
- 'êœ' => 'ꜧ',
- 'ê�' => 'ꬷ',
- 'êž' => 'É«',
- 'êŸ' => 'ê’',
- 'ê©' => 'Ê�',
- 'ff' => 'ff',
- '�' => 'fi',
- 'fl' => 'fl',
- 'ffi' => 'ffi',
- 'ffl' => 'ffl',
- 'ſt' => 'st',
- 'st' => 'st',
- 'ﬓ' => 'մն',
- 'ﬔ' => 'մե',
- 'ﬕ' => 'մի',
- 'ﬖ' => 'վն',
- 'ﬗ' => 'Õ´Õ',
- 'ï¬ ' => '×¢',
- 'ﬡ' => '�',
- 'ﬢ' => 'ד',
- 'ﬣ' => 'ה',
- 'ﬤ' => 'כ',
- 'ﬥ' => 'ל',
- 'ﬦ' => '�',
- 'ﬧ' => 'ר',
- 'ﬨ' => 'ת',
- '﬩' => '+',
- 'ï�' => '×�ל',
- 'ï�' => 'Ù±',
- 'ï‘' => 'Ù±',
- 'ï’' => 'Ù»',
- 'ï“' => 'Ù»',
- 'ï”' => 'Ù»',
- 'ï•' => 'Ù»',
- 'ï–' => 'Ù¾',
- 'ï—' => 'Ù¾',
- 'ï˜' => 'Ù¾',
- 'ï™' => 'Ù¾',
- 'ïš' => 'Ú€',
- 'ï›' => 'Ú€',
- 'ïœ' => 'Ú€',
- 'ï�' => 'Ú€',
- 'ïž' => 'Ùº',
- 'ïŸ' => 'Ùº',
- 'ï ' => 'Ùº',
- 'ï¡' => 'Ùº',
- 'ï¢' => 'Ù¿',
- 'ï£' => 'Ù¿',
- 'ï¤' => 'Ù¿',
- 'ï¥' => 'Ù¿',
- 'ï¦' => 'Ù¹',
- 'ï§' => 'Ù¹',
- 'ï¨' => 'Ù¹',
- 'ï©' => 'Ù¹',
- 'ïª' => 'Ú¤',
- 'ï«' => 'Ú¤',
- 'ï¬' => 'Ú¤',
- 'ï' => 'Ú¤',
- 'ï®' => 'Ú¦',
- 'ï¯' => 'Ú¦',
- 'ï°' => 'Ú¦',
- 'ï±' => 'Ú¦',
- 'ï²' => 'Ú„',
- 'ï³' => 'Ú„',
- 'ï´' => 'Ú„',
- 'ïµ' => 'Ú„',
- 'ï¶' => 'Úƒ',
- 'ï·' => 'Úƒ',
- 'ï¸' => 'Úƒ',
- 'ï¹' => 'Úƒ',
- 'ïº' => 'Ú†',
- 'ï»' => 'Ú†',
- 'ï¼' => 'Ú†',
- 'ï½' => 'Ú†',
- 'ï¾' => 'Ú‡',
- 'ï¿' => 'Ú‡',
- 'ﮀ' => 'ڇ',
- '�' => 'ڇ',
- 'ﮂ' => '�',
- 'ﮃ' => '�',
- 'ﮄ' => 'ڌ',
- 'ﮅ' => 'ڌ',
- 'ﮆ' => 'ڎ',
- 'ﮇ' => 'ڎ',
- 'ﮈ' => 'ڈ',
- 'ﮉ' => 'ڈ',
- 'ﮊ' => 'ژ',
- 'ﮋ' => 'ژ',
- 'ﮌ' => 'ڑ',
- '�' => 'ڑ',
- 'ﮎ' => 'ک',
- '�' => 'ک',
- '�' => 'ک',
- 'ﮑ' => 'ک',
- 'ï®’' => 'Ú¯',
- 'ﮓ' => 'گ',
- 'ï®”' => 'Ú¯',
- 'ﮕ' => 'گ',
- 'ï®–' => 'Ú³',
- 'ï®—' => 'Ú³',
- 'ﮘ' => 'ڳ',
- 'ï®™' => 'Ú³',
- 'ﮚ' => 'ڱ',
- 'ï®›' => 'Ú±',
- 'ﮜ' => 'ڱ',
- '�' => 'ڱ',
- 'ﮞ' => 'ں',
- 'ﮟ' => 'ں',
- 'ï® ' => 'Ú»',
- 'ﮡ' => 'ڻ',
- 'ﮢ' => 'ڻ',
- 'ﮣ' => 'ڻ',
- 'ﮤ' => 'ۀ',
- 'ﮥ' => 'ۀ',
- 'ﮦ' => '�',
- 'ﮧ' => '�',
- 'ﮨ' => '�',
- 'ﮩ' => '�',
- 'ﮪ' => 'ھ',
- 'ﮫ' => 'ھ',
- 'ﮬ' => 'ھ',
- 'ï®' => 'Ú¾',
- 'ï®®' => 'Û’',
- 'ﮯ' => 'ے',
- 'ï®°' => 'Û’Ù”',
- 'ï®±' => 'Û’Ù”',
- 'ﯓ' => 'Ú',
- 'ﯔ' => 'Ú',
- 'ﯕ' => 'Ú',
- 'ﯖ' => 'Ú',
- 'ﯗ' => 'ۇ',
- 'ﯘ' => 'ۇ',
- 'ﯙ' => 'ۆ',
- 'ﯚ' => 'ۆ',
- 'ﯛ' => 'ۈ',
- 'ﯜ' => 'ۈ',
- '�' => 'ۇٴ',
- 'ﯞ' => 'ۋ',
- 'ﯟ' => 'ۋ',
- 'ï¯ ' => 'Û…',
- 'ﯡ' => 'ۅ',
- 'ﯢ' => 'ۉ',
- 'ﯣ' => 'ۉ',
- 'ﯤ' => '�',
- 'ﯥ' => '�',
- 'ﯦ' => '�',
- 'ﯧ' => '�',
- 'ﯨ' => 'ى',
- 'ﯩ' => 'ى',
- 'ﯪ' => 'ئا',
- 'ﯫ' => 'ئا',
- 'ﯬ' => 'ئە',
- 'ï¯' => 'ÙŠÙ”Û•',
- 'ﯮ' => 'ئو',
- 'ﯯ' => 'ئو',
- 'ﯰ' => 'ئۇ',
- 'ﯱ' => 'ئۇ',
- 'ﯲ' => 'ئۆ',
- 'ﯳ' => 'ئۆ',
- 'ﯴ' => 'ئۈ',
- 'ﯵ' => 'ئۈ',
- 'ﯶ' => 'ئ�',
- 'ﯷ' => 'ئ�',
- 'ﯸ' => 'ئ�',
- 'ﯹ' => 'ئى',
- 'ﯺ' => 'ئى',
- 'ﯻ' => 'ئى',
- 'ﯼ' => 'ی',
- 'ﯽ' => 'ی',
- 'ﯾ' => 'ی',
- 'ﯿ' => 'ی',
- 'ﰀ' => 'ئج',
- 'ï°�' => 'ÙŠÙ”Ø',
- 'ï°‚' => 'ÙŠÙ”Ù…',
- 'ï°ƒ' => 'ÙŠÙ”Ù‰',
- 'ï°„' => 'ÙŠÙ”ÙŠ',
- 'ﰅ' => 'بج',
- 'ï°†' => 'بØ',
- 'ﰇ' => 'بخ',
- 'ﰈ' => 'بم',
- 'ﰉ' => 'بى',
- 'ﰊ' => 'بي',
- 'ﰋ' => 'تج',
- 'ï°Œ' => 'تØ',
- '�' => 'تخ',
- 'ﰎ' => 'تم',
- '�' => 'تى',
- '�' => 'تي',
- 'ﰑ' => 'ثج',
- 'ﰒ' => 'ثم',
- 'ﰓ' => 'ثى',
- 'ﰔ' => 'ثي',
- 'ï°•' => 'جØ',
- 'ﰖ' => 'جم',
- 'ï°—' => 'Øج',
- 'ï°˜' => 'ØÙ…',
- 'ﰙ' => 'خج',
- 'ï°š' => 'Ø®Ø',
- 'ﰛ' => 'خم',
- 'ﰜ' => 'سج',
- 'ï°�' => 'سØ',
- 'ﰞ' => 'سخ',
- 'ﰟ' => 'سم',
- 'ï° ' => 'صØ',
- 'ﰡ' => 'صم',
- 'ﰢ' => 'ضج',
- 'ï°£' => 'ضØ',
- 'ﰤ' => 'ضخ',
- 'ﰥ' => 'ضم',
- 'ï°¦' => 'Ø·Ø',
- 'ﰧ' => 'طم',
- 'ﰨ' => 'ظم',
- 'ﰩ' => 'عج',
- 'ﰪ' => 'عم',
- 'ﰫ' => 'غج',
- 'ﰬ' => 'غم',
- 'ï°' => 'Ù�ج',
- 'ï°®' => 'Ù�Ø',
- 'ﰯ' => '�خ',
- 'ﰰ' => '�م',
- 'ﰱ' => '�ى',
- 'ﰲ' => '�ي',
- 'ï°³' => 'Ù‚Ø',
- 'ﰴ' => 'قم',
- 'ﰵ' => 'قى',
- 'ﰶ' => 'قي',
- 'ﰷ' => 'كا',
- 'ﰸ' => 'كج',
- 'ï°¹' => 'ÙƒØ',
- 'ﰺ' => 'كخ',
- 'ﰻ' => 'كل',
- 'ﰼ' => 'كم',
- 'ﰽ' => 'كى',
- 'ﰾ' => 'كي',
- 'ﰿ' => 'لج',
- 'ï±€' => 'Ù„Ø',
- '�' => 'لخ',
- 'ﱂ' => 'لم',
- 'ﱃ' => 'لى',
- 'ﱄ' => 'لي',
- 'ﱅ' => 'مج',
- 'ﱆ' => 'Ù…Ø',
- 'ﱇ' => 'مخ',
- 'ﱈ' => 'مم',
- 'ﱉ' => 'مى',
- 'ﱊ' => 'مي',
- 'ﱋ' => 'نج',
- 'ﱌ' => 'Ù†Ø',
- '�' => 'نخ',
- 'ﱎ' => 'نم',
- '�' => 'نى',
- '�' => 'ني',
- 'ﱑ' => 'هج',
- 'ﱒ' => 'هم',
- 'ﱓ' => 'هى',
- 'ﱔ' => 'هي',
- 'ﱕ' => 'يج',
- 'ï±–' => 'ÙŠØ',
- 'ﱗ' => 'يخ',
- 'ﱘ' => 'يم',
- 'ﱙ' => 'يى',
- 'ﱚ' => 'يي',
- 'ﱛ' => 'ذٰ',
- 'ﱜ' => 'رٰ',
- '�' => 'ىٰ',
- 'ﱞ' => ' ٌّ',
- 'ﱟ' => ' �ّ',
- 'ï± ' => ' ÙŽÙ‘',
- 'ﱡ' => ' �ّ',
- 'ﱢ' => ' �ّ',
- 'ﱣ' => ' ّٰ',
- 'ﱤ' => 'ئر',
- 'ﱥ' => 'ئز',
- 'ﱦ' => 'ئم',
- 'ﱧ' => 'ئن',
- 'ﱨ' => 'ئى',
- 'ﱩ' => 'ئي',
- 'ﱪ' => 'بر',
- 'ﱫ' => 'بز',
- 'ﱬ' => 'بم',
- 'ï±' => 'بن',
- 'ﱮ' => 'بى',
- 'ﱯ' => 'بي',
- 'ﱰ' => 'تر',
- 'ﱱ' => 'تز',
- 'ﱲ' => 'تم',
- 'ﱳ' => 'تن',
- 'ﱴ' => 'تى',
- 'ﱵ' => 'تي',
- 'ﱶ' => 'ثر',
- 'ﱷ' => 'ثز',
- 'ﱸ' => 'ثم',
- 'ﱹ' => 'ثن',
- 'ﱺ' => 'ثى',
- 'ﱻ' => 'ثي',
- 'ﱼ' => '�ى',
- 'ﱽ' => '�ي',
- 'ﱾ' => 'قى',
- 'ﱿ' => 'قي',
- 'ﲀ' => 'كا',
- '�' => 'كل',
- 'ﲂ' => 'كم',
- 'ﲃ' => 'كى',
- 'ﲄ' => 'كي',
- 'ﲅ' => 'لم',
- 'ﲆ' => 'لى',
- 'ﲇ' => 'لي',
- 'ﲈ' => 'ما',
- 'ﲉ' => 'مم',
- 'ﲊ' => 'نر',
- 'ﲋ' => 'نز',
- 'ﲌ' => 'نم',
- '�' => 'نن',
- 'ﲎ' => 'نى',
- '�' => 'ني',
- '�' => 'ىٰ',
- 'ﲑ' => 'ير',
- 'ﲒ' => 'يز',
- 'ﲓ' => 'يم',
- 'ﲔ' => 'ين',
- 'ﲕ' => 'يى',
- 'ﲖ' => 'يي',
- 'ﲗ' => 'ئج',
- 'ﲘ' => 'ÙŠÙ”Ø',
- 'ﲙ' => 'ئخ',
- 'ﲚ' => 'ئم',
- 'ï²›' => 'ÙŠÙ”Ù‡',
- 'ﲜ' => 'بج',
- 'ï²�' => 'بØ',
- 'ﲞ' => 'بخ',
- 'ﲟ' => 'بم',
- 'ï² ' => 'به',
- 'ﲡ' => 'تج',
- 'ï²¢' => 'تØ',
- 'ﲣ' => 'تخ',
- 'ﲤ' => 'تم',
- 'ﲥ' => 'ته',
- 'ﲦ' => 'ثم',
- 'ﲧ' => 'جØ',
- 'ﲨ' => 'جم',
- 'ﲩ' => 'Øج',
- 'ﲪ' => 'ØÙ…',
- 'ﲫ' => 'خج',
- 'ﲬ' => 'خم',
- 'ï²' => 'سج',
- 'ï²®' => 'سØ',
- 'ﲯ' => 'سخ',
- 'ﲰ' => 'سم',
- 'ï²±' => 'صØ',
- 'ﲲ' => 'صخ',
- 'ﲳ' => 'صم',
- 'ﲴ' => 'ضج',
- 'ï²µ' => 'ضØ',
- 'ﲶ' => 'ضخ',
- 'ﲷ' => 'ضم',
- 'ﲸ' => 'Ø·Ø',
- 'ﲹ' => 'ظم',
- 'ﲺ' => 'عج',
- 'ﲻ' => 'عم',
- 'ﲼ' => 'غج',
- 'ﲽ' => 'غم',
- 'ﲾ' => '�ج',
- 'ﲿ' => 'Ù�Ø',
- 'ﳀ' => '�خ',
- '�' => '�م',
- 'ﳂ' => 'Ù‚Ø',
- 'ﳃ' => 'قم',
- 'ﳄ' => 'كج',
- 'ï³…' => 'ÙƒØ',
- 'ﳆ' => 'كخ',
- 'ﳇ' => 'كل',
- 'ﳈ' => 'كم',
- 'ﳉ' => 'لج',
- 'ﳊ' => 'Ù„Ø',
- 'ﳋ' => 'لخ',
- 'ﳌ' => 'لم',
- '�' => 'له',
- 'ﳎ' => 'مج',
- 'ï³�' => 'Ù…Ø',
- '�' => 'مخ',
- 'ﳑ' => 'مم',
- 'ﳒ' => 'نج',
- 'ﳓ' => 'Ù†Ø',
- 'ﳔ' => 'نخ',
- 'ﳕ' => 'نم',
- 'ﳖ' => 'نه',
- 'ﳗ' => 'هج',
- 'ﳘ' => 'هم',
- 'ﳙ' => 'هٰ',
- 'ﳚ' => 'يج',
- 'ï³›' => 'ÙŠØ',
- 'ﳜ' => 'يخ',
- '�' => 'يم',
- 'ﳞ' => 'يه',
- 'ﳟ' => 'ئم',
- 'ï³ ' => 'ÙŠÙ”Ù‡',
- 'ﳡ' => 'بم',
- 'ﳢ' => 'به',
- 'ﳣ' => 'تم',
- 'ﳤ' => 'ته',
- 'ﳥ' => 'ثم',
- 'ﳦ' => 'ثه',
- 'ﳧ' => 'سم',
- 'ﳨ' => 'سه',
- 'ﳩ' => 'شم',
- 'ﳪ' => 'شه',
- 'ﳫ' => 'كل',
- 'ﳬ' => 'كم',
- 'ï³' => 'لم',
- 'ﳮ' => 'نم',
- 'ﳯ' => 'نه',
- 'ﳰ' => 'يم',
- 'ﳱ' => 'يه',
- 'ï³²' => 'Ù€ÙŽÙ‘',
- 'ﳳ' => 'ـ�ّ',
- 'ﳴ' => 'ـ�ّ',
- 'ﳵ' => 'طى',
- 'ﳶ' => 'طي',
- 'ﳷ' => 'عى',
- 'ﳸ' => 'عي',
- 'ﳹ' => 'غى',
- 'ﳺ' => 'غي',
- 'ﳻ' => 'سى',
- 'ﳼ' => 'سي',
- 'ﳽ' => 'شى',
- 'ﳾ' => 'شي',
- 'ﳿ' => 'ØÙ‰',
- 'ï´€' => 'ØÙŠ',
- '�' => 'جى',
- 'ﴂ' => 'جي',
- 'ﴃ' => 'خى',
- 'ﴄ' => 'خي',
- 'ﴅ' => 'صى',
- 'ﴆ' => 'صي',
- 'ﴇ' => 'ضى',
- 'ﴈ' => 'ضي',
- 'ﴉ' => 'شج',
- 'ï´Š' => 'Ø´Ø',
- 'ﴋ' => 'شخ',
- 'ﴌ' => 'شم',
- '�' => 'شر',
- 'ﴎ' => 'سر',
- '�' => 'صر',
- '�' => 'ضر',
- 'ﴑ' => 'طى',
- 'ﴒ' => 'طي',
- 'ﴓ' => 'عى',
- 'ﴔ' => 'عي',
- 'ﴕ' => 'غى',
- 'ﴖ' => 'غي',
- 'ﴗ' => 'سى',
- 'ﴘ' => 'سي',
- 'ﴙ' => 'شى',
- 'ﴚ' => 'شي',
- 'ï´›' => 'ØÙ‰',
- 'ï´œ' => 'ØÙŠ',
- '�' => 'جى',
- 'ﴞ' => 'جي',
- 'ﴟ' => 'خى',
- 'ï´ ' => 'خي',
- 'ﴡ' => 'صى',
- 'ﴢ' => 'صي',
- 'ﴣ' => 'ضى',
- 'ﴤ' => 'ضي',
- 'ﴥ' => 'شج',
- 'ï´¦' => 'Ø´Ø',
- 'ﴧ' => 'شخ',
- 'ﴨ' => 'شم',
- 'ﴩ' => 'شر',
- 'ﴪ' => 'سر',
- 'ﴫ' => 'صر',
- 'ﴬ' => 'ضر',
- 'ï´' => 'شج',
- 'ï´®' => 'Ø´Ø',
- 'ﴯ' => 'شخ',
- 'ﴰ' => 'شم',
- 'ﴱ' => 'سه',
- 'ﴲ' => 'شه',
- 'ﴳ' => 'طم',
- 'ﴴ' => 'سج',
- 'ï´µ' => 'سØ',
- 'ﴶ' => 'سخ',
- 'ﴷ' => 'شج',
- 'ï´¸' => 'Ø´Ø',
- 'ﴹ' => 'شخ',
- 'ﴺ' => 'طم',
- 'ﴻ' => 'ظم',
- 'ﴼ' => 'اً',
- 'ﴽ' => 'اً',
- '�' => 'تجم',
- 'ﵑ' => 'تØج',
- 'ïµ’' => 'تØج',
- 'ﵓ' => 'تØÙ…',
- 'ﵔ' => 'تخم',
- 'ﵕ' => 'تمج',
- 'ïµ–' => 'تمØ',
- 'ﵗ' => 'تمخ',
- 'ﵘ' => 'جمØ',
- 'ïµ™' => 'جمØ',
- 'ﵚ' => 'Øمي',
- 'ïµ›' => 'Øمى',
- 'ﵜ' => 'سØج',
- 'ïµ�' => 'سجØ',
- 'ﵞ' => 'سجى',
- 'ﵟ' => 'سمØ',
- 'ïµ ' => 'سمØ',
- 'ﵡ' => 'سمج',
- 'ﵢ' => 'سمم',
- 'ﵣ' => 'سمم',
- 'ﵤ' => 'صØØ',
- 'ïµ¥' => 'صØØ',
- 'ﵦ' => 'صمم',
- 'ﵧ' => 'Ø´ØÙ…',
- 'ﵨ' => 'Ø´ØÙ…',
- 'ﵩ' => 'شجي',
- 'ﵪ' => 'شمخ',
- 'ﵫ' => 'شمخ',
- 'ﵬ' => 'شمم',
- 'ïµ' => 'شمم',
- 'ïµ®' => 'ضØÙ‰',
- 'ﵯ' => 'ضخم',
- 'ﵰ' => 'ضخم',
- 'ïµ±' => 'طمØ',
- 'ïµ²' => 'طمØ',
- 'ﵳ' => 'طمم',
- 'ﵴ' => 'طمي',
- 'ﵵ' => 'عجم',
- 'ﵶ' => 'عمم',
- 'ﵷ' => 'عمم',
- 'ﵸ' => 'عمى',
- 'ﵹ' => 'غمم',
- 'ﵺ' => 'غمي',
- 'ﵻ' => 'غمى',
- 'ﵼ' => '�خم',
- 'ﵽ' => '�خم',
- 'ïµ¾' => 'قمØ',
- 'ﵿ' => 'قمم',
- 'ﶀ' => 'Ù„ØÙ…',
- 'ï¶�' => 'Ù„ØÙŠ',
- 'ﶂ' => 'Ù„ØÙ‰',
- 'ﶃ' => 'لجج',
- 'ﶄ' => 'لجج',
- 'ﶅ' => 'لخم',
- 'ﶆ' => 'لخم',
- 'ﶇ' => 'لمØ',
- 'ﶈ' => 'لمØ',
- 'ﶉ' => 'Ù…Øج',
- 'ﶊ' => 'Ù…ØÙ…',
- 'ﶋ' => 'Ù…ØÙŠ',
- 'ﶌ' => 'مجØ',
- '�' => 'مجم',
- 'ﶎ' => 'مخج',
- '�' => 'مخم',
- 'ﶒ' => 'مجخ',
- 'ﶓ' => 'همج',
- 'ﶔ' => 'همم',
- 'ﶕ' => 'Ù†ØÙ…',
- 'ﶖ' => 'Ù†ØÙ‰',
- 'ﶗ' => 'نجم',
- 'ﶘ' => 'نجم',
- 'ﶙ' => 'نجى',
- 'ﶚ' => 'نمي',
- 'ﶛ' => 'نمى',
- 'ﶜ' => 'يمم',
- '�' => 'يمم',
- 'ﶞ' => 'بخي',
- 'ﶟ' => 'تجي',
- 'ï¶ ' => 'تجى',
- 'ﶡ' => 'تخي',
- 'ﶢ' => 'تخى',
- 'ﶣ' => 'تمي',
- 'ﶤ' => 'تمى',
- 'ﶥ' => 'جمي',
- 'ﶦ' => 'جØÙ‰',
- 'ﶧ' => 'جمى',
- 'ﶨ' => 'سخى',
- 'ﶩ' => 'صØÙŠ',
- 'ﶪ' => 'Ø´ØÙŠ',
- 'ﶫ' => 'ضØÙŠ',
- 'ﶬ' => 'لجي',
- 'ï¶' => 'لمي',
- 'ﶮ' => 'ÙŠØÙŠ',
- 'ﶯ' => 'يجي',
- 'ﶰ' => 'يمي',
- 'ﶱ' => 'ممي',
- 'ﶲ' => 'قمي',
- 'ﶳ' => 'Ù†ØÙŠ',
- 'ﶴ' => 'قمØ',
- 'ﶵ' => 'Ù„ØÙ…',
- 'ﶶ' => 'عمي',
- 'ﶷ' => 'كمي',
- 'ﶸ' => 'نجØ',
- 'ﶹ' => 'مخي',
- 'ﶺ' => 'لجم',
- 'ﶻ' => 'كمم',
- 'ﶼ' => 'لجم',
- 'ﶽ' => 'نجØ',
- 'ﶾ' => 'جØÙŠ',
- 'ﶿ' => 'Øجي',
- 'ﷀ' => 'مجي',
- '�' => '�مي',
- 'ï·‚' => 'بØÙŠ',
- 'ﷃ' => 'كمم',
- 'ﷄ' => 'عجم',
- 'ﷅ' => 'صمم',
- 'ﷆ' => 'سخي',
- 'ﷇ' => 'نجي',
- 'ﷰ' => 'صلے',
- 'ﷱ' => 'قلے',
- 'ﷲ' => 'الله',
- 'ﷳ' => 'اكبر',
- 'ï·´' => 'Ù…Øمد',
- 'ﷵ' => 'صلعم',
- 'ﷶ' => 'رسول',
- 'ﷷ' => 'عليه',
- 'ﷸ' => 'وسلم',
- 'ﷹ' => 'صلى',
- 'ﷺ' => 'صلى الله عليه وسلم',
- 'ﷻ' => 'جل جلاله',
- '﷼' => 'ریال',
- '�' => ',',
- '︑' => '�',
- '︒' => '。',
- '︓' => ':',
- '︔' => ';',
- '︕' => '!',
- '︖' => '?',
- '︗' => '〖',
- '︘' => '〗',
- '︙' => '...',
- '︰' => '..',
- '︱' => '—',
- '︲' => '–',
- '︳' => '_',
- '︴' => '_',
- '︵' => '(',
- '︶' => ')',
- '︷' => '{',
- '︸' => '}',
- '︹' => '〔',
- '︺' => '〕',
- '︻' => '�',
- '︼' => '】',
- '︽' => '《',
- '︾' => '》',
- '︿' => '〈',
- '﹀' => '〉',
- '�' => '「',
- '﹂' => '�',
- '﹃' => '『',
- '﹄' => '�',
- '﹇' => '[',
- '﹈' => ']',
- '﹉' => ' ̅',
- '﹊' => ' ̅',
- '﹋' => ' ̅',
- '﹌' => ' ̅',
- '�' => '_',
- '﹎' => '_',
- '�' => '_',
- '�' => ',',
- '﹑' => '�',
- 'ï¹’' => '.',
- 'ï¹”' => ';',
- '﹕' => ':',
- 'ï¹–' => '?',
- 'ï¹—' => '!',
- '﹘' => '—',
- 'ï¹™' => '(',
- '﹚' => ')',
- 'ï¹›' => '{',
- '﹜' => '}',
- '�' => '〔',
- '﹞' => '〕',
- '﹟' => '#',
- 'ï¹ ' => '&',
- '﹡' => '*',
- 'ï¹¢' => '+',
- 'ï¹£' => '-',
- '﹤' => '<',
- 'ï¹¥' => '>',
- '﹦' => '=',
- '﹨' => '\\',
- '﹩' => '$',
- '﹪' => '%',
- '﹫' => '@',
- 'ï¹°' => ' Ù‹',
- 'ﹱ' => 'ـً',
- 'ﹲ' => ' ٌ',
- 'ï¹´' => ' Ù�',
- 'ﹶ' => ' َ',
- 'ï¹·' => 'Ù€ÙŽ',
- 'ﹸ' => ' �',
- 'ﹹ' => 'ـ�',
- 'ﹺ' => ' �',
- 'ﹻ' => 'ـ�',
- 'ï¹¼' => ' Ù‘',
- 'ﹽ' => 'ـّ',
- 'ï¹¾' => ' Ù’',
- 'ﹿ' => 'ـْ',
- 'ﺀ' => 'ء',
- '�' => 'آ',
- 'ﺂ' => 'آ',
- 'ﺃ' => 'أ',
- 'ﺄ' => 'أ',
- 'ﺅ' => 'ؤ',
- 'ﺆ' => 'ؤ',
- 'ﺇ' => 'إ',
- 'ﺈ' => 'إ',
- 'ﺉ' => 'ئ',
- 'ﺊ' => 'ئ',
- 'ﺋ' => 'ئ',
- 'ﺌ' => 'ئ',
- '�' => 'ا',
- 'ﺎ' => 'ا',
- '�' => 'ب',
- '�' => 'ب',
- 'ﺑ' => 'ب',
- 'ﺒ' => 'ب',
- 'ﺓ' => 'ة',
- 'ﺔ' => 'ة',
- 'ﺕ' => 'ت',
- 'ﺖ' => 'ت',
- 'ﺗ' => 'ت',
- 'ﺘ' => 'ت',
- 'ﺙ' => 'ث',
- 'ﺚ' => 'ث',
- 'ﺛ' => 'ث',
- 'ﺜ' => 'ث',
- '�' => 'ج',
- 'ﺞ' => 'ج',
- 'ﺟ' => 'ج',
- 'ïº ' => 'ج',
- 'ﺡ' => 'Ø',
- 'ﺢ' => 'Ø',
- 'ﺣ' => 'Ø',
- 'ﺤ' => 'Ø',
- 'ﺥ' => 'خ',
- 'ﺦ' => 'خ',
- 'ﺧ' => 'خ',
- 'ﺨ' => 'خ',
- 'ﺩ' => 'د',
- 'ﺪ' => 'د',
- 'ﺫ' => 'ذ',
- 'ﺬ' => 'ذ',
- 'ïº' => 'ر',
- 'ﺮ' => 'ر',
- 'ﺯ' => 'ز',
- 'ﺰ' => 'ز',
- 'ﺱ' => 'س',
- 'ﺲ' => 'س',
- 'ﺳ' => 'س',
- 'ﺴ' => 'س',
- 'ﺵ' => 'ش',
- 'ﺶ' => 'ش',
- 'ﺷ' => 'ش',
- 'ﺸ' => 'ش',
- 'ﺹ' => 'ص',
- 'ﺺ' => 'ص',
- 'ﺻ' => 'ص',
- 'ﺼ' => 'ص',
- 'ﺽ' => 'ض',
- 'ﺾ' => 'ض',
- 'ﺿ' => 'ض',
- 'ﻀ' => 'ض',
- '�' => 'ط',
- 'ﻂ' => 'ط',
- 'ﻃ' => 'ط',
- 'ﻄ' => 'ط',
- 'ﻅ' => 'ظ',
- 'ﻆ' => 'ظ',
- 'ﻇ' => 'ظ',
- 'ﻈ' => 'ظ',
- 'ﻉ' => 'ع',
- 'ﻊ' => 'ع',
- 'ﻋ' => 'ع',
- 'ﻌ' => 'ع',
- '�' => 'غ',
- 'ﻎ' => 'غ',
- '�' => 'غ',
- '�' => 'غ',
- 'ﻑ' => '�',
- 'ï»’' => 'Ù�',
- 'ﻓ' => '�',
- 'ï»”' => 'Ù�',
- 'ﻕ' => 'ق',
- 'ï»–' => 'Ù‚',
- 'ï»—' => 'Ù‚',
- 'ﻘ' => 'ق',
- 'ï»™' => 'Ùƒ',
- 'ﻚ' => 'ك',
- 'ï»›' => 'Ùƒ',
- 'ﻜ' => 'ك',
- '�' => 'ل',
- 'ﻞ' => 'ل',
- 'ﻟ' => 'ل',
- 'ï» ' => 'Ù„',
- 'ﻡ' => 'م',
- 'ﻢ' => 'م',
- 'ﻣ' => 'م',
- 'ﻤ' => 'م',
- 'ﻥ' => 'ن',
- 'ﻦ' => 'ن',
- 'ﻧ' => 'ن',
- 'ﻨ' => 'ن',
- 'ﻩ' => 'ه',
- 'ﻪ' => 'ه',
- 'ﻫ' => 'ه',
- 'ﻬ' => 'ه',
- 'ï»' => 'Ùˆ',
- 'ï»®' => 'Ùˆ',
- 'ﻯ' => 'ى',
- 'ï»°' => 'Ù‰',
- 'ï»±' => 'ÙŠ',
- 'ﻲ' => 'ي',
- 'ﻳ' => 'ي',
- 'ï»´' => 'ÙŠ',
- 'ﻵ' => 'لآ',
- 'ﻶ' => 'لآ',
- 'ﻷ' => 'لأ',
- 'ﻸ' => 'لأ',
- 'ﻹ' => 'لإ',
- 'ﻺ' => 'لإ',
- 'ﻻ' => 'لا',
- 'ﻼ' => 'لا',
- '�' => '!',
- '"' => '"',
- '#' => '#',
- '$' => '$',
- 'ï¼…' => '%',
- '&' => '&',
- ''' => '\'',
- '(' => '(',
- ')' => ')',
- '*' => '*',
- '+' => '+',
- ',' => ',',
- '�' => '-',
- '.' => '.',
- '�' => '/',
- '�' => '0',
- '1' => '1',
- 'ï¼’' => '2',
- '3' => '3',
- 'ï¼”' => '4',
- '5' => '5',
- 'ï¼–' => '6',
- 'ï¼—' => '7',
- '8' => '8',
- 'ï¼™' => '9',
- ':' => ':',
- 'ï¼›' => ';',
- '<' => '<',
- '�' => '=',
- '>' => '>',
- '?' => '?',
- 'ï¼ ' => '@',
- 'A' => 'A',
- 'ï¼¢' => 'B',
- 'ï¼£' => 'C',
- 'D' => 'D',
- 'ï¼¥' => 'E',
- 'F' => 'F',
- 'G' => 'G',
- 'H' => 'H',
- 'I' => 'I',
- 'J' => 'J',
- 'K' => 'K',
- 'L' => 'L',
- 'ï¼' => 'M',
- 'ï¼®' => 'N',
- 'O' => 'O',
- 'ï¼°' => 'P',
- 'ï¼±' => 'Q',
- 'ï¼²' => 'R',
- 'ï¼³' => 'S',
- 'ï¼´' => 'T',
- 'ï¼µ' => 'U',
- 'V' => 'V',
- 'ï¼·' => 'W',
- 'X' => 'X',
- 'ï¼¹' => 'Y',
- 'Z' => 'Z',
- 'ï¼»' => '[',
- 'ï¼¼' => '\\',
- 'ï¼½' => ']',
- 'ï¼¾' => '^',
- '_' => '_',
- 'ï½€' => '`',
- '�' => 'a',
- 'b' => 'b',
- 'c' => 'c',
- 'd' => 'd',
- 'ï½…' => 'e',
- 'f' => 'f',
- 'g' => 'g',
- 'h' => 'h',
- 'i' => 'i',
- 'j' => 'j',
- 'k' => 'k',
- 'l' => 'l',
- '�' => 'm',
- 'n' => 'n',
- '�' => 'o',
- '�' => 'p',
- 'q' => 'q',
- 'ï½’' => 'r',
- 's' => 's',
- 'ï½”' => 't',
- 'u' => 'u',
- 'ï½–' => 'v',
- 'ï½—' => 'w',
- 'x' => 'x',
- 'ï½™' => 'y',
- 'z' => 'z',
- 'ï½›' => '{',
- '|' => '|',
- '�' => '}',
- '~' => '~',
- '⦅' => '⦅',
- 'ï½ ' => '⦆',
- '。' => '。',
- '「' => '「',
- '」' => '�',
- '、' => '�',
- '・' => '・',
- 'ヲ' => 'ヲ',
- 'ァ' => 'ァ',
- 'ィ' => 'ィ',
- 'ゥ' => 'ゥ',
- 'ェ' => 'ェ',
- 'ォ' => 'ォ',
- 'ャ' => 'ャ',
- 'ï½' => 'ュ',
- 'ョ' => 'ョ',
- 'ッ' => 'ッ',
- 'ー' => 'ー',
- 'ï½±' => 'ã‚¢',
- 'イ' => 'イ',
- 'ウ' => 'ウ',
- 'エ' => 'エ',
- 'オ' => 'オ',
- 'カ' => 'カ',
- 'ï½·' => 'ã‚',
- 'ク' => 'ク',
- 'ケ' => 'ケ',
- 'コ' => 'コ',
- 'サ' => 'サ',
- 'ï½¼' => 'ã‚·',
- 'ス' => 'ス',
- 'ï½¾' => 'ã‚»',
- 'ソ' => 'ソ',
- 'ï¾€' => 'ã‚¿',
- '�' => '�',
- 'ツ' => 'ツ',
- 'テ' => 'テ',
- 'ト' => 'ト',
- 'ナ' => 'ナ',
- 'ニ' => 'ニ',
- 'ヌ' => 'ヌ',
- 'ネ' => '�',
- 'ノ' => 'ノ',
- 'ハ' => '�',
- 'ヒ' => 'ヒ',
- 'フ' => 'フ',
- '�' => 'ヘ',
- 'ホ' => 'ホ',
- '�' => 'マ',
- '�' => 'ミ',
- 'ム' => 'ム',
- 'メ' => 'メ',
- 'モ' => 'モ',
- 'ヤ' => 'ヤ',
- 'ユ' => 'ユ',
- 'ヨ' => 'ヨ',
- 'ラ' => 'ラ',
- 'リ' => 'リ',
- 'ル' => 'ル',
- 'レ' => 'レ',
- 'ï¾›' => 'ãƒ',
- 'ワ' => 'ワ',
- '�' => 'ン',
- '゙' => '゙',
- '゚' => '゚',
- 'ï¾ ' => 'á… ',
- 'ᄀ' => 'ᄀ',
- 'ᄁ' => '�',
- 'ᆪ' => 'ᆪ',
- 'ᄂ' => 'ᄂ',
- 'ᆬ' => 'ᆬ',
- 'ᆭ' => 'á†',
- 'ᄃ' => 'ᄃ',
- 'ᄄ' => 'ᄄ',
- 'ᄅ' => 'ᄅ',
- 'ᆰ' => 'ᆰ',
- 'ᆱ' => 'ᆱ',
- 'ᆲ' => 'ᆲ',
- 'ï¾' => 'ᆳ',
- 'ᆴ' => 'ᆴ',
- 'ᆵ' => 'ᆵ',
- 'ï¾°' => 'á„š',
- 'ᄆ' => 'ᄆ',
- 'ᄇ' => 'ᄇ',
- 'ᄈ' => 'ᄈ',
- 'ï¾´' => 'á„¡',
- 'ᄉ' => 'ᄉ',
- 'ᄊ' => 'ᄊ',
- 'ï¾·' => 'á„‹',
- 'ᄌ' => 'ᄌ',
- 'ᄍ' => '�',
- 'ᄎ' => 'ᄎ',
- 'ᄏ' => '�',
- 'ᄐ' => '�',
- 'ï¾½' => 'á„‘',
- 'ï¾¾' => 'á„’',
- 'ï¿‚' => 'á…¡',
- 'ᅢ' => 'ᅢ',
- 'ï¿„' => 'á…£',
- 'ï¿…' => 'á…¤',
- 'ᅥ' => 'ᅥ',
- 'ᅦ' => 'ᅦ',
- 'ï¿Š' => 'á…§',
- 'ï¿‹' => 'á…¨',
- 'ᅩ' => 'ᅩ',
- '�' => 'ᅪ',
- 'ï¿Ž' => 'á…«',
- '�' => 'ᅬ',
- 'ï¿’' => 'á…',
- 'ï¿“' => 'á…®',
- 'ï¿”' => 'á…¯',
- 'ï¿•' => 'á…°',
- 'ï¿–' => 'á…±',
- 'ï¿—' => 'á…²',
- 'ï¿š' => 'á…³',
- 'ï¿›' => 'á…´',
- 'ᅵ' => 'ᅵ',
- 'ï¿ ' => '¢',
- '£' => '£',
- '¬' => '¬',
- 'ï¿£' => ' Ì„',
- '¦' => '¦',
- 'ï¿¥' => 'Â¥',
- '₩' => '₩',
- '│' => '│',
- '←' => '�',
- '↑' => '↑',
- '→' => '→',
- '↓' => '↓',
- 'ï¿' => 'â– ',
- 'ï¿®' => 'â—‹',
- '�' => 'A',
- '�' => 'B',
- '�' => 'C',
- '�' => 'D',
- '�' => 'E',
- '�' => 'F',
- '�' => 'G',
- '�' => 'H',
- '�' => 'I',
- '�' => 'J',
- '�' => 'K',
- '�' => 'L',
- '�' => 'M',
- '�' => 'N',
- '�' => 'O',
- '�' => 'P',
- '�' => 'Q',
- '�' => 'R',
- '�' => 'S',
- '�' => 'T',
- '�' => 'U',
- '�' => 'V',
- '�' => 'W',
- '�' => 'X',
- '�' => 'Y',
- '�' => 'Z',
- '�' => 'a',
- '�' => 'b',
- '�' => 'c',
- '�' => 'd',
- '�' => 'e',
- '�' => 'f',
- 'ð�� ' => 'g',
- '�' => 'h',
- '�' => 'i',
- '�' => 'j',
- '�' => 'k',
- '�' => 'l',
- '�' => 'm',
- '�' => 'n',
- '�' => 'o',
- '�' => 'p',
- '�' => 'q',
- '�' => 'r',
- '�' => 's',
- 'ð��' => 't',
- '�' => 'u',
- '�' => 'v',
- '�' => 'w',
- '�' => 'x',
- '�' => 'y',
- '�' => 'z',
- '�' => 'A',
- '�' => 'B',
- '�' => 'C',
- '�' => 'D',
- '�' => 'E',
- '�' => 'F',
- '�' => 'G',
- '�' => 'H',
- '�' => 'I',
- '�' => 'J',
- '�' => 'K',
- '�' => 'L',
- '�' => 'M',
- '�' => 'N',
- '�' => 'O',
- '�' => 'P',
- '�' => 'Q',
- '�' => 'R',
- '�' => 'S',
- '�' => 'T',
- '�' => 'U',
- '�' => 'V',
- '�' => 'W',
- '�' => 'X',
- '�' => 'Y',
- '�' => 'Z',
- '�' => 'a',
- '�' => 'b',
- '�' => 'c',
- '�' => 'd',
- '�' => 'e',
- '�' => 'f',
- '�' => 'g',
- '�' => 'i',
- '�' => 'j',
- '�' => 'k',
- '�' => 'l',
- '�' => 'm',
- '�' => 'n',
- '�' => 'o',
- '�' => 'p',
- '�' => 'q',
- '�' => 'r',
- 'ð�‘ ' => 's',
- '�' => 't',
- '�' => 'u',
- '�' => 'v',
- '�' => 'w',
- '�' => 'x',
- '�' => 'y',
- '�' => 'z',
- '�' => 'A',
- '�' => 'B',
- '�' => 'C',
- '�' => 'D',
- '�' => 'E',
- 'ð�‘' => 'F',
- '�' => 'G',
- '�' => 'H',
- '�' => 'I',
- '�' => 'J',
- '�' => 'K',
- '�' => 'L',
- '�' => 'M',
- '�' => 'N',
- '�' => 'O',
- '�' => 'P',
- '�' => 'Q',
- '�' => 'R',
- '�' => 'S',
- '�' => 'T',
- '�' => 'U',
- '�' => 'V',
- '�' => 'W',
- '�' => 'X',
- '�' => 'Y',
- '�' => 'Z',
- '�' => 'a',
- '�' => 'b',
- '�' => 'c',
- '�' => 'd',
- '�' => 'e',
- '�' => 'f',
- '�' => 'g',
- '�' => 'h',
- '�' => 'i',
- '�' => 'j',
- '�' => 'k',
- '�' => 'l',
- '�' => 'm',
- '�' => 'n',
- '�' => 'o',
- '�' => 'p',
- '�' => 'q',
- '�' => 'r',
- '�' => 's',
- '�' => 't',
- '�' => 'u',
- '�' => 'v',
- '�' => 'w',
- '�' => 'x',
- '�' => 'y',
- '�' => 'z',
- '�' => 'A',
- '�' => 'C',
- '�' => 'D',
- '�' => 'G',
- '�' => 'J',
- '�' => 'K',
- '�' => 'N',
- '�' => 'O',
- '�' => 'P',
- '�' => 'Q',
- '�' => 'S',
- '�' => 'T',
- '�' => 'U',
- '�' => 'V',
- '�' => 'W',
- '�' => 'X',
- '�' => 'Y',
- '�' => 'Z',
- '�' => 'a',
- '�' => 'b',
- '�' => 'c',
- '�' => 'd',
- '�' => 'f',
- '�' => 'h',
- '�' => 'i',
- '�' => 'j',
- '�' => 'k',
- '�' => 'l',
- '�' => 'm',
- '�' => 'n',
- '�' => 'p',
- '�' => 'q',
- '�' => 'r',
- '�' => 's',
- '�' => 't',
- '�' => 'u',
- '�' => 'v',
- '�' => 'w',
- '�' => 'x',
- '�' => 'y',
- '�' => 'z',
- '�' => 'A',
- '�' => 'B',
- '�' => 'C',
- '�' => 'D',
- '�' => 'E',
- '�' => 'F',
- '�' => 'G',
- '�' => 'H',
- '�' => 'I',
- '�' => 'J',
- '�' => 'K',
- '�' => 'L',
- '�' => 'M',
- '�' => 'N',
- '�' => 'O',
- '�' => 'P',
- 'ð�“ ' => 'Q',
- '�' => 'R',
- '�' => 'S',
- '�' => 'T',
- '�' => 'U',
- '�' => 'V',
- '�' => 'W',
- '�' => 'X',
- '�' => 'Y',
- '�' => 'Z',
- '�' => 'a',
- '�' => 'b',
- '�' => 'c',
- 'ð�“' => 'd',
- '�' => 'e',
- '�' => 'f',
- '�' => 'g',
- '�' => 'h',
- '�' => 'i',
- '�' => 'j',
- '�' => 'k',
- '�' => 'l',
- '�' => 'm',
- '�' => 'n',
- '�' => 'o',
- '�' => 'p',
- '�' => 'q',
- '�' => 'r',
- '�' => 's',
- '�' => 't',
- '�' => 'u',
- '�' => 'v',
- '�' => 'w',
- '�' => 'x',
- '�' => 'y',
- '�' => 'z',
- '�' => 'A',
- '�' => 'B',
- '�' => 'D',
- '�' => 'E',
- '�' => 'F',
- '�' => 'G',
- '�' => 'J',
- '�' => 'K',
- '�' => 'L',
- '�' => 'M',
- '�' => 'N',
- '�' => 'O',
- '�' => 'P',
- '�' => 'Q',
- '�' => 'S',
- '�' => 'T',
- '�' => 'U',
- '�' => 'V',
- '�' => 'W',
- '�' => 'X',
- '�' => 'Y',
- '�' => 'a',
- '�' => 'b',
- 'ð�” ' => 'c',
- '�' => 'd',
- '�' => 'e',
- '�' => 'f',
- '�' => 'g',
- '�' => 'h',
- '�' => 'i',
- '�' => 'j',
- '�' => 'k',
- '�' => 'l',
- '�' => 'm',
- '�' => 'n',
- '�' => 'o',
- 'ð�”' => 'p',
- '�' => 'q',
- '�' => 'r',
- '�' => 's',
- '�' => 't',
- '�' => 'u',
- '�' => 'v',
- '�' => 'w',
- '�' => 'x',
- '�' => 'y',
- '�' => 'z',
- '�' => 'A',
- '�' => 'B',
- '�' => 'D',
- '�' => 'E',
- '�' => 'F',
- '�' => 'G',
- '�' => 'I',
- '�' => 'J',
- '�' => 'K',
- '�' => 'L',
- '�' => 'M',
- '�' => 'O',
- '�' => 'S',
- '�' => 'T',
- '�' => 'U',
- '�' => 'V',
- '�' => 'W',
- '�' => 'X',
- '�' => 'Y',
- '�' => 'a',
- '�' => 'b',
- '�' => 'c',
- '�' => 'd',
- '�' => 'e',
- '�' => 'f',
- '�' => 'g',
- '�' => 'h',
- '�' => 'i',
- '�' => 'j',
- '�' => 'k',
- '�' => 'l',
- '�' => 'm',
- '�' => 'n',
- 'ð�• ' => 'o',
- '�' => 'p',
- '�' => 'q',
- '�' => 'r',
- '�' => 's',
- '�' => 't',
- '�' => 'u',
- '�' => 'v',
- '�' => 'w',
- '�' => 'x',
- '�' => 'y',
- '�' => 'z',
- '�' => 'A',
- 'ð�•' => 'B',
- '�' => 'C',
- '�' => 'D',
- '�' => 'E',
- '�' => 'F',
- '�' => 'G',
- '�' => 'H',
- '�' => 'I',
- '�' => 'J',
- '�' => 'K',
- '�' => 'L',
- '�' => 'M',
- '�' => 'N',
- '�' => 'O',
- '�' => 'P',
- '�' => 'Q',
- '�' => 'R',
- '�' => 'S',
- '�' => 'T',
- '�' => 'U',
- '�' => 'V',
- '�' => 'W',
- '�' => 'X',
- '�' => 'Y',
- '�' => 'Z',
- '�' => 'a',
- '�' => 'b',
- '�' => 'c',
- '�' => 'd',
- '�' => 'e',
- '�' => 'f',
- '�' => 'g',
- '�' => 'h',
- '�' => 'i',
- '�' => 'j',
- '�' => 'k',
- '�' => 'l',
- '�' => 'm',
- '�' => 'n',
- '�' => 'o',
- '�' => 'p',
- '�' => 'q',
- '�' => 'r',
- '�' => 's',
- '�' => 't',
- '�' => 'u',
- '�' => 'v',
- '�' => 'w',
- '�' => 'x',
- '�' => 'y',
- '�' => 'z',
- 'ð�– ' => 'A',
- '�' => 'B',
- '�' => 'C',
- '�' => 'D',
- '�' => 'E',
- '�' => 'F',
- '�' => 'G',
- '�' => 'H',
- '�' => 'I',
- '�' => 'J',
- '�' => 'K',
- '�' => 'L',
- '�' => 'M',
- 'ð�–' => 'N',
- '�' => 'O',
- '�' => 'P',
- '�' => 'Q',
- '�' => 'R',
- '�' => 'S',
- '�' => 'T',
- '�' => 'U',
- '�' => 'V',
- '�' => 'W',
- '�' => 'X',
- '�' => 'Y',
- '�' => 'Z',
- '�' => 'a',
- '�' => 'b',
- '�' => 'c',
- '�' => 'd',
- '�' => 'e',
- '�' => 'f',
- '�' => 'g',
- '�' => 'h',
- '�' => 'i',
- '�' => 'j',
- '�' => 'k',
- '�' => 'l',
- '�' => 'm',
- '�' => 'n',
- '�' => 'o',
- '�' => 'p',
- '�' => 'q',
- '�' => 'r',
- '�' => 's',
- '�' => 't',
- '�' => 'u',
- '�' => 'v',
- '�' => 'w',
- '�' => 'x',
- '�' => 'y',
- '�' => 'z',
- '�' => 'A',
- '�' => 'B',
- '�' => 'C',
- '�' => 'D',
- '�' => 'E',
- '�' => 'F',
- '�' => 'G',
- '�' => 'H',
- '�' => 'I',
- '�' => 'J',
- '�' => 'K',
- '�' => 'L',
- 'ð�— ' => 'M',
- '�' => 'N',
- '�' => 'O',
- '�' => 'P',
- '�' => 'Q',
- '�' => 'R',
- '�' => 'S',
- '�' => 'T',
- '�' => 'U',
- '�' => 'V',
- '�' => 'W',
- '�' => 'X',
- '�' => 'Y',
- 'ð�—' => 'Z',
- '�' => 'a',
- '�' => 'b',
- '�' => 'c',
- '�' => 'd',
- '�' => 'e',
- '�' => 'f',
- '�' => 'g',
- '�' => 'h',
- '�' => 'i',
- '�' => 'j',
- '�' => 'k',
- '�' => 'l',
- '�' => 'm',
- '�' => 'n',
- '�' => 'o',
- '�' => 'p',
- '�' => 'q',
- '�' => 'r',
- '�' => 's',
- '�' => 't',
- '�' => 'u',
- '�' => 'v',
- '�' => 'w',
- '�' => 'x',
- '�' => 'y',
- '�' => 'z',
- '�' => 'A',
- '�' => 'B',
- '�' => 'C',
- '�' => 'D',
- '�' => 'E',
- '�' => 'F',
- '�' => 'G',
- '�' => 'H',
- '�' => 'I',
- '�' => 'J',
- '�' => 'K',
- '�' => 'L',
- '�' => 'M',
- '�' => 'N',
- '�' => 'O',
- '�' => 'P',
- '�' => 'Q',
- '�' => 'R',
- '�' => 'S',
- '�' => 'T',
- '�' => 'U',
- '�' => 'V',
- '�' => 'W',
- '�' => 'X',
- 'ð�˜ ' => 'Y',
- '�' => 'Z',
- '�' => 'a',
- '�' => 'b',
- '�' => 'c',
- '�' => 'd',
- '�' => 'e',
- '�' => 'f',
- '�' => 'g',
- '�' => 'h',
- '�' => 'i',
- '�' => 'j',
- '�' => 'k',
- 'ð�˜' => 'l',
- '�' => 'm',
- '�' => 'n',
- '�' => 'o',
- '�' => 'p',
- '�' => 'q',
- '�' => 'r',
- '�' => 's',
- '�' => 't',
- '�' => 'u',
- '�' => 'v',
- '�' => 'w',
- '�' => 'x',
- '�' => 'y',
- '�' => 'z',
- '�' => 'A',
- '�' => 'B',
- '�' => 'C',
- '�' => 'D',
- '�' => 'E',
- '�' => 'F',
- '�' => 'G',
- '�' => 'H',
- '�' => 'I',
- '�' => 'J',
- '�' => 'K',
- '�' => 'L',
- '�' => 'M',
- '�' => 'N',
- '�' => 'O',
- '�' => 'P',
- '�' => 'Q',
- '�' => 'R',
- '�' => 'S',
- '�' => 'T',
- '�' => 'U',
- '�' => 'V',
- '�' => 'W',
- '�' => 'X',
- '�' => 'Y',
- '�' => 'Z',
- '�' => 'a',
- '�' => 'b',
- '�' => 'c',
- '�' => 'd',
- '�' => 'e',
- '�' => 'f',
- '�' => 'g',
- '�' => 'h',
- '�' => 'i',
- '�' => 'j',
- 'ð�™ ' => 'k',
- '�' => 'l',
- '�' => 'm',
- '�' => 'n',
- '�' => 'o',
- '�' => 'p',
- '�' => 'q',
- '�' => 'r',
- '�' => 's',
- '�' => 't',
- '�' => 'u',
- '�' => 'v',
- '�' => 'w',
- 'ð�™' => 'x',
- '�' => 'y',
- '�' => 'z',
- '�' => 'A',
- '�' => 'B',
- '�' => 'C',
- '�' => 'D',
- '�' => 'E',
- '�' => 'F',
- '�' => 'G',
- '�' => 'H',
- '�' => 'I',
- '�' => 'J',
- '�' => 'K',
- '�' => 'L',
- '�' => 'M',
- '�' => 'N',
- '�' => 'O',
- '�' => 'P',
- '�' => 'Q',
- '�' => 'R',
- '�' => 'S',
- '�' => 'T',
- '�' => 'U',
- '�' => 'V',
- '�' => 'W',
- '�' => 'X',
- '�' => 'Y',
- '�' => 'Z',
- '�' => 'a',
- '�' => 'b',
- '�' => 'c',
- '�' => 'd',
- '�' => 'e',
- '�' => 'f',
- '�' => 'g',
- '�' => 'h',
- '�' => 'i',
- '�' => 'j',
- '�' => 'k',
- '�' => 'l',
- '�' => 'm',
- '�' => 'n',
- '�' => 'o',
- '�' => 'p',
- '�' => 'q',
- '�' => 'r',
- '�' => 's',
- '�' => 't',
- '�' => 'u',
- '�' => 'v',
- 'ð�š ' => 'w',
- '�' => 'x',
- '�' => 'y',
- '�' => 'z',
- '�' => 'ı',
- '�' => 'ȷ',
- '�' => 'Α',
- '�' => 'Β',
- '�' => 'Γ',
- '�' => 'Δ',
- '�' => 'Ε',
- 'ð�š' => 'Ζ',
- '�' => 'Η',
- '�' => 'Θ',
- '�' => 'Ι',
- '�' => 'Κ',
- '�' => 'Λ',
- '�' => 'Μ',
- '�' => '�',
- '�' => 'Ξ',
- '�' => 'Ο',
- '�' => 'Π',
- '�' => 'Ρ',
- '�' => 'Θ',
- '�' => 'Σ',
- '�' => 'Τ',
- '�' => 'Υ',
- '�' => 'Φ',
- '�' => 'Χ',
- '�' => 'Ψ',
- '�' => 'Ω',
- '�' => '∇',
- '�' => 'α',
- '�' => 'β',
- '�' => 'γ',
- '�' => 'δ',
- '�' => 'ε',
- '�' => 'ζ',
- '�' => 'η',
- '�' => 'θ',
- '�' => 'ι',
- '�' => 'κ',
- '�' => 'λ',
- '�' => 'μ',
- '�' => 'ν',
- '�' => 'ξ',
- '�' => 'ο',
- '�' => 'π',
- '�' => '�',
- '�' => 'ς',
- '�' => 'σ',
- '�' => 'τ',
- '�' => 'υ',
- '�' => 'φ',
- '�' => 'χ',
- '�' => 'ψ',
- '�' => 'ω',
- '�' => '∂',
- '�' => 'ε',
- '�' => 'θ',
- '�' => 'κ',
- '�' => 'φ',
- 'ð�› ' => 'Ï�',
- '�' => 'π',
- '�' => 'Α',
- '�' => 'Β',
- '�' => 'Γ',
- '�' => 'Δ',
- '�' => 'Ε',
- '�' => 'Ζ',
- '�' => 'Η',
- '�' => 'Θ',
- '�' => 'Ι',
- '�' => 'Κ',
- '�' => 'Λ',
- 'ð�›' => 'Îœ',
- '�' => '�',
- '�' => 'Ξ',
- '�' => 'Ο',
- '�' => 'Π',
- '�' => 'Ρ',
- '�' => 'Θ',
- '�' => 'Σ',
- '�' => 'Τ',
- '�' => 'Υ',
- '�' => 'Φ',
- '�' => 'Χ',
- '�' => 'Ψ',
- '�' => 'Ω',
- '�' => '∇',
- '�' => 'α',
- '�' => 'β',
- '�' => 'γ',
- '�' => 'δ',
- '�' => 'ε',
- '�' => 'ζ',
- '�' => 'η',
- '�' => 'θ',
- '�' => 'ι',
- '�' => 'κ',
- '�' => 'λ',
- '�' => 'μ',
- '�' => 'ν',
- '�' => 'ξ',
- '�' => 'ο',
- '�' => 'π',
- '�' => '�',
- '�' => 'ς',
- '�' => 'σ',
- '�' => 'τ',
- '�' => 'υ',
- '�' => 'φ',
- '�' => 'χ',
- '�' => 'ψ',
- '�' => 'ω',
- '�' => '∂',
- '�' => 'ε',
- '�' => 'θ',
- '�' => 'κ',
- '�' => 'φ',
- '�' => '�',
- '�' => 'π',
- '�' => 'Α',
- '�' => 'Β',
- '�' => 'Γ',
- '�' => 'Δ',
- 'ð�œ ' => 'Ε',
- '�' => 'Ζ',
- '�' => 'Η',
- '�' => 'Θ',
- '�' => 'Ι',
- '�' => 'Κ',
- '�' => 'Λ',
- '�' => 'Μ',
- '�' => '�',
- '�' => 'Ξ',
- '�' => 'Ο',
- '�' => 'Π',
- '�' => 'Ρ',
- 'ð�œ' => 'Θ',
- '�' => 'Σ',
- '�' => 'Τ',
- '�' => 'Υ',
- '�' => 'Φ',
- '�' => 'Χ',
- '�' => 'Ψ',
- '�' => 'Ω',
- '�' => '∇',
- '�' => 'α',
- '�' => 'β',
- '�' => 'γ',
- '�' => 'δ',
- '�' => 'ε',
- '�' => 'ζ',
- '�' => 'η',
- '�' => 'θ',
- '�' => 'ι',
- '�' => 'κ',
- '�' => 'λ',
- '�' => 'μ',
- '�' => 'ν',
- '�' => 'ξ',
- '�' => 'ο',
- '�' => 'π',
- '�' => '�',
- '�' => 'ς',
- '�' => 'σ',
- '�' => 'τ',
- '�' => 'υ',
- '�' => 'φ',
- '�' => 'χ',
- '�' => 'ψ',
- '�' => 'ω',
- '�' => '∂',
- '�' => 'ε',
- '�' => 'θ',
- '�' => 'κ',
- '�' => 'φ',
- '�' => '�',
- '�' => 'π',
- '�' => 'Α',
- '�' => 'Β',
- '�' => 'Γ',
- '�' => 'Δ',
- '�' => 'Ε',
- '�' => 'Ζ',
- '�' => 'Η',
- '�' => 'Θ',
- '�' => 'Ι',
- '�' => 'Κ',
- 'ð�� ' => 'Λ',
- '�' => 'Μ',
- '�' => '�',
- '�' => 'Ξ',
- '�' => 'Ο',
- '�' => 'Π',
- '�' => 'Ρ',
- '�' => 'Θ',
- '�' => 'Σ',
- '�' => 'Τ',
- '�' => 'Υ',
- '�' => 'Φ',
- '�' => 'Χ',
- 'ð��' => 'Ψ',
- '�' => 'Ω',
- '�' => '∇',
- '�' => 'α',
- '�' => 'β',
- '�' => 'γ',
- '�' => 'δ',
- '�' => 'ε',
- '�' => 'ζ',
- '�' => 'η',
- '�' => 'θ',
- '�' => 'ι',
- '�' => 'κ',
- '�' => 'λ',
- '�' => 'μ',
- '�' => 'ν',
- '�' => 'ξ',
- '�' => 'ο',
- '�' => 'π',
- '�' => '�',
- '�' => 'ς',
- '�' => 'σ',
- '�' => 'τ',
- '�' => 'υ',
- '�' => 'φ',
- '�' => 'χ',
- '�' => 'ψ',
- '�' => 'ω',
- '�' => '∂',
- '�' => 'ε',
- '�' => 'θ',
- '�' => 'κ',
- '�' => 'φ',
- '�' => '�',
- '�' => 'π',
- '�' => 'Α',
- '�' => 'Β',
- '�' => 'Γ',
- '�' => 'Δ',
- '�' => 'Ε',
- '�' => 'Ζ',
- '�' => 'Η',
- '�' => 'Θ',
- '�' => 'Ι',
- '�' => 'Κ',
- '�' => 'Λ',
- '�' => 'Μ',
- '�' => '�',
- '�' => 'Ξ',
- '�' => 'Ο',
- '�' => 'Π',
- 'ð�ž ' => 'Ρ',
- '�' => 'Θ',
- '�' => 'Σ',
- '�' => 'Τ',
- '�' => 'Υ',
- '�' => 'Φ',
- '�' => 'Χ',
- '�' => 'Ψ',
- '�' => 'Ω',
- '�' => '∇',
- '�' => 'α',
- '�' => 'β',
- '�' => 'γ',
- 'ð�ž' => 'δ',
- '�' => 'ε',
- '�' => 'ζ',
- '�' => 'η',
- '�' => 'θ',
- '�' => 'ι',
- '�' => 'κ',
- '�' => 'λ',
- '�' => 'μ',
- '�' => 'ν',
- '�' => 'ξ',
- '�' => 'ο',
- '�' => 'π',
- '�' => '�',
- '�' => 'ς',
- '�' => 'σ',
- '�' => 'τ',
- '�' => 'υ',
- '�' => 'φ',
- '�' => 'χ',
- '�' => 'ψ',
- '�' => 'ω',
- '�' => '∂',
- '�' => 'ε',
- '�' => 'θ',
- '�' => 'κ',
- '�' => 'φ',
- '�' => '�',
- '�' => 'π',
- '�' => 'Ϝ',
- '�' => '�',
- '�' => '0',
- '�' => '1',
- '�' => '2',
- '�' => '3',
- '�' => '4',
- '�' => '5',
- '�' => '6',
- '�' => '7',
- '�' => '8',
- '�' => '9',
- '�' => '0',
- '�' => '1',
- '�' => '2',
- '�' => '3',
- '�' => '4',
- '�' => '5',
- '�' => '6',
- '�' => '7',
- 'ð�Ÿ ' => '8',
- '�' => '9',
- '�' => '0',
- '�' => '1',
- '�' => '2',
- '�' => '3',
- '�' => '4',
- '�' => '5',
- '�' => '6',
- '�' => '7',
- '�' => '8',
- '�' => '9',
- '�' => '0',
- 'ð�Ÿ' => '1',
- '�' => '2',
- '�' => '3',
- '�' => '4',
- '�' => '5',
- '�' => '6',
- '�' => '7',
- '�' => '8',
- '�' => '9',
- '�' => '0',
- '�' => '1',
- '�' => '2',
- '�' => '3',
- '�' => '4',
- '�' => '5',
- '�' => '6',
- '�' => '7',
- '�' => '8',
- '�' => '9',
- '𞸀' => 'ا',
- '�' => 'ب',
- '𞸂' => 'ج',
- '𞸃' => 'د',
- '𞸅' => 'و',
- '𞸆' => 'ز',
- '𞸇' => 'Ø',
- '𞸈' => 'ط',
- '𞸉' => 'ي',
- '𞸊' => 'ك',
- '𞸋' => 'ل',
- '𞸌' => 'م',
- '�' => 'ن',
- '𞸎' => 'س',
- '�' => 'ع',
- '�' => '�',
- '𞸑' => 'ص',
- '𞸒' => 'ق',
- '𞸓' => 'ر',
- '𞸔' => 'ش',
- '𞸕' => 'ت',
- '𞸖' => 'ث',
- '𞸗' => 'خ',
- '𞸘' => 'ذ',
- '𞸙' => 'ض',
- '𞸚' => 'ظ',
- '𞸛' => 'غ',
- '𞸜' => 'ٮ',
- '�' => 'ں',
- '𞸞' => 'ڡ',
- '𞸟' => 'ٯ',
- '𞸡' => 'ب',
- '𞸢' => 'ج',
- '𞸤' => 'ه',
- '𞸧' => 'Ø',
- '𞸩' => 'ي',
- '𞸪' => 'ك',
- '𞸫' => 'ل',
- '𞸬' => 'م',
- 'ðž¸' => 'Ù†',
- '𞸮' => 'س',
- '𞸯' => 'ع',
- '𞸰' => '�',
- '𞸱' => 'ص',
- '𞸲' => 'ق',
- '𞸴' => 'ش',
- '𞸵' => 'ت',
- '𞸶' => 'ث',
- '𞸷' => 'خ',
- '𞸹' => 'ض',
- '𞸻' => 'غ',
- '𞹂' => 'ج',
- '𞹇' => 'Ø',
- '𞹉' => 'ي',
- '𞹋' => 'ل',
- '�' => 'ن',
- '𞹎' => 'س',
- '�' => 'ع',
- '𞹑' => 'ص',
- 'ðž¹’' => 'Ù‚',
- 'ðž¹”' => 'Ø´',
- 'ðž¹—' => 'Ø®',
- '𞹙' => 'ض',
- '𞹛' => 'غ',
- '�' => 'ں',
- '𞹟' => 'ٯ',
- '𞹡' => 'ب',
- '𞹢' => 'ج',
- '𞹤' => 'ه',
- '𞹧' => 'Ø',
- '𞹨' => 'ط',
- '𞹩' => 'ي',
- '𞹪' => 'ك',
- '𞹬' => 'م',
- 'ðž¹' => 'Ù†',
- '𞹮' => 'س',
- '𞹯' => 'ع',
- 'ðž¹°' => 'Ù�',
- '𞹱' => 'ص',
- 'ðž¹²' => 'Ù‚',
- 'ðž¹´' => 'Ø´',
- '𞹵' => 'ت',
- '𞹶' => 'ث',
- 'ðž¹·' => 'Ø®',
- '𞹹' => 'ض',
- '𞹺' => 'ظ',
- '𞹻' => 'غ',
- 'ðž¹¼' => 'Ù®',
- 'ðž¹¾' => 'Ú¡',
- '𞺀' => 'ا',
- '�' => 'ب',
- '𞺂' => 'ج',
- '𞺃' => 'د',
- '𞺄' => 'ه',
- '𞺅' => 'و',
- '𞺆' => 'ز',
- '𞺇' => 'Ø',
- '𞺈' => 'ط',
- '𞺉' => 'ي',
- '𞺋' => 'ل',
- '𞺌' => 'م',
- '�' => 'ن',
- '𞺎' => 'س',
- '�' => 'ع',
- '�' => '�',
- '𞺑' => 'ص',
- '𞺒' => 'ق',
- '𞺓' => 'ر',
- '𞺔' => 'ش',
- '𞺕' => 'ت',
- '𞺖' => 'ث',
- '𞺗' => 'خ',
- '𞺘' => 'ذ',
- '𞺙' => 'ض',
- '𞺚' => 'ظ',
- '𞺛' => 'غ',
- '𞺡' => 'ب',
- '𞺢' => 'ج',
- '𞺣' => 'د',
- '𞺥' => 'و',
- '𞺦' => 'ز',
- '𞺧' => 'Ø',
- '𞺨' => 'ط',
- '𞺩' => 'ي',
- '𞺫' => 'ل',
- '𞺬' => 'م',
- 'ðžº' => 'Ù†',
- '𞺮' => 'س',
- '𞺯' => 'ع',
- '𞺰' => '�',
- '𞺱' => 'ص',
- '𞺲' => 'ق',
- '𞺳' => 'ر',
- '𞺴' => 'ش',
- '𞺵' => 'ت',
- '𞺶' => 'ث',
- '𞺷' => 'خ',
- '𞺸' => 'ذ',
- '𞺹' => 'ض',
- '𞺺' => 'ظ',
- '𞺻' => 'غ',
- '🄀' => '0.',
- '�' => '0,',
- '🄂' => '1,',
- '🄃' => '2,',
- '🄄' => '3,',
- '🄅' => '4,',
- '🄆' => '5,',
- '🄇' => '6,',
- '🄈' => '7,',
- '🄉' => '8,',
- '🄊' => '9,',
- '�' => '(A)',
- '🄑' => '(B)',
- '🄒' => '(C)',
- '🄓' => '(D)',
- '🄔' => '(E)',
- '🄕' => '(F)',
- '🄖' => '(G)',
- '🄗' => '(H)',
- '🄘' => '(I)',
- '🄙' => '(J)',
- '🄚' => '(K)',
- '🄛' => '(L)',
- '🄜' => '(M)',
- '�' => '(N)',
- '🄞' => '(O)',
- '🄟' => '(P)',
- '🄠' => '(Q)',
- '🄡' => '(R)',
- '🄢' => '(S)',
- '🄣' => '(T)',
- '🄤' => '(U)',
- '🄥' => '(V)',
- '🄦' => '(W)',
- '🄧' => '(X)',
- '🄨' => '(Y)',
- '🄩' => '(Z)',
- '🄪' => '〔S〕',
- '🄫' => 'C',
- '🄬' => 'R',
- 'ðŸ„' => 'CD',
- '🄮' => 'WZ',
- '🄰' => 'A',
- '🄱' => 'B',
- '🄲' => 'C',
- '🄳' => 'D',
- '🄴' => 'E',
- '🄵' => 'F',
- '🄶' => 'G',
- '🄷' => 'H',
- '🄸' => 'I',
- '🄹' => 'J',
- '🄺' => 'K',
- '🄻' => 'L',
- '🄼' => 'M',
- '🄽' => 'N',
- '🄾' => 'O',
- '🄿' => 'P',
- '🅀' => 'Q',
- '�' => 'R',
- '🅂' => 'S',
- '🅃' => 'T',
- '🅄' => 'U',
- '🅅' => 'V',
- '🅆' => 'W',
- '🅇' => 'X',
- '🅈' => 'Y',
- '🅉' => 'Z',
- '🅊' => 'HV',
- '🅋' => 'MV',
- '🅌' => 'SD',
- '�' => 'SS',
- '🅎' => 'PPV',
- '�' => 'WC',
- '🅪' => 'MC',
- '🅫' => 'MD',
- '🅬' => 'MR',
- '�' => 'DJ',
- '🈀' => '��',
- '�' => 'ココ',
- '🈂' => 'サ',
- '�' => '手',
- '🈑' => 'å—',
- '🈒' => '�',
- '🈓' => 'デ',
- '🈔' => '二',
- '🈕' => '多',
- '🈖' => '解',
- '🈗' => '天',
- '🈘' => '交',
- '🈙' => 'æ˜ ',
- '🈚' => '無',
- '🈛' => '料',
- '🈜' => '�',
- '�' => '後',
- '🈞' => '�',
- '🈟' => '新',
- '🈠' => '�',
- '🈡' => '終',
- '🈢' => '生',
- '🈣' => '販',
- '🈤' => '声',
- '🈥' => '�',
- '🈦' => '演',
- '🈧' => '投',
- '🈨' => '�',
- '🈩' => '一',
- '🈪' => '三',
- '🈫' => '�',
- '🈬' => '左',
- 'ðŸˆ' => 'ä¸',
- '🈮' => '�',
- '🈯' => '指',
- '🈰' => '走',
- '🈱' => '打',
- '🈲' => '�',
- '🈳' => '空',
- '🈴' => '�',
- '🈵' => '満',
- '🈶' => '有',
- '🈷' => '月',
- '🈸' => '申',
- '🈹' => '割',
- '🈺' => '営',
- '🈻' => '�',
- '🉀' => '〔本〕',
- '�' => '〔三〕',
- '🉂' => '〔二〕',
- '🉃' => '〔安〕',
- '🉄' => '〔点〕',
- '🉅' => '〔打〕',
- '🉆' => '〔盗〕',
- '🉇' => '〔�〕',
- '🉈' => '〔敗〕',
- '�' => '得',
- '🉑' => '�',
- '🯰' => '0',
- '🯱' => '1',
- '🯲' => '2',
- '🯳' => '3',
- '🯴' => '4',
- '🯵' => '5',
- '🯶' => '6',
- '🯷' => '7',
- '🯸' => '8',
- '🯹' => '9',
- );
- <?php
- use Symfony\Polyfill\Intl\Normalizer as p;
- if (\PHP_VERSION_ID >= 80000) {
- return require __DIR__.'/bootstrap80.php';
- }
- if (!function_exists('normalizer_is_normalized')) {
- function normalizer_is_normalized($string, $form = p\Normalizer::FORM_C) { return p\Normalizer::isNormalized($string, $form); }
- }
- if (!function_exists('normalizer_normalize')) {
- function normalizer_normalize($string, $form = p\Normalizer::FORM_C) { return p\Normalizer::normalize($string, $form); }
- }
- <?php
- use Symfony\Polyfill\Intl\Normalizer as p;
- if (!function_exists('normalizer_is_normalized')) {
- function normalizer_is_normalized(?string $string, ?int $form = p\Normalizer::FORM_C): bool { return p\Normalizer::isNormalized((string) $string, (int) $form); }
- }
- if (!function_exists('normalizer_normalize')) {
- function normalizer_normalize(?string $string, ?int $form = p\Normalizer::FORM_C): string|false { return p\Normalizer::normalize((string) $string, (int) $form); }
- }
- Copyright (c) 2015-2019 Fabien Potencier
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is furnished
- to do so, subject to the following conditions:
- The above copyright notice and this permission notice shall be included in all
- copies or substantial portions of the Software.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
- <?php
- namespace Symfony\Polyfill\Mbstring;
- final class Mbstring
- {
- public const MB_CASE_FOLD = \PHP_INT_MAX;
- private const CASE_FOLD = [
- ['µ', 'ſ', "\xCD\x85", 'ς', "\xCF\x90", "\xCF\x91", "\xCF\x95", "\xCF\x96", "\xCF\xB0", "\xCF\xB1", "\xCF\xB5", "\xE1\xBA\x9B", "\xE1\xBE\xBE"],
- ['μ', 's', 'ι', 'σ', 'β', 'θ', 'φ', 'π', 'κ', '�', 'ε', "\xE1\xB9\xA1", 'ι'],
- ];
- private static $encodingList = ['ASCII', 'UTF-8'];
- private static $language = 'neutral';
- private static $internalEncoding = 'UTF-8';
- public static function mb_convert_encoding($s, $toEncoding, $fromEncoding = null)
- {
- if (\is_array($fromEncoding) || ($fromEncoding !== null && false !== strpos($fromEncoding, ','))) {
- $fromEncoding = self::mb_detect_encoding($s, $fromEncoding);
- } else {
- $fromEncoding = self::getEncoding($fromEncoding);
- }
- $toEncoding = self::getEncoding($toEncoding);
- if ('BASE64' === $fromEncoding) {
- $s = base64_decode($s);
- $fromEncoding = $toEncoding;
- }
- if ('BASE64' === $toEncoding) {
- return base64_encode($s);
- }
- if ('HTML-ENTITIES' === $toEncoding || 'HTML' === $toEncoding) {
- if ('HTML-ENTITIES' === $fromEncoding || 'HTML' === $fromEncoding) {
- $fromEncoding = 'Windows-1252';
- }
- if ('UTF-8' !== $fromEncoding) {
- $s = \iconv($fromEncoding, 'UTF-8//IGNORE', $s);
- }
- return preg_replace_callback('/[\x80-\xFF]+/', [__CLASS__, 'html_encoding_callback'], $s);
- }
- if ('HTML-ENTITIES' === $fromEncoding) {
- $s = html_entity_decode($s, \ENT_COMPAT, 'UTF-8');
- $fromEncoding = 'UTF-8';
- }
- return \iconv($fromEncoding, $toEncoding.'//IGNORE', $s);
- }
- public static function mb_convert_variables($toEncoding, $fromEncoding, &...$vars)
- {
- $ok = true;
- array_walk_recursive($vars, function (&$v) use (&$ok, $toEncoding, $fromEncoding) {
- if (false === $v = self::mb_convert_encoding($v, $toEncoding, $fromEncoding)) {
- $ok = false;
- }
- });
- return $ok ? $fromEncoding : false;
- }
- public static function mb_decode_mimeheader($s)
- {
- return \iconv_mime_decode($s, 2, self::$internalEncoding);
- }
- public static function mb_encode_mimeheader($s, $charset = null, $transferEncoding = null, $linefeed = null, $indent = null)
- {
- trigger_error('mb_encode_mimeheader() is bugged. Please use iconv_mime_encode() instead', \E_USER_WARNING);
- }
- public static function mb_decode_numericentity($s, $convmap, $encoding = null)
- {
- if (null !== $s && !is_scalar($s) && !(\is_object($s) && method_exists($s, '__toString'))) {
- trigger_error('mb_decode_numericentity() expects parameter 1 to be string, '.\gettype($s).' given', \E_USER_WARNING);
- return null;
- }
- if (!\is_array($convmap) || (80000 > \PHP_VERSION_ID && !$convmap)) {
- return false;
- }
- if (null !== $encoding && !is_scalar($encoding)) {
- trigger_error('mb_decode_numericentity() expects parameter 3 to be string, '.\gettype($s).' given', \E_USER_WARNING);
- return '';
- }
- $s = (string) $s;
- if ('' === $s) {
- return '';
- }
- $encoding = self::getEncoding($encoding);
- if ('UTF-8' === $encoding) {
- $encoding = null;
- if (!preg_match('//u', $s)) {
- $s = @\iconv('UTF-8', 'UTF-8//IGNORE', $s);
- }
- } else {
- $s = \iconv($encoding, 'UTF-8//IGNORE', $s);
- }
- $cnt = floor(\count($convmap) / 4) * 4;
- for ($i = 0; $i < $cnt; $i += 4) {
- $convmap[$i] += $convmap[$i + 2];
- $convmap[$i + 1] += $convmap[$i + 2];
- }
- $s = preg_replace_callback('/&#(?:0*([0-9]+)|x0*([0-9a-fA-F]+))(?!&);?/', function (array $m) use ($cnt, $convmap) {
- $c = isset($m[2]) ? (int) hexdec($m[2]) : $m[1];
- for ($i = 0; $i < $cnt; $i += 4) {
- if ($c >= $convmap[$i] && $c <= $convmap[$i + 1]) {
- return self::mb_chr($c - $convmap[$i + 2]);
- }
- }
- return $m[0];
- }, $s);
- if (null === $encoding) {
- return $s;
- }
- return \iconv('UTF-8', $encoding.'//IGNORE', $s);
- }
- public static function mb_encode_numericentity($s, $convmap, $encoding = null, $is_hex = false)
- {
- if (null !== $s && !is_scalar($s) && !(\is_object($s) && method_exists($s, '__toString'))) {
- trigger_error('mb_encode_numericentity() expects parameter 1 to be string, '.\gettype($s).' given', \E_USER_WARNING);
- return null;
- }
- if (!\is_array($convmap) || (80000 > \PHP_VERSION_ID && !$convmap)) {
- return false;
- }
- if (null !== $encoding && !is_scalar($encoding)) {
- trigger_error('mb_encode_numericentity() expects parameter 3 to be string, '.\gettype($s).' given', \E_USER_WARNING);
- return null;
- }
- if (null !== $is_hex && !is_scalar($is_hex)) {
- trigger_error('mb_encode_numericentity() expects parameter 4 to be boolean, '.\gettype($s).' given', \E_USER_WARNING);
- return null;
- }
- $s = (string) $s;
- if ('' === $s) {
- return '';
- }
- $encoding = self::getEncoding($encoding);
- if ('UTF-8' === $encoding) {
- $encoding = null;
- if (!preg_match('//u', $s)) {
- $s = @\iconv('UTF-8', 'UTF-8//IGNORE', $s);
- }
- } else {
- $s = \iconv($encoding, 'UTF-8//IGNORE', $s);
- }
- static $ulenMask = ["\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4];
- $cnt = floor(\count($convmap) / 4) * 4;
- $i = 0;
- $len = \strlen($s);
- $result = '';
- while ($i < $len) {
- $ulen = $s[$i] < "\x80" ? 1 : $ulenMask[$s[$i] & "\xF0"];
- $uchr = substr($s, $i, $ulen);
- $i += $ulen;
- $c = self::mb_ord($uchr);
- for ($j = 0; $j < $cnt; $j += 4) {
- if ($c >= $convmap[$j] && $c <= $convmap[$j + 1]) {
- $cOffset = ($c + $convmap[$j + 2]) & $convmap[$j + 3];
- $result .= $is_hex ? sprintf('&#x%X;', $cOffset) : '&#'.$cOffset.';';
- continue 2;
- }
- }
- $result .= $uchr;
- }
- if (null === $encoding) {
- return $result;
- }
- return \iconv('UTF-8', $encoding.'//IGNORE', $result);
- }
- public static function mb_convert_case($s, $mode, $encoding = null)
- {
- $s = (string) $s;
- if ('' === $s) {
- return '';
- }
- $encoding = self::getEncoding($encoding);
- if ('UTF-8' === $encoding) {
- $encoding = null;
- if (!preg_match('//u', $s)) {
- $s = @\iconv('UTF-8', 'UTF-8//IGNORE', $s);
- }
- } else {
- $s = \iconv($encoding, 'UTF-8//IGNORE', $s);
- }
- if (\MB_CASE_TITLE == $mode) {
- static $titleRegexp = null;
- if (null === $titleRegexp) {
- $titleRegexp = self::getData('titleCaseRegexp');
- }
- $s = preg_replace_callback($titleRegexp, [__CLASS__, 'title_case'], $s);
- } else {
- if (\MB_CASE_UPPER == $mode) {
- static $upper = null;
- if (null === $upper) {
- $upper = self::getData('upperCase');
- }
- $map = $upper;
- } else {
- if (self::MB_CASE_FOLD === $mode) {
- $s = str_replace(self::CASE_FOLD[0], self::CASE_FOLD[1], $s);
- }
- static $lower = null;
- if (null === $lower) {
- $lower = self::getData('lowerCase');
- }
- $map = $lower;
- }
- static $ulenMask = ["\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4];
- $i = 0;
- $len = \strlen($s);
- while ($i < $len) {
- $ulen = $s[$i] < "\x80" ? 1 : $ulenMask[$s[$i] & "\xF0"];
- $uchr = substr($s, $i, $ulen);
- $i += $ulen;
- if (isset($map[$uchr])) {
- $uchr = $map[$uchr];
- $nlen = \strlen($uchr);
- if ($nlen == $ulen) {
- $nlen = $i;
- do {
- $s[--$nlen] = $uchr[--$ulen];
- } while ($ulen);
- } else {
- $s = substr_replace($s, $uchr, $i - $ulen, $ulen);
- $len += $nlen - $ulen;
- $i += $nlen - $ulen;
- }
- }
- }
- }
- if (null === $encoding) {
- return $s;
- }
- return \iconv('UTF-8', $encoding.'//IGNORE', $s);
- }
- public static function mb_internal_encoding($encoding = null)
- {
- if (null === $encoding) {
- return self::$internalEncoding;
- }
- $normalizedEncoding = self::getEncoding($encoding);
- if ('UTF-8' === $normalizedEncoding || false !== @\iconv($normalizedEncoding, $normalizedEncoding, ' ')) {
- self::$internalEncoding = $normalizedEncoding;
- return true;
- }
- if (80000 > \PHP_VERSION_ID) {
- return false;
- }
- throw new \ValueError(sprintf('Argument #1 ($encoding) must be a valid encoding, "%s" given', $encoding));
- }
- public static function mb_language($lang = null)
- {
- if (null === $lang) {
- return self::$language;
- }
- switch ($normalizedLang = strtolower($lang)) {
- case 'uni':
- case 'neutral':
- self::$language = $normalizedLang;
- return true;
- }
- if (80000 > \PHP_VERSION_ID) {
- return false;
- }
- throw new \ValueError(sprintf('Argument #1 ($language) must be a valid language, "%s" given', $lang));
- }
- public static function mb_list_encodings()
- {
- return ['UTF-8'];
- }
- public static function mb_encoding_aliases($encoding)
- {
- switch (strtoupper($encoding)) {
- case 'UTF8':
- case 'UTF-8':
- return ['utf8'];
- }
- return false;
- }
- public static function mb_check_encoding($var = null, $encoding = null)
- {
- if (null === $encoding) {
- if (null === $var) {
- return false;
- }
- $encoding = self::$internalEncoding;
- }
- return self::mb_detect_encoding($var, [$encoding]) || false !== @\iconv($encoding, $encoding, $var);
- }
- public static function mb_detect_encoding($str, $encodingList = null, $strict = false)
- {
- if (null === $encodingList) {
- $encodingList = self::$encodingList;
- } else {
- if (!\is_array($encodingList)) {
- $encodingList = array_map('trim', explode(',', $encodingList));
- }
- $encodingList = array_map('strtoupper', $encodingList);
- }
- foreach ($encodingList as $enc) {
- switch ($enc) {
- case 'ASCII':
- if (!preg_match('/[\x80-\xFF]/', $str)) {
- return $enc;
- }
- break;
- case 'UTF8':
- case 'UTF-8':
- if (preg_match('//u', $str)) {
- return 'UTF-8';
- }
- break;
- default:
- if (0 === strncmp($enc, 'ISO-8859-', 9)) {
- return $enc;
- }
- }
- }
- return false;
- }
- public static function mb_detect_order($encodingList = null)
- {
- if (null === $encodingList) {
- return self::$encodingList;
- }
- if (!\is_array($encodingList)) {
- $encodingList = array_map('trim', explode(',', $encodingList));
- }
- $encodingList = array_map('strtoupper', $encodingList);
- foreach ($encodingList as $enc) {
- switch ($enc) {
- default:
- if (strncmp($enc, 'ISO-8859-', 9)) {
- return false;
- }
- case 'ASCII':
- case 'UTF8':
- case 'UTF-8':
- }
- }
- self::$encodingList = $encodingList;
- return true;
- }
- public static function mb_strlen($s, $encoding = null)
- {
- $encoding = self::getEncoding($encoding);
- if ('CP850' === $encoding || 'ASCII' === $encoding) {
- return \strlen($s);
- }
- return @\iconv_strlen($s, $encoding);
- }
- public static function mb_strpos($haystack, $needle, $offset = 0, $encoding = null)
- {
- $encoding = self::getEncoding($encoding);
- if ('CP850' === $encoding || 'ASCII' === $encoding) {
- return strpos($haystack, $needle, $offset);
- }
- $needle = (string) $needle;
- if ('' === $needle) {
- if (80000 > \PHP_VERSION_ID) {
- trigger_error(__METHOD__.': Empty delimiter', \E_USER_WARNING);
- return false;
- }
- return 0;
- }
- return \iconv_strpos($haystack, $needle, $offset, $encoding);
- }
- public static function mb_strrpos($haystack, $needle, $offset = 0, $encoding = null)
- {
- $encoding = self::getEncoding($encoding);
- if ('CP850' === $encoding || 'ASCII' === $encoding) {
- return strrpos($haystack, $needle, $offset);
- }
- if ($offset != (int) $offset) {
- $offset = 0;
- } elseif ($offset = (int) $offset) {
- if ($offset < 0) {
- if (0 > $offset += self::mb_strlen($needle)) {
- $haystack = self::mb_substr($haystack, 0, $offset, $encoding);
- }
- $offset = 0;
- } else {
- $haystack = self::mb_substr($haystack, $offset, 2147483647, $encoding);
- }
- }
- $pos = '' !== $needle || 80000 > \PHP_VERSION_ID
- ? \iconv_strrpos($haystack, $needle, $encoding)
- : self::mb_strlen($haystack, $encoding);
- return false !== $pos ? $offset + $pos : false;
- }
- public static function mb_str_split($string, $split_length = 1, $encoding = null)
- {
- if (null !== $string && !is_scalar($string) && !(\is_object($string) && method_exists($string, '__toString'))) {
- trigger_error('mb_str_split() expects parameter 1 to be string, '.\gettype($string).' given', \E_USER_WARNING);
- return null;
- }
- if (1 > $split_length = (int) $split_length) {
- if (80000 > \PHP_VERSION_ID) {
- trigger_error('The length of each segment must be greater than zero', \E_USER_WARNING);
- return false;
- }
- throw new \ValueError('Argument #2 ($length) must be greater than 0');
- }
- if (null === $encoding) {
- $encoding = mb_internal_encoding();
- }
- if ('UTF-8' === $encoding = self::getEncoding($encoding)) {
- $rx = '/(';
- while (65535 < $split_length) {
- $rx .= '.{65535}';
- $split_length -= 65535;
- }
- $rx .= '.{'.$split_length.'})/us';
- return preg_split($rx, $string, -1, \PREG_SPLIT_DELIM_CAPTURE | \PREG_SPLIT_NO_EMPTY);
- }
- $result = [];
- $length = mb_strlen($string, $encoding);
- for ($i = 0; $i < $length; $i += $split_length) {
- $result[] = mb_substr($string, $i, $split_length, $encoding);
- }
- return $result;
- }
- public static function mb_strtolower($s, $encoding = null)
- {
- return self::mb_convert_case($s, \MB_CASE_LOWER, $encoding);
- }
- public static function mb_strtoupper($s, $encoding = null)
- {
- return self::mb_convert_case($s, \MB_CASE_UPPER, $encoding);
- }
- public static function mb_substitute_character($c = null)
- {
- if (null === $c) {
- return 'none';
- }
- if (0 === strcasecmp($c, 'none')) {
- return true;
- }
- if (80000 > \PHP_VERSION_ID) {
- return false;
- }
- if (\is_int($c) || 'long' === $c || 'entity' === $c) {
- return false;
- }
- throw new \ValueError('Argument #1 ($substitute_character) must be "none", "long", "entity" or a valid codepoint');
- }
- public static function mb_substr($s, $start, $length = null, $encoding = null)
- {
- $encoding = self::getEncoding($encoding);
- if ('CP850' === $encoding || 'ASCII' === $encoding) {
- return (string) substr($s, $start, null === $length ? 2147483647 : $length);
- }
- if ($start < 0) {
- $start = \iconv_strlen($s, $encoding) + $start;
- if ($start < 0) {
- $start = 0;
- }
- }
- if (null === $length) {
- $length = 2147483647;
- } elseif ($length < 0) {
- $length = \iconv_strlen($s, $encoding) + $length - $start;
- if ($length < 0) {
- return '';
- }
- }
- return (string) \iconv_substr($s, $start, $length, $encoding);
- }
- public static function mb_stripos($haystack, $needle, $offset = 0, $encoding = null)
- {
- $haystack = self::mb_convert_case($haystack, self::MB_CASE_FOLD, $encoding);
- $needle = self::mb_convert_case($needle, self::MB_CASE_FOLD, $encoding);
- return self::mb_strpos($haystack, $needle, $offset, $encoding);
- }
- public static function mb_stristr($haystack, $needle, $part = false, $encoding = null)
- {
- $pos = self::mb_stripos($haystack, $needle, 0, $encoding);
- return self::getSubpart($pos, $part, $haystack, $encoding);
- }
- public static function mb_strrchr($haystack, $needle, $part = false, $encoding = null)
- {
- $encoding = self::getEncoding($encoding);
- if ('CP850' === $encoding || 'ASCII' === $encoding) {
- $pos = strrpos($haystack, $needle);
- } else {
- $needle = self::mb_substr($needle, 0, 1, $encoding);
- $pos = \iconv_strrpos($haystack, $needle, $encoding);
- }
- return self::getSubpart($pos, $part, $haystack, $encoding);
- }
- public static function mb_strrichr($haystack, $needle, $part = false, $encoding = null)
- {
- $needle = self::mb_substr($needle, 0, 1, $encoding);
- $pos = self::mb_strripos($haystack, $needle, $encoding);
- return self::getSubpart($pos, $part, $haystack, $encoding);
- }
- public static function mb_strripos($haystack, $needle, $offset = 0, $encoding = null)
- {
- $haystack = self::mb_convert_case($haystack, self::MB_CASE_FOLD, $encoding);
- $needle = self::mb_convert_case($needle, self::MB_CASE_FOLD, $encoding);
- return self::mb_strrpos($haystack, $needle, $offset, $encoding);
- }
- public static function mb_strstr($haystack, $needle, $part = false, $encoding = null)
- {
- $pos = strpos($haystack, $needle);
- if (false === $pos) {
- return false;
- }
- if ($part) {
- return substr($haystack, 0, $pos);
- }
- return substr($haystack, $pos);
- }
- public static function mb_get_info($type = 'all')
- {
- $info = [
- 'internal_encoding' => self::$internalEncoding,
- 'http_output' => 'pass',
- 'http_output_conv_mimetypes' => '^(text/|application/xhtml\+xml)',
- 'func_overload' => 0,
- 'func_overload_list' => 'no overload',
- 'mail_charset' => 'UTF-8',
- 'mail_header_encoding' => 'BASE64',
- 'mail_body_encoding' => 'BASE64',
- 'illegal_chars' => 0,
- 'encoding_translation' => 'Off',
- 'language' => self::$language,
- 'detect_order' => self::$encodingList,
- 'substitute_character' => 'none',
- 'strict_detection' => 'Off',
- ];
- if ('all' === $type) {
- return $info;
- }
- if (isset($info[$type])) {
- return $info[$type];
- }
- return false;
- }
- public static function mb_http_input($type = '')
- {
- return false;
- }
- public static function mb_http_output($encoding = null)
- {
- return null !== $encoding ? 'pass' === $encoding : 'pass';
- }
- public static function mb_strwidth($s, $encoding = null)
- {
- $encoding = self::getEncoding($encoding);
- if ('UTF-8' !== $encoding) {
- $s = \iconv($encoding, 'UTF-8//IGNORE', $s);
- }
- $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);
- return ($wide << 1) + \iconv_strlen($s, 'UTF-8');
- }
- public static function mb_substr_count($haystack, $needle, $encoding = null)
- {
- return substr_count($haystack, $needle);
- }
- public static function mb_output_handler($contents, $status)
- {
- return $contents;
- }
- public static function mb_chr($code, $encoding = null)
- {
- if (0x80 > $code %= 0x200000) {
- $s = \chr($code);
- } elseif (0x800 > $code) {
- $s = \chr(0xC0 | $code >> 6).\chr(0x80 | $code & 0x3F);
- } elseif (0x10000 > $code) {
- $s = \chr(0xE0 | $code >> 12).\chr(0x80 | $code >> 6 & 0x3F).\chr(0x80 | $code & 0x3F);
- } else {
- $s = \chr(0xF0 | $code >> 18).\chr(0x80 | $code >> 12 & 0x3F).\chr(0x80 | $code >> 6 & 0x3F).\chr(0x80 | $code & 0x3F);
- }
- if ('UTF-8' !== $encoding = self::getEncoding($encoding)) {
- $s = mb_convert_encoding($s, $encoding, 'UTF-8');
- }
- return $s;
- }
- public static function mb_ord($s, $encoding = null)
- {
- if ('UTF-8' !== $encoding = self::getEncoding($encoding)) {
- $s = mb_convert_encoding($s, 'UTF-8', $encoding);
- }
- if (1 === \strlen($s)) {
- return \ord($s);
- }
- $code = ($s = unpack('C*', substr($s, 0, 4))) ? $s[1] : 0;
- if (0xF0 <= $code) {
- return (($code - 0xF0) << 18) + (($s[2] - 0x80) << 12) + (($s[3] - 0x80) << 6) + $s[4] - 0x80;
- }
- if (0xE0 <= $code) {
- return (($code - 0xE0) << 12) + (($s[2] - 0x80) << 6) + $s[3] - 0x80;
- }
- if (0xC0 <= $code) {
- return (($code - 0xC0) << 6) + $s[2] - 0x80;
- }
- return $code;
- }
- private static function getSubpart($pos, $part, $haystack, $encoding)
- {
- if (false === $pos) {
- return false;
- }
- if ($part) {
- return self::mb_substr($haystack, 0, $pos, $encoding);
- }
- return self::mb_substr($haystack, $pos, null, $encoding);
- }
- private static function html_encoding_callback(array $m)
- {
- $i = 1;
- $entities = '';
- $m = unpack('C*', htmlentities($m[0], \ENT_COMPAT, 'UTF-8'));
- while (isset($m[$i])) {
- if (0x80 > $m[$i]) {
- $entities .= \chr($m[$i++]);
- continue;
- }
- if (0xF0 <= $m[$i]) {
- $c = (($m[$i++] - 0xF0) << 18) + (($m[$i++] - 0x80) << 12) + (($m[$i++] - 0x80) << 6) + $m[$i++] - 0x80;
- } elseif (0xE0 <= $m[$i]) {
- $c = (($m[$i++] - 0xE0) << 12) + (($m[$i++] - 0x80) << 6) + $m[$i++] - 0x80;
- } else {
- $c = (($m[$i++] - 0xC0) << 6) + $m[$i++] - 0x80;
- }
- $entities .= '&#'.$c.';';
- }
- return $entities;
- }
- private static function title_case(array $s)
- {
- return self::mb_convert_case($s[1], \MB_CASE_UPPER, 'UTF-8').self::mb_convert_case($s[2], \MB_CASE_LOWER, 'UTF-8');
- }
- private static function getData($file)
- {
- if (file_exists($file = __DIR__.'/Resources/unidata/'.$file.'.php')) {
- return require $file;
- }
- return false;
- }
- private static function getEncoding($encoding)
- {
- if (null === $encoding) {
- return self::$internalEncoding;
- }
- if ('UTF-8' === $encoding) {
- return 'UTF-8';
- }
- $encoding = strtoupper($encoding);
- if ('8BIT' === $encoding || 'BINARY' === $encoding) {
- return 'CP850';
- }
- if ('UTF8' === $encoding) {
- return 'UTF-8';
- }
- return $encoding;
- }
- }
- <?php
- return array (
- 'A' => 'a',
- 'B' => 'b',
- 'C' => 'c',
- 'D' => 'd',
- 'E' => 'e',
- 'F' => 'f',
- 'G' => 'g',
- 'H' => 'h',
- 'I' => 'i',
- 'J' => 'j',
- 'K' => 'k',
- 'L' => 'l',
- 'M' => 'm',
- 'N' => 'n',
- 'O' => 'o',
- 'P' => 'p',
- 'Q' => 'q',
- 'R' => 'r',
- 'S' => 's',
- 'T' => 't',
- 'U' => 'u',
- 'V' => 'v',
- 'W' => 'w',
- 'X' => 'x',
- 'Y' => 'y',
- 'Z' => 'z',
- 'À' => 'à ',
- '�' => 'á',
- 'Â' => 'â',
- 'Ã' => 'ã',
- 'Ä' => 'ä',
- 'Ã…' => 'Ã¥',
- 'Æ' => 'æ',
- 'Ç' => 'ç',
- 'È' => 'è',
- 'É' => 'é',
- 'Ê' => 'ê',
- 'Ë' => 'ë',
- 'Ì' => 'ì',
- 'Ã�' => 'Ã',
- 'Î' => 'î',
- '�' => 'ï',
- '�' => 'ð',
- 'Ñ' => 'ñ',
- 'Ò' => 'ò',
- 'Ó' => 'ó',
- 'Ô' => 'ô',
- 'Õ' => 'õ',
- 'Ö' => 'ö',
- 'Ø' => 'ø',
- 'Ù' => 'ù',
- 'Ú' => 'ú',
- 'Û' => 'û',
- 'Ü' => 'ü',
- '�' => 'ý',
- 'Þ' => 'þ',
- 'Ā' => '�',
- 'Ă' => 'ă',
- 'Ä„' => 'Ä…',
- 'Ć' => 'ć',
- 'Ĉ' => 'ĉ',
- 'ÄŠ' => 'Ä‹',
- 'Č' => '�',
- 'Ď' => '�',
- '�' => 'đ',
- 'Ä’' => 'Ä“',
- 'Ä”' => 'Ä•',
- 'Ä–' => 'Ä—',
- 'Ę' => 'ę',
- 'Äš' => 'Ä›',
- 'Ĝ' => '�',
- 'Äž' => 'ÄŸ',
- 'Ä ' => 'Ä¡',
- 'Ä¢' => 'Ä£',
- 'Ĥ' => 'ĥ',
- 'Ħ' => 'ħ',
- 'Ĩ' => 'ĩ',
- 'Ī' => 'ī',
- 'Ĭ' => 'Ä',
- 'Į' => 'į',
- 'İ' => 'i̇',
- 'IJ' => 'ij',
- 'Ĵ' => 'ĵ',
- 'Ķ' => 'ķ',
- 'Ĺ' => 'ĺ',
- 'Ļ' => 'ļ',
- 'Ľ' => 'ľ',
- 'Ä¿' => 'Å€',
- '�' => 'ł',
- 'Ń' => 'ń',
- 'Ņ' => 'ņ',
- 'Ň' => 'ň',
- 'ÅŠ' => 'Å‹',
- 'Ō' => '�',
- 'Ŏ' => '�',
- '�' => 'ő',
- 'Å’' => 'Å“',
- 'Å”' => 'Å•',
- 'Å–' => 'Å—',
- 'Ř' => 'ř',
- 'Åš' => 'Å›',
- 'Ŝ' => '�',
- 'Åž' => 'ÅŸ',
- 'Å ' => 'Å¡',
- 'Å¢' => 'Å£',
- 'Ť' => 'ť',
- 'Ŧ' => 'ŧ',
- 'Ũ' => 'ũ',
- 'Ū' => 'ū',
- 'Ŭ' => 'Å',
- 'Ů' => 'ů',
- 'Ű' => 'ű',
- 'Ų' => 'ų',
- 'Ŵ' => 'ŵ',
- 'Ŷ' => 'ŷ',
- 'Ÿ' => 'ÿ',
- 'Ź' => 'ź',
- 'Ż' => 'ż',
- 'Ž' => 'ž',
- '�' => 'ɓ',
- 'Ƃ' => 'ƃ',
- 'Æ„' => 'Æ…',
- 'Ɔ' => 'ɔ',
- 'Ƈ' => 'ƈ',
- 'Ɖ' => 'ɖ',
- 'ÆŠ' => 'É—',
- 'Ƌ' => 'ƌ',
- 'Ǝ' => '�',
- '�' => 'ə',
- '�' => 'ɛ',
- 'Æ‘' => 'Æ’',
- 'Æ“' => 'É ',
- 'Æ”' => 'É£',
- 'Æ–' => 'É©',
- 'Ɨ' => 'ɨ',
- 'Ƙ' => 'ƙ',
- 'Ɯ' => 'ɯ',
- '�' => 'ɲ',
- 'Ɵ' => 'ɵ',
- 'Æ ' => 'Æ¡',
- 'Æ¢' => 'Æ£',
- 'Ƥ' => 'ƥ',
- 'Ʀ' => 'ʀ',
- 'Ƨ' => 'ƨ',
- 'Ʃ' => 'ʃ',
- 'Ƭ' => 'Æ',
- 'Ʈ' => 'ʈ',
- 'Ư' => 'ư',
- 'Ʊ' => 'ʊ',
- 'Ʋ' => 'ʋ',
- 'Ƴ' => 'ƴ',
- 'Ƶ' => 'ƶ',
- 'Æ·' => 'Ê’',
- 'Ƹ' => 'ƹ',
- 'Ƽ' => 'ƽ',
- 'DŽ' => 'dž',
- 'Dž' => 'dž',
- 'LJ' => 'lj',
- 'Lj' => 'lj',
- 'NJ' => 'nj',
- 'Nj' => 'nj',
- '�' => 'ǎ',
- '�' => '�',
- 'Ç‘' => 'Ç’',
- 'Ç“' => 'Ç”',
- 'Ç•' => 'Ç–',
- 'Ǘ' => 'ǘ',
- 'Ç™' => 'Çš',
- 'Ǜ' => 'ǜ',
- 'Çž' => 'ÇŸ',
- 'Ç ' => 'Ç¡',
- 'Ç¢' => 'Ç£',
- 'Ǥ' => 'ǥ',
- 'Ǧ' => 'ǧ',
- 'Ǩ' => 'ǩ',
- 'Ǫ' => 'ǫ',
- 'Ǭ' => 'Ç',
- 'Ǯ' => 'ǯ',
- 'DZ' => 'dz',
- 'Dz' => 'dz',
- 'Ǵ' => 'ǵ',
- 'Ƕ' => 'ƕ',
- 'Ç·' => 'Æ¿',
- 'Ǹ' => 'ǹ',
- 'Ǻ' => 'ǻ',
- 'Ǽ' => 'ǽ',
- 'Ǿ' => 'ǿ',
- 'Ȁ' => '�',
- 'Ȃ' => 'ȃ',
- 'È„' => 'È…',
- 'Ȇ' => 'ȇ',
- 'Ȉ' => 'ȉ',
- 'ÈŠ' => 'È‹',
- 'Ȍ' => '�',
- 'Ȏ' => '�',
- '�' => 'ȑ',
- 'È’' => 'È“',
- 'È”' => 'È•',
- 'È–' => 'È—',
- 'Ș' => 'ș',
- 'Èš' => 'È›',
- 'Ȝ' => '�',
- 'Èž' => 'ÈŸ',
- 'È ' => 'Æž',
- 'È¢' => 'È£',
- 'Ȥ' => 'ȥ',
- 'Ȧ' => 'ȧ',
- 'Ȩ' => 'ȩ',
- 'Ȫ' => 'ȫ',
- 'Ȭ' => 'È',
- 'Ȯ' => 'ȯ',
- 'Ȱ' => 'ȱ',
- 'Ȳ' => 'ȳ',
- 'Ⱥ' => 'ⱥ',
- 'Ȼ' => 'ȼ',
- 'Ƚ' => 'ƚ',
- 'Ⱦ' => 'ⱦ',
- '�' => 'ɂ',
- 'Ƀ' => 'ƀ',
- 'Ʉ' => 'ʉ',
- 'Ʌ' => 'ʌ',
- 'Ɇ' => 'ɇ',
- 'Ɉ' => 'ɉ',
- 'ÉŠ' => 'É‹',
- 'Ɍ' => '�',
- 'Ɏ' => '�',
- 'Ͱ' => 'ͱ',
- 'Ͳ' => 'ͳ',
- 'Ͷ' => 'ͷ',
- 'Ϳ' => 'ϳ',
- 'Ά' => 'ά',
- 'Έ' => 'Î',
- 'Ή' => 'ή',
- 'Ί' => 'ί',
- 'Ό' => 'ό',
- 'Ύ' => '�',
- '�' => 'ώ',
- 'Α' => 'α',
- 'Β' => 'β',
- 'Γ' => 'γ',
- 'Δ' => 'δ',
- 'Ε' => 'ε',
- 'Ζ' => 'ζ',
- 'Η' => 'η',
- 'Θ' => 'θ',
- 'Ι' => 'ι',
- 'Κ' => 'κ',
- 'Λ' => 'λ',
- 'Μ' => 'μ',
- '�' => 'ν',
- 'Ξ' => 'ξ',
- 'Ο' => 'ο',
- 'Î ' => 'Ï€',
- 'Ρ' => '�',
- 'Σ' => 'σ',
- 'Τ' => 'τ',
- 'Î¥' => 'Ï…',
- 'Φ' => 'φ',
- 'Χ' => 'χ',
- 'Ψ' => 'ψ',
- 'Ω' => 'ω',
- 'Ϊ' => 'ϊ',
- 'Ϋ' => 'ϋ',
- '�' => 'ϗ',
- 'Ϙ' => 'ϙ',
- 'Ïš' => 'Ï›',
- 'Ϝ' => '�',
- 'Ïž' => 'ÏŸ',
- 'Ï ' => 'Ï¡',
- 'Ï¢' => 'Ï£',
- 'Ϥ' => 'ϥ',
- 'Ϧ' => 'ϧ',
- 'Ϩ' => 'ϩ',
- 'Ϫ' => 'ϫ',
- 'Ϭ' => 'Ï',
- 'Ϯ' => 'ϯ',
- 'ϴ' => 'θ',
- 'Ϸ' => 'ϸ',
- 'Ϲ' => 'ϲ',
- 'Ϻ' => 'ϻ',
- 'Ͻ' => 'ͻ',
- 'Ͼ' => 'ͼ',
- 'Ͽ' => 'ͽ',
- 'Ѐ' => '�',
- '�' => 'ё',
- 'Ђ' => 'ђ',
- 'Ѓ' => 'ѓ',
- 'Є' => 'є',
- 'Ð…' => 'Ñ•',
- 'І' => 'і',
- 'Ї' => 'ї',
- 'Ј' => 'ј',
- 'Љ' => 'љ',
- 'Њ' => 'њ',
- 'Ћ' => 'ћ',
- 'Ќ' => 'ќ',
- '�' => '�',
- 'ÐŽ' => 'Ñž',
- '�' => 'џ',
- '�' => 'а',
- 'Б' => 'б',
- 'В' => 'в',
- 'Г' => 'г',
- 'Д' => 'д',
- 'Е' => 'е',
- 'Ж' => 'ж',
- 'З' => 'з',
- 'И' => 'и',
- 'Й' => 'й',
- 'К' => 'к',
- 'Л' => 'л',
- 'М' => 'м',
- '�' => 'н',
- 'О' => 'о',
- 'П' => 'п',
- 'Ð ' => 'Ñ€',
- 'С' => '�',
- 'Т' => 'т',
- 'У' => 'у',
- 'Ф' => 'ф',
- 'Ð¥' => 'Ñ…',
- 'Ц' => 'ц',
- 'Ч' => 'ч',
- 'Ш' => 'ш',
- 'Щ' => 'щ',
- 'Ъ' => 'ъ',
- 'Ы' => 'ы',
- 'Ь' => 'ь',
- 'Ð' => 'Ñ�',
- 'Ю' => 'ю',
- 'Я' => '�',
- 'Ñ ' => 'Ñ¡',
- 'Ñ¢' => 'Ñ£',
- 'Ѥ' => 'ѥ',
- 'Ѧ' => 'ѧ',
- 'Ѩ' => 'ѩ',
- 'Ѫ' => 'ѫ',
- 'Ѭ' => 'Ñ',
- 'Ѯ' => 'ѯ',
- 'Ѱ' => 'ѱ',
- 'Ѳ' => 'ѳ',
- 'Ѵ' => 'ѵ',
- 'Ѷ' => 'ѷ',
- 'Ѹ' => 'ѹ',
- 'Ѻ' => 'ѻ',
- 'Ѽ' => 'ѽ',
- 'Ѿ' => 'ѿ',
- 'Ò€' => 'Ò�',
- 'ÒŠ' => 'Ò‹',
- 'Ҍ' => '�',
- 'ÒŽ' => 'Ò�',
- 'Ò�' => 'Ò‘',
- 'Ò’' => 'Ò“',
- 'Ò”' => 'Ò•',
- 'Ò–' => 'Ò—',
- 'Ò˜' => 'Ò™',
- 'Òš' => 'Ò›',
- 'Ҝ' => '�',
- 'Òž' => 'ÒŸ',
- 'Ò ' => 'Ò¡',
- 'Ò¢' => 'Ò£',
- 'Ò¤' => 'Ò¥',
- 'Ò¦' => 'Ò§',
- 'Ò¨' => 'Ò©',
- 'Òª' => 'Ò«',
- 'Ò¬' => 'Ò',
- 'Ò®' => 'Ò¯',
- 'Ò°' => 'Ò±',
- 'Ò²' => 'Ò³',
- 'Ò´' => 'Òµ',
- 'Ò¶' => 'Ò·',
- 'Ò¸' => 'Ò¹',
- 'Òº' => 'Ò»',
- 'Ò¼' => 'Ò½',
- 'Ò¾' => 'Ò¿',
- 'Ó€' => 'Ó�',
- 'Ó�' => 'Ó‚',
- 'Óƒ' => 'Ó„',
- 'Ó…' => 'Ó†',
- 'Ó‡' => 'Óˆ',
- 'Ó‰' => 'ÓŠ',
- 'Ӌ' => 'ӌ',
- 'Ó�' => 'ÓŽ',
- 'Ó�' => 'Ó‘',
- 'Ó’' => 'Ó“',
- 'Ó”' => 'Ó•',
- 'Ó–' => 'Ó—',
- 'Ó˜' => 'Ó™',
- 'Óš' => 'Ó›',
- 'Ӝ' => '�',
- 'Óž' => 'ÓŸ',
- 'Ó ' => 'Ó¡',
- 'Ó¢' => 'Ó£',
- 'Ó¤' => 'Ó¥',
- 'Ó¦' => 'Ó§',
- 'Ó¨' => 'Ó©',
- 'Óª' => 'Ó«',
- 'Ó¬' => 'Ó',
- 'Ó®' => 'Ó¯',
- 'Ó°' => 'Ó±',
- 'Ó²' => 'Ó³',
- 'Ó´' => 'Óµ',
- 'Ó¶' => 'Ó·',
- 'Ó¸' => 'Ó¹',
- 'Óº' => 'Ó»',
- 'Ó¼' => 'Ó½',
- 'Ó¾' => 'Ó¿',
- 'Ô€' => 'Ô�',
- 'Ô‚' => 'Ôƒ',
- 'Ô„' => 'Ô…',
- 'Ô†' => 'Ô‡',
- 'Ôˆ' => 'Ô‰',
- 'ÔŠ' => 'Ô‹',
- 'Ԍ' => '�',
- 'ÔŽ' => 'Ô�',
- 'Ô�' => 'Ô‘',
- 'Ô’' => 'Ô“',
- 'Ô”' => 'Ô•',
- 'Ô–' => 'Ô—',
- 'Ô˜' => 'Ô™',
- 'Ôš' => 'Ô›',
- 'Ԝ' => '�',
- 'Ôž' => 'ÔŸ',
- 'Ô ' => 'Ô¡',
- 'Ô¢' => 'Ô£',
- 'Ô¤' => 'Ô¥',
- 'Ô¦' => 'Ô§',
- 'Ô¨' => 'Ô©',
- 'Ôª' => 'Ô«',
- 'Ô¬' => 'Ô',
- 'Ô®' => 'Ô¯',
- 'Ô±' => 'Õ¡',
- 'Ô²' => 'Õ¢',
- 'Ô³' => 'Õ£',
- 'Ô´' => 'Õ¤',
- 'Ôµ' => 'Õ¥',
- 'Ô¶' => 'Õ¦',
- 'Ô·' => 'Õ§',
- 'Ô¸' => 'Õ¨',
- 'Ô¹' => 'Õ©',
- 'Ôº' => 'Õª',
- 'Ô»' => 'Õ«',
- 'Ô¼' => 'Õ¬',
- 'Ô½' => 'Õ',
- 'Ô¾' => 'Õ®',
- 'Ô¿' => 'Õ¯',
- 'Õ€' => 'Õ°',
- 'Õ�' => 'Õ±',
- 'Õ‚' => 'Õ²',
- 'Õƒ' => 'Õ³',
- 'Õ„' => 'Õ´',
- 'Õ…' => 'Õµ',
- 'Õ†' => 'Õ¶',
- 'Õ‡' => 'Õ·',
- 'Õˆ' => 'Õ¸',
- 'Õ‰' => 'Õ¹',
- 'ÕŠ' => 'Õº',
- 'Õ‹' => 'Õ»',
- 'Ռ' => 'ռ',
- 'Õ�' => 'Õ½',
- 'ÕŽ' => 'Õ¾',
- 'Õ�' => 'Õ¿',
- 'Õ�' => 'Ö€',
- 'Õ‘' => 'Ö�',
- 'Õ’' => 'Ö‚',
- 'Õ“' => 'Öƒ',
- 'Õ”' => 'Ö„',
- 'Õ•' => 'Ö…',
- 'Õ–' => 'Ö†',
- 'á‚ ' => 'â´€',
- 'á‚¡' => 'â´�',
- 'á‚¢' => 'â´‚',
- 'á‚£' => 'â´ƒ',
- 'Ⴄ' => 'ⴄ',
- 'á‚¥' => 'â´…',
- 'Ⴆ' => 'ⴆ',
- 'Ⴇ' => 'ⴇ',
- 'Ⴈ' => 'ⴈ',
- 'á‚©' => 'â´‰',
- 'Ⴊ' => 'ⴊ',
- 'á‚«' => 'â´‹',
- 'Ⴌ' => 'ⴌ',
- 'á‚' => 'â´�',
- 'á‚®' => 'â´Ž',
- 'Ⴏ' => '�',
- 'á‚°' => 'â´�',
- 'Ⴑ' => 'ⴑ',
- 'Ⴒ' => 'ⴒ',
- 'Ⴓ' => 'ⴓ',
- 'á‚´' => 'â´”',
- 'Ⴕ' => 'ⴕ',
- 'Ⴖ' => 'ⴖ',
- 'á‚·' => 'â´—',
- 'Ⴘ' => 'ⴘ',
- 'Ⴙ' => 'ⴙ',
- 'Ⴚ' => 'ⴚ',
- 'á‚»' => 'â´›',
- 'Ⴜ' => 'ⴜ',
- 'Ⴝ' => '�',
- 'Ⴞ' => 'ⴞ',
- 'á‚¿' => 'â´Ÿ',
- 'Ⴠ' => 'ⴠ',
- '�' => 'ⴡ',
- 'Ⴢ' => 'ⴢ',
- 'Ⴣ' => 'ⴣ',
- 'Ⴤ' => 'ⴤ',
- 'Ⴥ' => 'ⴥ',
- 'Ⴧ' => 'ⴧ',
- 'áƒ�' => 'â´',
- 'Ꭰ' => 'ê°',
- 'Ꭱ' => 'ê±',
- 'Ꭲ' => 'ê²',
- 'Ꭳ' => 'ê³',
- 'Ꭴ' => 'ê´',
- 'Ꭵ' => 'êµ',
- 'Ꭶ' => 'ê¶',
- 'Ꭷ' => 'ê·',
- 'Ꭸ' => 'ê¸',
- 'Ꭹ' => 'ê¹',
- 'Ꭺ' => 'êº',
- 'Ꭻ' => 'ê»',
- 'Ꭼ' => 'ê¼',
- 'áŽ' => 'ê½',
- 'Ꭾ' => 'ê¾',
- 'Ꭿ' => 'ê¿',
- 'Ꮀ' => 'ꮀ',
- 'Ꮁ' => '�',
- 'Ꮂ' => 'ꮂ',
- 'Ꮃ' => 'ꮃ',
- 'Ꮄ' => 'ꮄ',
- 'Ꮅ' => 'ꮅ',
- 'Ꮆ' => 'ꮆ',
- 'Ꮇ' => 'ꮇ',
- 'Ꮈ' => 'ꮈ',
- 'Ꮉ' => 'ꮉ',
- 'Ꮊ' => 'ꮊ',
- 'Ꮋ' => 'ꮋ',
- 'Ꮌ' => 'ꮌ',
- 'Ꮍ' => '�',
- 'Ꮎ' => 'ꮎ',
- 'Ꮏ' => '�',
- '�' => '�',
- '�' => 'ꮑ',
- '�' => 'ꮒ',
- '�' => 'ꮓ',
- '�' => 'ꮔ',
- '�' => 'ꮕ',
- '�' => 'ꮖ',
- '�' => 'ꮗ',
- '�' => 'ꮘ',
- '�' => 'ꮙ',
- '�' => 'ꮚ',
- '�' => 'ꮛ',
- '�' => 'ꮜ',
- '�' => '�',
- '�' => 'ꮞ',
- '�' => 'ꮟ',
- 'á��' => 'ê® ',
- '�' => 'ꮡ',
- '�' => 'ꮢ',
- '�' => 'ꮣ',
- '�' => 'ꮤ',
- '�' => 'ꮥ',
- '�' => 'ꮦ',
- '�' => 'ꮧ',
- '�' => 'ꮨ',
- '�' => 'ꮩ',
- '�' => 'ꮪ',
- '�' => 'ꮫ',
- '�' => 'ꮬ',
- 'á��' => 'ê®',
- '�' => 'ꮮ',
- '�' => 'ꮯ',
- 'á� ' => 'ê®°',
- '�' => 'ꮱ',
- '�' => 'ꮲ',
- '�' => 'ꮳ',
- '�' => 'ꮴ',
- '�' => 'ꮵ',
- '�' => 'ꮶ',
- '�' => 'ꮷ',
- '�' => 'ꮸ',
- '�' => 'ꮹ',
- '�' => 'ꮺ',
- '�' => 'ꮻ',
- '�' => 'ꮼ',
- 'á�' => 'ꮽ',
- '�' => 'ꮾ',
- '�' => 'ꮿ',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- 'Ბ' => 'ბ',
- 'Გ' => 'გ',
- 'Დ' => 'დ',
- 'Ე' => 'ე',
- 'Ვ' => 'ვ',
- 'Ზ' => 'ზ',
- 'Თ' => 'თ',
- 'Ი' => 'ი',
- 'Კ' => 'კ',
- 'Ლ' => 'ლ',
- 'Მ' => 'მ',
- 'Ნ' => 'ნ',
- '�' => '�',
- 'Პ' => 'პ',
- 'Ჟ' => 'ჟ',
- 'Რ' => 'რ',
- 'Ს' => 'ს',
- 'Ტ' => 'ტ',
- 'Უ' => 'უ',
- 'Ფ' => 'ფ',
- 'Ქ' => 'ქ',
- 'Ღ' => 'ღ',
- 'Ყ' => 'ყ',
- 'Შ' => 'შ',
- 'Ჩ' => 'ჩ',
- 'Ც' => 'ც',
- 'Ძ' => 'ძ',
- 'Წ' => 'წ',
- 'á²' => 'áƒ',
- 'Ხ' => 'ხ',
- 'Ჯ' => 'ჯ',
- 'Ჰ' => 'ჰ',
- 'Ჱ' => 'ჱ',
- 'Ჲ' => 'ჲ',
- 'Ჳ' => 'ჳ',
- 'Ჴ' => 'ჴ',
- 'Ჵ' => 'ჵ',
- 'Ჶ' => 'ჶ',
- 'Ჷ' => 'ჷ',
- 'Ჸ' => 'ჸ',
- 'Ჹ' => 'ჹ',
- 'Ჺ' => 'ჺ',
- 'Ჽ' => 'ჽ',
- 'Ჾ' => 'ჾ',
- 'Ჿ' => 'ჿ',
- 'Ḁ' => '�',
- 'Ḃ' => 'ḃ',
- 'Ḅ' => 'ḅ',
- 'Ḇ' => 'ḇ',
- 'Ḉ' => 'ḉ',
- 'Ḋ' => 'ḋ',
- 'Ḍ' => '�',
- 'Ḏ' => '�',
- '�' => 'ḑ',
- 'Ḓ' => 'ḓ',
- 'Ḕ' => 'ḕ',
- 'Ḗ' => 'ḗ',
- 'Ḙ' => 'ḙ',
- 'Ḛ' => 'ḛ',
- 'Ḝ' => '�',
- 'Ḟ' => 'ḟ',
- 'Ḡ' => 'ḡ',
- 'Ḣ' => 'ḣ',
- 'Ḥ' => 'ḥ',
- 'Ḧ' => 'ḧ',
- 'Ḩ' => 'ḩ',
- 'Ḫ' => 'ḫ',
- 'Ḭ' => 'á¸',
- 'Ḯ' => 'ḯ',
- 'Ḱ' => 'ḱ',
- 'Ḳ' => 'ḳ',
- 'Ḵ' => 'ḵ',
- 'Ḷ' => 'ḷ',
- 'Ḹ' => 'ḹ',
- 'Ḻ' => 'ḻ',
- 'Ḽ' => 'ḽ',
- 'Ḿ' => 'ḿ',
- 'Ṁ' => '�',
- 'Ṃ' => 'ṃ',
- 'Ṅ' => 'ṅ',
- 'Ṇ' => 'ṇ',
- 'Ṉ' => 'ṉ',
- 'Ṋ' => 'ṋ',
- 'Ṍ' => '�',
- 'Ṏ' => '�',
- '�' => 'ṑ',
- 'Ṓ' => 'ṓ',
- 'Ṕ' => 'ṕ',
- 'á¹–' => 'á¹—',
- 'Ṙ' => 'ṙ',
- 'Ṛ' => 'ṛ',
- 'Ṝ' => '�',
- 'Ṟ' => 'ṟ',
- 'Ṡ' => 'ṡ',
- 'á¹¢' => 'á¹£',
- 'Ṥ' => 'ṥ',
- 'Ṧ' => 'ṧ',
- 'Ṩ' => 'ṩ',
- 'Ṫ' => 'ṫ',
- 'Ṭ' => 'á¹',
- 'Ṯ' => 'ṯ',
- 'á¹°' => 'á¹±',
- 'á¹²' => 'á¹³',
- 'á¹´' => 'á¹µ',
- 'Ṷ' => 'ṷ',
- 'Ṹ' => 'ṹ',
- 'Ṻ' => 'ṻ',
- 'á¹¼' => 'á¹½',
- 'Ṿ' => 'ṿ',
- 'Ẁ' => '�',
- 'Ẃ' => 'ẃ',
- 'Ẅ' => 'ẅ',
- 'Ẇ' => 'ẇ',
- 'Ẉ' => 'ẉ',
- 'Ẋ' => 'ẋ',
- 'Ẍ' => '�',
- 'Ẏ' => '�',
- '�' => 'ẑ',
- 'Ẓ' => 'ẓ',
- 'Ẕ' => 'ẕ',
- 'ẞ' => 'ß',
- 'Ạ' => 'ạ',
- 'Ả' => 'ả',
- 'Ấ' => 'ấ',
- 'Ầ' => 'ầ',
- 'Ẩ' => 'ẩ',
- 'Ẫ' => 'ẫ',
- 'Ậ' => 'áº',
- 'Ắ' => 'ắ',
- 'Ằ' => 'ằ',
- 'Ẳ' => 'ẳ',
- 'Ẵ' => 'ẵ',
- 'Ặ' => 'ặ',
- 'Ẹ' => 'ẹ',
- 'Ẻ' => 'ẻ',
- 'Ẽ' => 'ẽ',
- 'Ế' => 'ế',
- 'Ề' => '�',
- 'Ể' => 'ể',
- 'Ễ' => 'ễ',
- 'Ệ' => 'ệ',
- 'Ỉ' => 'ỉ',
- 'Ị' => 'ị',
- 'Ọ' => '�',
- 'Ỏ' => '�',
- '�' => 'ố',
- 'Ồ' => 'ồ',
- 'Ổ' => 'ổ',
- 'á»–' => 'á»—',
- 'Ộ' => 'ộ',
- 'Ớ' => 'ớ',
- 'Ờ' => '�',
- 'Ở' => 'ở',
- 'Ỡ' => 'ỡ',
- 'Ợ' => 'ợ',
- 'Ụ' => 'ụ',
- 'Ủ' => 'ủ',
- 'Ứ' => 'ứ',
- 'Ừ' => 'ừ',
- 'Ử' => 'á»',
- 'Ữ' => 'ữ',
- 'á»°' => 'á»±',
- 'Ỳ' => 'ỳ',
- 'Ỵ' => 'ỵ',
- 'Ỷ' => 'ỷ',
- 'Ỹ' => 'ỹ',
- 'Ỻ' => 'ỻ',
- 'Ỽ' => 'ỽ',
- 'Ỿ' => 'ỿ',
- 'Ἀ' => 'ἀ',
- 'Ἁ' => '�',
- 'Ἂ' => 'ἂ',
- 'Ἃ' => 'ἃ',
- 'Ἄ' => 'ἄ',
- '�' => 'ἅ',
- 'Ἆ' => 'ἆ',
- '�' => 'ἇ',
- 'Ἐ' => '�',
- 'Ἑ' => 'ἑ',
- 'Ἒ' => 'ἒ',
- 'Ἓ' => 'ἓ',
- 'Ἔ' => 'ἔ',
- '�' => 'ἕ',
- 'Ἠ' => 'ἠ',
- 'Ἡ' => 'ἡ',
- 'Ἢ' => 'ἢ',
- 'Ἣ' => 'ἣ',
- 'Ἤ' => 'ἤ',
- 'á¼' => 'á¼¥',
- 'Ἦ' => 'ἦ',
- 'Ἧ' => 'ἧ',
- 'Ἰ' => 'ἰ',
- 'á¼¹' => 'á¼±',
- 'Ἲ' => 'ἲ',
- 'á¼»' => 'á¼³',
- 'á¼¼' => 'á¼´',
- 'á¼½' => 'á¼µ',
- 'Ἶ' => 'ἶ',
- 'Ἷ' => 'ἷ',
- 'Ὀ' => 'ὀ',
- 'Ὁ' => '�',
- 'Ὂ' => 'ὂ',
- 'Ὃ' => 'ὃ',
- 'Ὄ' => 'ὄ',
- '�' => 'ὅ',
- 'Ὑ' => 'ὑ',
- 'Ὓ' => 'ὓ',
- '�' => 'ὕ',
- 'Ὗ' => 'ὗ',
- 'Ὠ' => 'ὠ',
- 'Ὡ' => 'ὡ',
- 'Ὢ' => 'ὢ',
- 'Ὣ' => 'ὣ',
- 'Ὤ' => 'ὤ',
- 'á½' => 'á½¥',
- 'Ὦ' => 'ὦ',
- 'Ὧ' => 'ὧ',
- 'ᾈ' => 'ᾀ',
- 'ᾉ' => '�',
- 'ᾊ' => 'ᾂ',
- 'ᾋ' => 'ᾃ',
- 'ᾌ' => 'ᾄ',
- '�' => 'ᾅ',
- 'ᾎ' => 'ᾆ',
- '�' => 'ᾇ',
- 'ᾘ' => '�',
- 'ᾙ' => 'ᾑ',
- 'ᾚ' => 'ᾒ',
- 'ᾛ' => 'ᾓ',
- 'ᾜ' => 'ᾔ',
- '�' => 'ᾕ',
- 'ᾞ' => 'ᾖ',
- 'ᾟ' => 'ᾗ',
- 'ᾨ' => 'ᾠ',
- 'ᾩ' => 'ᾡ',
- 'ᾪ' => 'ᾢ',
- 'ᾫ' => 'ᾣ',
- 'ᾬ' => 'ᾤ',
- 'á¾' => 'á¾¥',
- 'ᾮ' => 'ᾦ',
- 'ᾯ' => 'ᾧ',
- 'Ᾰ' => 'ᾰ',
- 'á¾¹' => 'á¾±',
- 'Ὰ' => 'ὰ',
- 'á¾»' => 'á½±',
- 'á¾¼' => 'á¾³',
- 'Ὲ' => 'ὲ',
- 'Έ' => 'έ',
- 'á¿Š' => 'á½´',
- 'á¿‹' => 'á½µ',
- 'ῌ' => 'ῃ',
- 'Ῐ' => '�',
- 'á¿™' => 'á¿‘',
- 'Ὶ' => 'ὶ',
- 'á¿›' => 'á½·',
- 'Ῠ' => 'ῠ',
- 'á¿©' => 'á¿¡',
- 'Ὺ' => 'ὺ',
- 'á¿«' => 'á½»',
- 'Ῥ' => 'ῥ',
- 'Ὸ' => 'ὸ',
- 'Ό' => 'ό',
- 'Ὼ' => 'ὼ',
- 'á¿»' => 'á½½',
- 'ῼ' => 'ῳ',
- 'Ω' => 'ω',
- 'K' => 'k',
- 'â„«' => 'Ã¥',
- 'Ⅎ' => 'ⅎ',
- 'â… ' => 'â…°',
- 'â…¡' => 'â…±',
- 'â…¢' => 'â…²',
- 'â…£' => 'â…³',
- 'â…¤' => 'â…´',
- 'â…¥' => 'â…µ',
- 'â…¦' => 'â…¶',
- 'â…§' => 'â…·',
- 'â…¨' => 'â…¸',
- 'â…©' => 'â…¹',
- 'â…ª' => 'â…º',
- 'â…«' => 'â…»',
- 'â…¬' => 'â…¼',
- 'â…' => 'â…½',
- 'â…®' => 'â…¾',
- 'â…¯' => 'â…¿',
- 'Ↄ' => 'ↄ',
- 'Ⓐ' => '�',
- 'â’·' => 'â“‘',
- 'â’¸' => 'â“’',
- 'â’¹' => 'â““',
- 'â’º' => 'â“”',
- 'â’»' => 'â“•',
- 'â’¼' => 'â“–',
- 'â’½' => 'â“—',
- 'Ⓘ' => 'ⓘ',
- 'â’¿' => 'â“™',
- 'â“€' => 'â“š',
- '�' => 'ⓛ',
- 'Ⓜ' => 'ⓜ',
- 'Ⓝ' => '�',
- 'â“„' => 'â“ž',
- 'â“…' => 'â“Ÿ',
- 'Ⓠ' => 'ⓠ',
- 'Ⓡ' => 'ⓡ',
- 'Ⓢ' => 'ⓢ',
- 'Ⓣ' => 'ⓣ',
- 'Ⓤ' => 'ⓤ',
- 'â“‹' => 'â“¥',
- 'Ⓦ' => 'ⓦ',
- '�' => 'ⓧ',
- 'Ⓨ' => 'ⓨ',
- '�' => 'ⓩ',
- 'â°€' => 'â°°',
- 'â°�' => 'â°±',
- 'â°‚' => 'â°²',
- 'â°ƒ' => 'â°³',
- 'â°„' => 'â°´',
- 'â°…' => 'â°µ',
- 'â°†' => 'â°¶',
- 'â°‡' => 'â°·',
- 'â°ˆ' => 'â°¸',
- 'â°‰' => 'â°¹',
- 'â°Š' => 'â°º',
- 'â°‹' => 'â°»',
- 'Ⰼ' => 'ⰼ',
- 'â°�' => 'â°½',
- 'â°Ž' => 'â°¾',
- 'â°�' => 'â°¿',
- 'â°�' => 'â±€',
- 'Ⱁ' => '�',
- 'Ⱂ' => 'ⱂ',
- 'Ⱃ' => 'ⱃ',
- 'Ⱄ' => 'ⱄ',
- 'â°•' => 'â±…',
- 'Ⱆ' => 'ⱆ',
- 'Ⱇ' => 'ⱇ',
- 'Ⱈ' => 'ⱈ',
- 'Ⱉ' => 'ⱉ',
- 'Ⱊ' => 'ⱊ',
- 'Ⱋ' => 'ⱋ',
- 'Ⱌ' => 'ⱌ',
- '�' => '�',
- 'Ⱎ' => 'ⱎ',
- 'Ⱏ' => '�',
- 'Ⱐ' => '�',
- 'Ⱑ' => 'ⱑ',
- 'â°¢' => 'â±’',
- 'Ⱓ' => 'ⱓ',
- 'â°¤' => 'â±”',
- 'Ⱕ' => 'ⱕ',
- 'â°¦' => 'â±–',
- 'â°§' => 'â±—',
- 'Ⱘ' => 'ⱘ',
- 'â°©' => 'â±™',
- 'Ⱚ' => 'ⱚ',
- 'â°«' => 'â±›',
- 'Ⱜ' => 'ⱜ',
- 'â°' => 'â±�',
- 'Ⱞ' => 'ⱞ',
- 'Ⱡ' => 'ⱡ',
- 'â±¢' => 'É«',
- 'â±£' => 'áµ½',
- 'Ɽ' => 'ɽ',
- 'Ⱨ' => 'ⱨ',
- 'Ⱪ' => 'ⱪ',
- 'Ⱬ' => 'ⱬ',
- 'â±' => 'É‘',
- 'Ɱ' => 'ɱ',
- 'Ɐ' => '�',
- 'â±°' => 'É’',
- 'â±²' => 'â±³',
- 'Ⱶ' => 'ⱶ',
- 'â±¾' => 'È¿',
- 'Ɀ' => 'ɀ',
- 'Ⲁ' => '�',
- 'Ⲃ' => 'ⲃ',
- 'Ⲅ' => 'ⲅ',
- 'Ⲇ' => 'ⲇ',
- 'Ⲉ' => 'ⲉ',
- 'Ⲋ' => 'ⲋ',
- 'Ⲍ' => '�',
- 'Ⲏ' => '�',
- '�' => 'ⲑ',
- 'Ⲓ' => 'ⲓ',
- 'Ⲕ' => 'ⲕ',
- 'â²–' => 'â²—',
- 'Ⲙ' => 'ⲙ',
- 'Ⲛ' => 'ⲛ',
- 'Ⲝ' => '�',
- 'Ⲟ' => 'ⲟ',
- 'Ⲡ' => 'ⲡ',
- 'â²¢' => 'â²£',
- 'Ⲥ' => 'ⲥ',
- 'Ⲧ' => 'ⲧ',
- 'Ⲩ' => 'ⲩ',
- 'Ⲫ' => 'ⲫ',
- 'Ⲭ' => 'â²',
- 'Ⲯ' => 'ⲯ',
- 'â²°' => 'â²±',
- 'â²²' => 'â²³',
- 'â²´' => 'â²µ',
- 'Ⲷ' => 'ⲷ',
- 'Ⲹ' => 'ⲹ',
- 'Ⲻ' => 'ⲻ',
- 'â²¼' => 'â²½',
- 'Ⲿ' => 'ⲿ',
- 'Ⳁ' => '�',
- 'Ⳃ' => 'ⳃ',
- 'Ⳅ' => 'ⳅ',
- 'Ⳇ' => 'ⳇ',
- 'Ⳉ' => 'ⳉ',
- 'Ⳋ' => 'ⳋ',
- 'Ⳍ' => '�',
- 'Ⳏ' => '�',
- '�' => 'ⳑ',
- 'Ⳓ' => 'ⳓ',
- 'Ⳕ' => 'ⳕ',
- 'â³–' => 'â³—',
- 'Ⳙ' => 'ⳙ',
- 'Ⳛ' => 'ⳛ',
- 'Ⳝ' => '�',
- 'Ⳟ' => 'ⳟ',
- 'Ⳡ' => 'ⳡ',
- 'â³¢' => 'â³£',
- 'Ⳬ' => 'ⳬ',
- 'â³' => 'â³®',
- 'â³²' => 'â³³',
- 'Ꙁ' => '�',
- 'Ꙃ' => 'ꙃ',
- 'Ꙅ' => 'ꙅ',
- 'Ꙇ' => 'ꙇ',
- 'Ꙉ' => 'ꙉ',
- 'Ꙋ' => 'ꙋ',
- 'Ꙍ' => '�',
- 'Ꙏ' => '�',
- '�' => 'ꙑ',
- 'Ꙓ' => 'ꙓ',
- 'Ꙕ' => 'ꙕ',
- 'ê™–' => 'ê™—',
- 'Ꙙ' => 'ꙙ',
- 'Ꙛ' => 'ꙛ',
- 'Ꙝ' => '�',
- 'Ꙟ' => 'ꙟ',
- 'ê™ ' => 'ꙡ',
- 'Ꙣ' => 'ꙣ',
- 'Ꙥ' => 'ꙥ',
- 'Ꙧ' => 'ꙧ',
- 'Ꙩ' => 'ꙩ',
- 'Ꙫ' => 'ꙫ',
- 'Ꙭ' => 'ê™',
- 'Ꚁ' => '�',
- 'Ꚃ' => 'ꚃ',
- 'êš„' => 'êš…',
- 'Ꚇ' => 'ꚇ',
- 'Ꚉ' => 'ꚉ',
- 'Ꚋ' => 'ꚋ',
- 'Ꚍ' => '�',
- 'Ꚏ' => '�',
- '�' => 'ꚑ',
- 'êš’' => 'êš“',
- 'êš”' => 'êš•',
- 'êš–' => 'êš—',
- 'Ꚙ' => 'ꚙ',
- 'êšš' => 'êš›',
- 'Ꜣ' => 'ꜣ',
- 'Ꜥ' => 'ꜥ',
- 'Ꜧ' => 'ꜧ',
- 'Ꜩ' => 'ꜩ',
- 'Ꜫ' => 'ꜫ',
- 'Ꜭ' => 'êœ',
- 'Ꜯ' => 'ꜯ',
- 'Ꜳ' => 'ꜳ',
- 'Ꜵ' => 'ꜵ',
- 'Ꜷ' => 'ꜷ',
- 'Ꜹ' => 'ꜹ',
- 'Ꜻ' => 'ꜻ',
- 'Ꜽ' => 'ꜽ',
- 'Ꜿ' => 'ꜿ',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- 'ê� ' => 'ê�¡',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- 'ê�¬' => 'ê�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => 'ᵹ',
- '�' => '�',
- 'Ꞁ' => '�',
- 'Ꞃ' => 'ꞃ',
- 'êž„' => 'êž…',
- 'Ꞇ' => 'ꞇ',
- 'Ꞌ' => 'ꞌ',
- '�' => 'ɥ',
- '�' => 'ꞑ',
- 'êž’' => 'êž“',
- 'êž–' => 'êž—',
- 'Ꞙ' => 'ꞙ',
- 'êžš' => 'êž›',
- 'Ꞝ' => '�',
- 'Ꞟ' => 'ꞟ',
- 'êž ' => 'êž¡',
- 'Ꞣ' => 'ꞣ',
- 'Ꞥ' => 'ꞥ',
- 'Ꞧ' => 'ꞧ',
- 'Ꞩ' => 'ꞩ',
- 'Ɦ' => 'ɦ',
- 'Ɜ' => 'ɜ',
- 'Ɡ' => 'ɡ',
- 'êž' => 'ɬ',
- 'Ɪ' => 'ɪ',
- 'êž°' => 'Êž',
- 'Ʇ' => 'ʇ',
- 'Ʝ' => '�',
- 'êž³' => 'ê“',
- 'êž´' => 'êžµ',
- 'Ꞷ' => 'ꞷ',
- 'Ꞹ' => 'ꞹ',
- 'Ꞻ' => 'ꞻ',
- 'êž¼' => 'êž½',
- 'êž¾' => 'êž¿',
- 'Ꟃ' => 'ꟃ',
- 'Ꞔ' => 'ꞔ',
- 'Ʂ' => 'ʂ',
- 'Ᶎ' => 'ᶎ',
- 'Ꟈ' => 'ꟈ',
- 'Ꟊ' => 'ꟊ',
- 'Ꟶ' => 'ꟶ',
- 'A' => '�',
- 'B' => 'b',
- 'C' => 'c',
- 'D' => 'd',
- 'ï¼¥' => 'ï½…',
- 'F' => 'f',
- 'G' => 'g',
- 'H' => 'h',
- 'I' => 'i',
- 'J' => 'j',
- 'K' => 'k',
- 'L' => 'l',
- 'ï¼' => 'ï½�',
- 'N' => 'n',
- 'O' => '�',
- 'P' => '�',
- 'Q' => 'q',
- 'ï¼²' => 'ï½’',
- 'S' => 's',
- 'ï¼´' => 'ï½”',
- 'U' => 'u',
- 'V' => 'v',
- 'ï¼·' => 'ï½—',
- 'X' => 'x',
- 'ï¼¹' => 'ï½™',
- 'Z' => 'z',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- 'ð��…' => 'ð��',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- 'ð�� ' => 'ð�‘ˆ',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- 'ð�’¸' => 'ð�“ ',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- 'ð�“…' => 'ð�“',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- 'ð�² ' => 'ð�³ ',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- 'ð�²' => 'ð�³',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- 'ð‘¢ ' => 'ð‘£€',
- '𑢡' => '�',
- '𑢢' => '𑣂',
- '𑢣' => '𑣃',
- '𑢤' => '𑣄',
- 'ð‘¢¥' => 'ð‘£…',
- '𑢦' => '𑣆',
- '𑢧' => '𑣇',
- '𑢨' => '𑣈',
- '𑢩' => '𑣉',
- '𑢪' => '𑣊',
- '𑢫' => '𑣋',
- '𑢬' => '𑣌',
- 'ð‘¢' => 'ð‘£�',
- '𑢮' => '𑣎',
- '𑢯' => '�',
- '𑢰' => '�',
- '𑢱' => '𑣑',
- 'ð‘¢²' => 'ð‘£’',
- '𑢳' => '𑣓',
- 'ð‘¢´' => 'ð‘£”',
- '𑢵' => '𑣕',
- '𑢶' => '𑣖',
- 'ð‘¢·' => 'ð‘£—',
- '𑢸' => '𑣘',
- 'ð‘¢¹' => 'ð‘£™',
- '𑢺' => '𑣚',
- 'ð‘¢»' => 'ð‘£›',
- '𑢼' => '𑣜',
- '𑢽' => '�',
- '𑢾' => '𑣞',
- '𑢿' => '𑣟',
- 'ð–¹€' => 'ð–¹ ',
- '�' => '𖹡',
- '𖹂' => '𖹢',
- '𖹃' => '𖹣',
- '𖹄' => '𖹤',
- 'ð–¹…' => 'ð–¹¥',
- '𖹆' => '𖹦',
- '𖹇' => '𖹧',
- '𖹈' => '𖹨',
- '𖹉' => '𖹩',
- '𖹊' => '𖹪',
- '𖹋' => '𖹫',
- '𖹌' => '𖹬',
- 'ð–¹�' => 'ð–¹',
- '𖹎' => '𖹮',
- '�' => '𖹯',
- '�' => '𖹰',
- '𖹑' => '𖹱',
- 'ð–¹’' => 'ð–¹²',
- '𖹓' => '𖹳',
- 'ð–¹”' => 'ð–¹´',
- '𖹕' => '𖹵',
- '𖹖' => '𖹶',
- 'ð–¹—' => 'ð–¹·',
- '𖹘' => '𖹸',
- 'ð–¹™' => 'ð–¹¹',
- '𖹚' => '𖹺',
- 'ð–¹›' => 'ð–¹»',
- '𖹜' => '𖹼',
- '�' => '𖹽',
- '𖹞' => '𖹾',
- '𖹟' => '𖹿',
- '𞤀' => '𞤢',
- '�' => '𞤣',
- '𞤂' => '𞤤',
- '𞤃' => '𞤥',
- '𞤄' => '𞤦',
- '𞤅' => '𞤧',
- '𞤆' => '𞤨',
- '𞤇' => '𞤩',
- '𞤈' => '𞤪',
- '𞤉' => '𞤫',
- '𞤊' => '𞤬',
- '𞤋' => 'ðž¤',
- '𞤌' => '𞤮',
- '�' => '𞤯',
- '𞤎' => '𞤰',
- '�' => '𞤱',
- '�' => '𞤲',
- '𞤑' => '𞤳',
- '𞤒' => '𞤴',
- '𞤓' => '𞤵',
- '𞤔' => '𞤶',
- '𞤕' => '𞤷',
- '𞤖' => '𞤸',
- '𞤗' => '𞤹',
- '𞤘' => '𞤺',
- '𞤙' => '𞤻',
- '𞤚' => '𞤼',
- '𞤛' => '𞤽',
- '𞤜' => '𞤾',
- '�' => '𞤿',
- '𞤞' => '𞥀',
- '𞤟' => '�',
- '𞤠' => '𞥂',
- '𞤡' => '𞥃',
- );
- <?php
- 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';
- <?php
- return array (
- 'a' => 'A',
- 'b' => 'B',
- 'c' => 'C',
- 'd' => 'D',
- 'e' => 'E',
- 'f' => 'F',
- 'g' => 'G',
- 'h' => 'H',
- 'i' => 'I',
- 'j' => 'J',
- 'k' => 'K',
- 'l' => 'L',
- 'm' => 'M',
- 'n' => 'N',
- 'o' => 'O',
- 'p' => 'P',
- 'q' => 'Q',
- 'r' => 'R',
- 's' => 'S',
- 't' => 'T',
- 'u' => 'U',
- 'v' => 'V',
- 'w' => 'W',
- 'x' => 'X',
- 'y' => 'Y',
- 'z' => 'Z',
- 'µ' => 'Μ',
- 'à ' => 'À',
- 'á' => '�',
- 'â' => 'Â',
- 'ã' => 'Ã',
- 'ä' => 'Ä',
- 'Ã¥' => 'Ã…',
- 'æ' => 'Æ',
- 'ç' => 'Ç',
- 'è' => 'È',
- 'é' => 'É',
- 'ê' => 'Ê',
- 'ë' => 'Ë',
- 'ì' => 'Ì',
- 'Ã' => 'Ã�',
- 'î' => 'Î',
- 'ï' => '�',
- 'ð' => '�',
- 'ñ' => 'Ñ',
- 'ò' => 'Ò',
- 'ó' => 'Ó',
- 'ô' => 'Ô',
- 'õ' => 'Õ',
- 'ö' => 'Ö',
- 'ø' => 'Ø',
- 'ù' => 'Ù',
- 'ú' => 'Ú',
- 'û' => 'Û',
- 'ü' => 'Ü',
- 'ý' => '�',
- 'þ' => 'Þ',
- 'ÿ' => 'Ÿ',
- '�' => 'Ā',
- 'ă' => 'Ă',
- 'Ä…' => 'Ä„',
- 'ć' => 'Ć',
- 'ĉ' => 'Ĉ',
- 'Ä‹' => 'ÄŠ',
- '�' => 'Č',
- '�' => 'Ď',
- 'đ' => '�',
- 'Ä“' => 'Ä’',
- 'Ä•' => 'Ä”',
- 'Ä—' => 'Ä–',
- 'ę' => 'Ę',
- 'Ä›' => 'Äš',
- '�' => 'Ĝ',
- 'ÄŸ' => 'Äž',
- 'Ä¡' => 'Ä ',
- 'Ä£' => 'Ä¢',
- 'ĥ' => 'Ĥ',
- 'ħ' => 'Ħ',
- 'ĩ' => 'Ĩ',
- 'ī' => 'Ī',
- 'Ä' => 'Ĭ',
- 'į' => 'Į',
- 'ı' => 'I',
- 'ij' => 'IJ',
- 'ĵ' => 'Ĵ',
- 'ķ' => 'Ķ',
- 'ĺ' => 'Ĺ',
- 'ļ' => 'Ļ',
- 'ľ' => 'Ľ',
- 'Å€' => 'Ä¿',
- 'ł' => '�',
- 'ń' => 'Ń',
- 'ņ' => 'Ņ',
- 'ň' => 'Ň',
- 'Å‹' => 'ÅŠ',
- '�' => 'Ō',
- '�' => 'Ŏ',
- 'ő' => '�',
- 'Å“' => 'Å’',
- 'Å•' => 'Å”',
- 'Å—' => 'Å–',
- 'ř' => 'Ř',
- 'Å›' => 'Åš',
- '�' => 'Ŝ',
- 'ÅŸ' => 'Åž',
- 'Å¡' => 'Å ',
- 'Å£' => 'Å¢',
- 'ť' => 'Ť',
- 'ŧ' => 'Ŧ',
- 'ũ' => 'Ũ',
- 'ū' => 'Ū',
- 'Å' => 'Ŭ',
- 'ů' => 'Ů',
- 'ű' => 'Ű',
- 'ų' => 'Ų',
- 'ŵ' => 'Ŵ',
- 'ŷ' => 'Ŷ',
- 'ź' => 'Ź',
- 'ż' => 'Ż',
- 'ž' => 'Ž',
- 'Å¿' => 'S',
- 'ƀ' => 'Ƀ',
- 'ƃ' => 'Ƃ',
- 'Æ…' => 'Æ„',
- 'ƈ' => 'Ƈ',
- 'ƌ' => 'Ƌ',
- 'Æ’' => 'Æ‘',
- 'ƕ' => 'Ƕ',
- 'ƙ' => 'Ƙ',
- 'ƚ' => 'Ƚ',
- 'Æž' => 'È ',
- 'Æ¡' => 'Æ ',
- 'Æ£' => 'Æ¢',
- 'ƥ' => 'Ƥ',
- 'ƨ' => 'Ƨ',
- 'Æ' => 'Ƭ',
- 'ư' => 'Ư',
- 'ƴ' => 'Ƴ',
- 'ƶ' => 'Ƶ',
- 'ƹ' => 'Ƹ',
- 'ƽ' => 'Ƽ',
- 'Æ¿' => 'Ç·',
- 'Ç…' => 'Ç„',
- 'dž' => 'DŽ',
- 'Lj' => 'LJ',
- 'lj' => 'LJ',
- 'Ç‹' => 'ÇŠ',
- 'nj' => 'NJ',
- 'ǎ' => '�',
- '�' => '�',
- 'Ç’' => 'Ç‘',
- 'Ç”' => 'Ç“',
- 'Ç–' => 'Ç•',
- 'ǘ' => 'Ǘ',
- 'Çš' => 'Ç™',
- 'ǜ' => 'Ǜ',
- '�' => 'Ǝ',
- 'ÇŸ' => 'Çž',
- 'Ç¡' => 'Ç ',
- 'Ç£' => 'Ç¢',
- 'ǥ' => 'Ǥ',
- 'ǧ' => 'Ǧ',
- 'ǩ' => 'Ǩ',
- 'ǫ' => 'Ǫ',
- 'Ç' => 'Ǭ',
- 'ǯ' => 'Ǯ',
- 'Dz' => 'DZ',
- 'dz' => 'DZ',
- 'ǵ' => 'Ǵ',
- 'ǹ' => 'Ǹ',
- 'ǻ' => 'Ǻ',
- 'ǽ' => 'Ǽ',
- 'ǿ' => 'Ǿ',
- '�' => 'Ȁ',
- 'ȃ' => 'Ȃ',
- 'È…' => 'È„',
- 'ȇ' => 'Ȇ',
- 'ȉ' => 'Ȉ',
- 'È‹' => 'ÈŠ',
- '�' => 'Ȍ',
- '�' => 'Ȏ',
- 'ȑ' => '�',
- 'È“' => 'È’',
- 'È•' => 'È”',
- 'È—' => 'È–',
- 'ș' => 'Ș',
- 'È›' => 'Èš',
- '�' => 'Ȝ',
- 'ÈŸ' => 'Èž',
- 'È£' => 'È¢',
- 'ȥ' => 'Ȥ',
- 'ȧ' => 'Ȧ',
- 'ȩ' => 'Ȩ',
- 'ȫ' => 'Ȫ',
- 'È' => 'Ȭ',
- 'ȯ' => 'Ȯ',
- 'ȱ' => 'Ȱ',
- 'ȳ' => 'Ȳ',
- 'ȼ' => 'Ȼ',
- 'È¿' => 'â±¾',
- 'ɀ' => 'Ɀ',
- 'ɂ' => '�',
- 'ɇ' => 'Ɇ',
- 'ɉ' => 'Ɉ',
- 'É‹' => 'ÉŠ',
- '�' => 'Ɍ',
- '�' => 'Ɏ',
- '�' => 'Ɐ',
- 'É‘' => 'â±',
- 'É’' => 'â±°',
- 'ɓ' => '�',
- 'ɔ' => 'Ɔ',
- 'ɖ' => 'Ɖ',
- 'É—' => 'ÆŠ',
- 'ə' => '�',
- 'ɛ' => '�',
- 'ɜ' => 'Ɜ',
- 'É ' => 'Æ“',
- 'ɡ' => 'Ɡ',
- 'É£' => 'Æ”',
- 'ɥ' => '�',
- 'ɦ' => 'Ɦ',
- 'ɨ' => 'Ɨ',
- 'É©' => 'Æ–',
- 'ɪ' => 'Ɪ',
- 'É«' => 'â±¢',
- 'ɬ' => 'êž',
- 'ɯ' => 'Ɯ',
- 'ɱ' => 'Ɱ',
- 'ɲ' => '�',
- 'ɵ' => 'Ɵ',
- 'ɽ' => 'Ɽ',
- 'ʀ' => 'Ʀ',
- 'ʂ' => 'Ʂ',
- 'ʃ' => 'Ʃ',
- 'ʇ' => 'Ʇ',
- 'ʈ' => 'Ʈ',
- 'ʉ' => 'Ʉ',
- 'ʊ' => 'Ʊ',
- 'ʋ' => 'Ʋ',
- 'ʌ' => 'Ʌ',
- 'Ê’' => 'Æ·',
- '�' => 'Ʝ',
- 'Êž' => 'êž°',
- 'ͅ' => 'Ι',
- 'ͱ' => 'Ͱ',
- 'ͳ' => 'Ͳ',
- 'ͷ' => 'Ͷ',
- 'ͻ' => 'Ͻ',
- 'ͼ' => 'Ͼ',
- 'ͽ' => 'Ͽ',
- 'ά' => 'Ά',
- 'Î' => 'Έ',
- 'ή' => 'Ή',
- 'ί' => 'Ί',
- 'α' => 'Α',
- 'β' => 'Β',
- 'γ' => 'Γ',
- 'δ' => 'Δ',
- 'ε' => 'Ε',
- 'ζ' => 'Ζ',
- 'η' => 'Η',
- 'θ' => 'Θ',
- 'ι' => 'Ι',
- 'κ' => 'Κ',
- 'λ' => 'Λ',
- 'μ' => 'Μ',
- 'ν' => '�',
- 'ξ' => 'Ξ',
- 'ο' => 'Ο',
- 'Ï€' => 'Î ',
- '�' => 'Ρ',
- 'ς' => 'Σ',
- 'σ' => 'Σ',
- 'τ' => 'Τ',
- 'Ï…' => 'Î¥',
- 'φ' => 'Φ',
- 'χ' => 'Χ',
- 'ψ' => 'Ψ',
- 'ω' => 'Ω',
- 'ϊ' => 'Ϊ',
- 'ϋ' => 'Ϋ',
- 'ό' => 'Ό',
- '�' => 'Ύ',
- 'ώ' => '�',
- '�' => 'Β',
- 'ϑ' => 'Θ',
- 'ϕ' => 'Φ',
- 'Ï–' => 'Î ',
- 'ϗ' => '�',
- 'ϙ' => 'Ϙ',
- 'Ï›' => 'Ïš',
- '�' => 'Ϝ',
- 'ÏŸ' => 'Ïž',
- 'Ï¡' => 'Ï ',
- 'Ï£' => 'Ï¢',
- 'ϥ' => 'Ϥ',
- 'ϧ' => 'Ϧ',
- 'ϩ' => 'Ϩ',
- 'ϫ' => 'Ϫ',
- 'Ï' => 'Ϭ',
- 'ϯ' => 'Ϯ',
- 'ϰ' => 'Κ',
- 'ϱ' => 'Ρ',
- 'ϲ' => 'Ϲ',
- 'ϳ' => 'Ϳ',
- 'ϵ' => 'Ε',
- 'ϸ' => 'Ϸ',
- 'ϻ' => 'Ϻ',
- 'а' => '�',
- 'б' => 'Б',
- 'в' => 'В',
- 'г' => 'Г',
- 'д' => 'Д',
- 'е' => 'Е',
- 'ж' => 'Ж',
- 'з' => 'З',
- 'и' => 'И',
- 'й' => 'Й',
- 'к' => 'К',
- 'л' => 'Л',
- 'м' => 'М',
- 'н' => '�',
- 'о' => 'О',
- 'п' => 'П',
- 'Ñ€' => 'Ð ',
- '�' => 'С',
- 'т' => 'Т',
- 'у' => 'У',
- 'ф' => 'Ф',
- 'Ñ…' => 'Ð¥',
- 'ц' => 'Ц',
- 'ч' => 'Ч',
- 'ш' => 'Ш',
- 'щ' => 'Щ',
- 'ъ' => 'Ъ',
- 'ы' => 'Ы',
- 'ь' => 'Ь',
- 'Ñ�' => 'Ð',
- 'ю' => 'Ю',
- '�' => 'Я',
- '�' => 'Ѐ',
- 'ё' => '�',
- 'ђ' => 'Ђ',
- 'ѓ' => 'Ѓ',
- 'є' => 'Є',
- 'Ñ•' => 'Ð…',
- 'і' => 'І',
- 'ї' => 'Ї',
- 'ј' => 'Ј',
- 'љ' => 'Љ',
- 'њ' => 'Њ',
- 'ћ' => 'Ћ',
- 'ќ' => 'Ќ',
- '�' => '�',
- 'Ñž' => 'ÐŽ',
- 'џ' => '�',
- 'Ñ¡' => 'Ñ ',
- 'Ñ£' => 'Ñ¢',
- 'ѥ' => 'Ѥ',
- 'ѧ' => 'Ѧ',
- 'ѩ' => 'Ѩ',
- 'ѫ' => 'Ѫ',
- 'Ñ' => 'Ѭ',
- 'ѯ' => 'Ѯ',
- 'ѱ' => 'Ѱ',
- 'ѳ' => 'Ѳ',
- 'ѵ' => 'Ѵ',
- 'ѷ' => 'Ѷ',
- 'ѹ' => 'Ѹ',
- 'ѻ' => 'Ѻ',
- 'ѽ' => 'Ѽ',
- 'ѿ' => 'Ѿ',
- 'Ò�' => 'Ò€',
- 'Ò‹' => 'ÒŠ',
- '�' => 'Ҍ',
- 'Ò�' => 'ÒŽ',
- 'Ò‘' => 'Ò�',
- 'Ò“' => 'Ò’',
- 'Ò•' => 'Ò”',
- 'Ò—' => 'Ò–',
- 'Ò™' => 'Ò˜',
- 'Ò›' => 'Òš',
- '�' => 'Ҝ',
- 'ÒŸ' => 'Òž',
- 'Ò¡' => 'Ò ',
- 'Ò£' => 'Ò¢',
- 'Ò¥' => 'Ò¤',
- 'Ò§' => 'Ò¦',
- 'Ò©' => 'Ò¨',
- 'Ò«' => 'Òª',
- 'Ò' => 'Ò¬',
- 'Ò¯' => 'Ò®',
- 'Ò±' => 'Ò°',
- 'Ò³' => 'Ò²',
- 'Òµ' => 'Ò´',
- 'Ò·' => 'Ò¶',
- 'Ò¹' => 'Ò¸',
- 'Ò»' => 'Òº',
- 'Ò½' => 'Ò¼',
- 'Ò¿' => 'Ò¾',
- 'Ó‚' => 'Ó�',
- 'Ó„' => 'Óƒ',
- 'Ó†' => 'Ó…',
- 'Óˆ' => 'Ó‡',
- 'ÓŠ' => 'Ó‰',
- 'ӌ' => 'Ӌ',
- 'ÓŽ' => 'Ó�',
- 'Ó�' => 'Ó€',
- 'Ó‘' => 'Ó�',
- 'Ó“' => 'Ó’',
- 'Ó•' => 'Ó”',
- 'Ó—' => 'Ó–',
- 'Ó™' => 'Ó˜',
- 'Ó›' => 'Óš',
- '�' => 'Ӝ',
- 'ÓŸ' => 'Óž',
- 'Ó¡' => 'Ó ',
- 'Ó£' => 'Ó¢',
- 'Ó¥' => 'Ó¤',
- 'Ó§' => 'Ó¦',
- 'Ó©' => 'Ó¨',
- 'Ó«' => 'Óª',
- 'Ó' => 'Ó¬',
- 'Ó¯' => 'Ó®',
- 'Ó±' => 'Ó°',
- 'Ó³' => 'Ó²',
- 'Óµ' => 'Ó´',
- 'Ó·' => 'Ó¶',
- 'Ó¹' => 'Ó¸',
- 'Ó»' => 'Óº',
- 'Ó½' => 'Ó¼',
- 'Ó¿' => 'Ó¾',
- 'Ô�' => 'Ô€',
- 'Ôƒ' => 'Ô‚',
- 'Ô…' => 'Ô„',
- 'Ô‡' => 'Ô†',
- 'Ô‰' => 'Ôˆ',
- 'Ô‹' => 'ÔŠ',
- '�' => 'Ԍ',
- 'Ô�' => 'ÔŽ',
- 'Ô‘' => 'Ô�',
- 'Ô“' => 'Ô’',
- 'Ô•' => 'Ô”',
- 'Ô—' => 'Ô–',
- 'Ô™' => 'Ô˜',
- 'Ô›' => 'Ôš',
- '�' => 'Ԝ',
- 'ÔŸ' => 'Ôž',
- 'Ô¡' => 'Ô ',
- 'Ô£' => 'Ô¢',
- 'Ô¥' => 'Ô¤',
- 'Ô§' => 'Ô¦',
- 'Ô©' => 'Ô¨',
- 'Ô«' => 'Ôª',
- 'Ô' => 'Ô¬',
- 'Ô¯' => 'Ô®',
- 'Õ¡' => 'Ô±',
- 'Õ¢' => 'Ô²',
- 'Õ£' => 'Ô³',
- 'Õ¤' => 'Ô´',
- 'Õ¥' => 'Ôµ',
- 'Õ¦' => 'Ô¶',
- 'Õ§' => 'Ô·',
- 'Õ¨' => 'Ô¸',
- 'Õ©' => 'Ô¹',
- 'Õª' => 'Ôº',
- 'Õ«' => 'Ô»',
- 'Õ¬' => 'Ô¼',
- 'Õ' => 'Ô½',
- 'Õ®' => 'Ô¾',
- 'Õ¯' => 'Ô¿',
- 'Õ°' => 'Õ€',
- 'Õ±' => 'Õ�',
- 'Õ²' => 'Õ‚',
- 'Õ³' => 'Õƒ',
- 'Õ´' => 'Õ„',
- 'Õµ' => 'Õ…',
- 'Õ¶' => 'Õ†',
- 'Õ·' => 'Õ‡',
- 'Õ¸' => 'Õˆ',
- 'Õ¹' => 'Õ‰',
- 'Õº' => 'ÕŠ',
- 'Õ»' => 'Õ‹',
- 'ռ' => 'Ռ',
- 'Õ½' => 'Õ�',
- 'Õ¾' => 'ÕŽ',
- 'Õ¿' => 'Õ�',
- 'Ö€' => 'Õ�',
- 'Ö�' => 'Õ‘',
- 'Ö‚' => 'Õ’',
- 'Öƒ' => 'Õ“',
- 'Ö„' => 'Õ”',
- 'Ö…' => 'Õ•',
- 'Ö†' => 'Õ–',
- '�' => '�',
- 'ბ' => 'Ბ',
- 'გ' => 'Გ',
- 'დ' => 'Დ',
- 'ე' => 'Ე',
- 'ვ' => 'Ვ',
- 'ზ' => 'Ზ',
- 'თ' => 'Თ',
- 'ი' => 'Ი',
- 'კ' => 'Კ',
- 'ლ' => 'Ლ',
- 'მ' => 'Მ',
- 'ნ' => 'Ნ',
- '�' => '�',
- 'პ' => 'Პ',
- 'ჟ' => 'Ჟ',
- 'რ' => 'Რ',
- 'ს' => 'Ს',
- 'ტ' => 'Ტ',
- 'უ' => 'Უ',
- 'ფ' => 'Ფ',
- 'ქ' => 'Ქ',
- 'ღ' => 'Ღ',
- 'ყ' => 'Ყ',
- 'შ' => 'Შ',
- 'ჩ' => 'Ჩ',
- 'ც' => 'Ც',
- 'ძ' => 'Ძ',
- 'წ' => 'Წ',
- 'áƒ' => 'á²',
- 'ხ' => 'Ხ',
- 'ჯ' => 'Ჯ',
- 'ჰ' => 'Ჰ',
- 'ჱ' => 'Ჱ',
- 'ჲ' => 'Ჲ',
- 'ჳ' => 'Ჳ',
- 'ჴ' => 'Ჴ',
- 'ჵ' => 'Ჵ',
- 'ჶ' => 'Ჶ',
- 'ჷ' => 'Ჷ',
- 'ჸ' => 'Ჸ',
- 'ჹ' => 'Ჹ',
- 'ჺ' => 'Ჺ',
- 'ჽ' => 'Ჽ',
- 'ჾ' => 'Ჾ',
- 'ჿ' => 'Ჿ',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- 'á²€' => 'Ð’',
- '�' => 'Д',
- 'ᲂ' => 'О',
- 'ᲃ' => 'С',
- 'ᲄ' => 'Т',
- 'ᲅ' => 'Т',
- 'ᲆ' => 'Ъ',
- 'ᲇ' => 'Ѣ',
- 'ᲈ' => 'Ꙋ',
- 'ᵹ' => '�',
- 'áµ½' => 'â±£',
- 'ᶎ' => 'Ᶎ',
- '�' => 'Ḁ',
- 'ḃ' => 'Ḃ',
- 'ḅ' => 'Ḅ',
- 'ḇ' => 'Ḇ',
- 'ḉ' => 'Ḉ',
- 'ḋ' => 'Ḋ',
- '�' => 'Ḍ',
- '�' => 'Ḏ',
- 'ḑ' => '�',
- 'ḓ' => 'Ḓ',
- 'ḕ' => 'Ḕ',
- 'ḗ' => 'Ḗ',
- 'ḙ' => 'Ḙ',
- 'ḛ' => 'Ḛ',
- '�' => 'Ḝ',
- 'ḟ' => 'Ḟ',
- 'ḡ' => 'Ḡ',
- 'ḣ' => 'Ḣ',
- 'ḥ' => 'Ḥ',
- 'ḧ' => 'Ḧ',
- 'ḩ' => 'Ḩ',
- 'ḫ' => 'Ḫ',
- 'á¸' => 'Ḭ',
- 'ḯ' => 'Ḯ',
- 'ḱ' => 'Ḱ',
- 'ḳ' => 'Ḳ',
- 'ḵ' => 'Ḵ',
- 'ḷ' => 'Ḷ',
- 'ḹ' => 'Ḹ',
- 'ḻ' => 'Ḻ',
- 'ḽ' => 'Ḽ',
- 'ḿ' => 'Ḿ',
- '�' => 'Ṁ',
- 'ṃ' => 'Ṃ',
- 'ṅ' => 'Ṅ',
- 'ṇ' => 'Ṇ',
- 'ṉ' => 'Ṉ',
- 'ṋ' => 'Ṋ',
- '�' => 'Ṍ',
- '�' => 'Ṏ',
- 'ṑ' => '�',
- 'ṓ' => 'Ṓ',
- 'ṕ' => 'Ṕ',
- 'á¹—' => 'á¹–',
- 'ṙ' => 'Ṙ',
- 'ṛ' => 'Ṛ',
- '�' => 'Ṝ',
- 'ṟ' => 'Ṟ',
- 'ṡ' => 'Ṡ',
- 'á¹£' => 'á¹¢',
- 'ṥ' => 'Ṥ',
- 'ṧ' => 'Ṧ',
- 'ṩ' => 'Ṩ',
- 'ṫ' => 'Ṫ',
- 'á¹' => 'Ṭ',
- 'ṯ' => 'Ṯ',
- 'á¹±' => 'á¹°',
- 'á¹³' => 'á¹²',
- 'á¹µ' => 'á¹´',
- 'ṷ' => 'Ṷ',
- 'ṹ' => 'Ṹ',
- 'ṻ' => 'Ṻ',
- 'á¹½' => 'á¹¼',
- 'ṿ' => 'Ṿ',
- '�' => 'Ẁ',
- 'ẃ' => 'Ẃ',
- 'ẅ' => 'Ẅ',
- 'ẇ' => 'Ẇ',
- 'ẉ' => 'Ẉ',
- 'ẋ' => 'Ẋ',
- '�' => 'Ẍ',
- '�' => 'Ẏ',
- 'ẑ' => '�',
- 'ẓ' => 'Ẓ',
- 'ẕ' => 'Ẕ',
- 'ẛ' => 'Ṡ',
- 'ạ' => 'Ạ',
- 'ả' => 'Ả',
- 'ấ' => 'Ấ',
- 'ầ' => 'Ầ',
- 'ẩ' => 'Ẩ',
- 'ẫ' => 'Ẫ',
- 'áº' => 'Ậ',
- 'ắ' => 'Ắ',
- 'ằ' => 'Ằ',
- 'ẳ' => 'Ẳ',
- 'ẵ' => 'Ẵ',
- 'ặ' => 'Ặ',
- 'ẹ' => 'Ẹ',
- 'ẻ' => 'Ẻ',
- 'ẽ' => 'Ẽ',
- 'ế' => 'Ế',
- '�' => 'Ề',
- 'ể' => 'Ể',
- 'ễ' => 'Ễ',
- 'ệ' => 'Ệ',
- 'ỉ' => 'Ỉ',
- 'ị' => 'Ị',
- '�' => 'Ọ',
- '�' => 'Ỏ',
- 'ố' => '�',
- 'ồ' => 'Ồ',
- 'ổ' => 'Ổ',
- 'á»—' => 'á»–',
- 'ộ' => 'Ộ',
- 'ớ' => 'Ớ',
- '�' => 'Ờ',
- 'ở' => 'Ở',
- 'ỡ' => 'Ỡ',
- 'ợ' => 'Ợ',
- 'ụ' => 'Ụ',
- 'ủ' => 'Ủ',
- 'ứ' => 'Ứ',
- 'ừ' => 'Ừ',
- 'á»' => 'Ử',
- 'ữ' => 'Ữ',
- 'á»±' => 'á»°',
- 'ỳ' => 'Ỳ',
- 'ỵ' => 'Ỵ',
- 'ỷ' => 'Ỷ',
- 'ỹ' => 'Ỹ',
- 'ỻ' => 'Ỻ',
- 'ỽ' => 'Ỽ',
- 'ỿ' => 'Ỿ',
- 'ἀ' => 'Ἀ',
- '�' => 'Ἁ',
- 'ἂ' => 'Ἂ',
- 'ἃ' => 'Ἃ',
- 'ἄ' => 'Ἄ',
- 'ἅ' => '�',
- 'ἆ' => 'Ἆ',
- 'ἇ' => '�',
- '�' => 'Ἐ',
- 'ἑ' => 'Ἑ',
- 'ἒ' => 'Ἒ',
- 'ἓ' => 'Ἓ',
- 'ἔ' => 'Ἔ',
- 'ἕ' => '�',
- 'ἠ' => 'Ἠ',
- 'ἡ' => 'Ἡ',
- 'ἢ' => 'Ἢ',
- 'ἣ' => 'Ἣ',
- 'ἤ' => 'Ἤ',
- 'á¼¥' => 'á¼',
- 'ἦ' => 'Ἦ',
- 'ἧ' => 'Ἧ',
- 'ἰ' => 'Ἰ',
- 'á¼±' => 'á¼¹',
- 'ἲ' => 'Ἲ',
- 'á¼³' => 'á¼»',
- 'á¼´' => 'á¼¼',
- 'á¼µ' => 'á¼½',
- 'ἶ' => 'Ἶ',
- 'ἷ' => 'Ἷ',
- 'ὀ' => 'Ὀ',
- '�' => 'Ὁ',
- 'ὂ' => 'Ὂ',
- 'ὃ' => 'Ὃ',
- 'ὄ' => 'Ὄ',
- 'ὅ' => '�',
- 'ὑ' => 'Ὑ',
- 'ὓ' => 'Ὓ',
- 'ὕ' => '�',
- 'ὗ' => 'Ὗ',
- 'ὠ' => 'Ὠ',
- 'ὡ' => 'Ὡ',
- 'ὢ' => 'Ὢ',
- 'ὣ' => 'Ὣ',
- 'ὤ' => 'Ὤ',
- 'á½¥' => 'á½',
- 'ὦ' => 'Ὦ',
- 'ὧ' => 'Ὧ',
- 'ὰ' => 'Ὰ',
- 'á½±' => 'á¾»',
- 'ὲ' => 'Ὲ',
- 'έ' => 'Έ',
- 'á½´' => 'á¿Š',
- 'á½µ' => 'á¿‹',
- 'ὶ' => 'Ὶ',
- 'á½·' => 'á¿›',
- 'ὸ' => 'Ὸ',
- 'ό' => 'Ό',
- 'ὺ' => 'Ὺ',
- 'á½»' => 'á¿«',
- 'ὼ' => 'Ὼ',
- 'á½½' => 'á¿»',
- 'ᾀ' => 'ἈΙ',
- '�' => 'ἉΙ',
- 'ᾂ' => 'ἊΙ',
- 'ᾃ' => 'ἋΙ',
- 'ᾄ' => 'ἌΙ',
- 'ᾅ' => '�Ι',
- 'ᾆ' => 'ἎΙ',
- 'ᾇ' => '�Ι',
- '�' => 'ἨΙ',
- 'ᾑ' => 'ἩΙ',
- 'ᾒ' => 'ἪΙ',
- 'ᾓ' => 'ἫΙ',
- 'ᾔ' => 'ἬΙ',
- 'ᾕ' => 'á¼Î™',
- 'ᾖ' => 'ἮΙ',
- 'ᾗ' => 'ἯΙ',
- 'ᾠ' => 'ὨΙ',
- 'ᾡ' => 'ὩΙ',
- 'ᾢ' => 'ὪΙ',
- 'ᾣ' => 'ὫΙ',
- 'ᾤ' => 'ὬΙ',
- 'á¾¥' => 'á½Î™',
- 'ᾦ' => 'ὮΙ',
- 'ᾧ' => 'ὯΙ',
- 'ᾰ' => 'Ᾰ',
- 'á¾±' => 'á¾¹',
- 'ᾳ' => 'ΑΙ',
- 'ι' => 'Ι',
- 'ῃ' => 'ΗΙ',
- '�' => 'Ῐ',
- 'á¿‘' => 'á¿™',
- 'ῠ' => 'Ῠ',
- 'á¿¡' => 'á¿©',
- 'ῥ' => 'Ῥ',
- 'ῳ' => 'ΩΙ',
- 'ⅎ' => 'Ⅎ',
- 'â…°' => 'â… ',
- 'â…±' => 'â…¡',
- 'â…²' => 'â…¢',
- 'â…³' => 'â…£',
- 'â…´' => 'â…¤',
- 'â…µ' => 'â…¥',
- 'â…¶' => 'â…¦',
- 'â…·' => 'â…§',
- 'â…¸' => 'â…¨',
- 'â…¹' => 'â…©',
- 'â…º' => 'â…ª',
- 'â…»' => 'â…«',
- 'â…¼' => 'â…¬',
- 'â…½' => 'â…',
- 'â…¾' => 'â…®',
- 'â…¿' => 'â…¯',
- 'ↄ' => 'Ↄ',
- '�' => 'Ⓐ',
- 'â“‘' => 'â’·',
- 'â“’' => 'â’¸',
- 'â““' => 'â’¹',
- 'â“”' => 'â’º',
- 'â“•' => 'â’»',
- 'â“–' => 'â’¼',
- 'â“—' => 'â’½',
- 'ⓘ' => 'Ⓘ',
- 'â“™' => 'â’¿',
- 'â“š' => 'â“€',
- 'ⓛ' => '�',
- 'ⓜ' => 'Ⓜ',
- '�' => 'Ⓝ',
- 'â“ž' => 'â“„',
- 'â“Ÿ' => 'â“…',
- 'ⓠ' => 'Ⓠ',
- 'ⓡ' => 'Ⓡ',
- 'ⓢ' => 'Ⓢ',
- 'ⓣ' => 'Ⓣ',
- 'ⓤ' => 'Ⓤ',
- 'â“¥' => 'â“‹',
- 'ⓦ' => 'Ⓦ',
- 'ⓧ' => '�',
- 'ⓨ' => 'Ⓨ',
- 'ⓩ' => '�',
- 'â°°' => 'â°€',
- 'â°±' => 'â°�',
- 'â°²' => 'â°‚',
- 'â°³' => 'â°ƒ',
- 'â°´' => 'â°„',
- 'â°µ' => 'â°…',
- 'â°¶' => 'â°†',
- 'â°·' => 'â°‡',
- 'â°¸' => 'â°ˆ',
- 'â°¹' => 'â°‰',
- 'â°º' => 'â°Š',
- 'â°»' => 'â°‹',
- 'ⰼ' => 'Ⰼ',
- 'â°½' => 'â°�',
- 'â°¾' => 'â°Ž',
- 'â°¿' => 'â°�',
- 'â±€' => 'â°�',
- '�' => 'Ⱁ',
- 'ⱂ' => 'Ⱂ',
- 'ⱃ' => 'Ⱃ',
- 'ⱄ' => 'Ⱄ',
- 'â±…' => 'â°•',
- 'ⱆ' => 'Ⱆ',
- 'ⱇ' => 'Ⱇ',
- 'ⱈ' => 'Ⱈ',
- 'ⱉ' => 'Ⱉ',
- 'ⱊ' => 'Ⱊ',
- 'ⱋ' => 'Ⱋ',
- 'ⱌ' => 'Ⱌ',
- '�' => '�',
- 'ⱎ' => 'Ⱎ',
- '�' => 'Ⱏ',
- '�' => 'Ⱐ',
- 'ⱑ' => 'Ⱑ',
- 'â±’' => 'â°¢',
- 'ⱓ' => 'Ⱓ',
- 'â±”' => 'â°¤',
- 'ⱕ' => 'Ⱕ',
- 'â±–' => 'â°¦',
- 'â±—' => 'â°§',
- 'ⱘ' => 'Ⱘ',
- 'â±™' => 'â°©',
- 'ⱚ' => 'Ⱚ',
- 'â±›' => 'â°«',
- 'ⱜ' => 'Ⱜ',
- 'â±�' => 'â°',
- 'ⱞ' => 'Ⱞ',
- 'ⱡ' => 'Ⱡ',
- 'ⱥ' => 'Ⱥ',
- 'ⱦ' => 'Ⱦ',
- 'ⱨ' => 'Ⱨ',
- 'ⱪ' => 'Ⱪ',
- 'ⱬ' => 'Ⱬ',
- 'â±³' => 'â±²',
- 'ⱶ' => 'Ⱶ',
- '�' => 'Ⲁ',
- 'ⲃ' => 'Ⲃ',
- 'ⲅ' => 'Ⲅ',
- 'ⲇ' => 'Ⲇ',
- 'ⲉ' => 'Ⲉ',
- 'ⲋ' => 'Ⲋ',
- '�' => 'Ⲍ',
- '�' => 'Ⲏ',
- 'ⲑ' => '�',
- 'ⲓ' => 'Ⲓ',
- 'ⲕ' => 'Ⲕ',
- 'â²—' => 'â²–',
- 'ⲙ' => 'Ⲙ',
- 'ⲛ' => 'Ⲛ',
- '�' => 'Ⲝ',
- 'ⲟ' => 'Ⲟ',
- 'ⲡ' => 'Ⲡ',
- 'â²£' => 'â²¢',
- 'ⲥ' => 'Ⲥ',
- 'ⲧ' => 'Ⲧ',
- 'ⲩ' => 'Ⲩ',
- 'ⲫ' => 'Ⲫ',
- 'â²' => 'Ⲭ',
- 'ⲯ' => 'Ⲯ',
- 'â²±' => 'â²°',
- 'â²³' => 'â²²',
- 'â²µ' => 'â²´',
- 'ⲷ' => 'Ⲷ',
- 'ⲹ' => 'Ⲹ',
- 'ⲻ' => 'Ⲻ',
- 'â²½' => 'â²¼',
- 'ⲿ' => 'Ⲿ',
- '�' => 'Ⳁ',
- 'ⳃ' => 'Ⳃ',
- 'ⳅ' => 'Ⳅ',
- 'ⳇ' => 'Ⳇ',
- 'ⳉ' => 'Ⳉ',
- 'ⳋ' => 'Ⳋ',
- '�' => 'Ⳍ',
- '�' => 'Ⳏ',
- 'ⳑ' => '�',
- 'ⳓ' => 'Ⳓ',
- 'ⳕ' => 'Ⳕ',
- 'â³—' => 'â³–',
- 'ⳙ' => 'Ⳙ',
- 'ⳛ' => 'Ⳛ',
- '�' => 'Ⳝ',
- 'ⳟ' => 'Ⳟ',
- 'ⳡ' => 'Ⳡ',
- 'â³£' => 'â³¢',
- 'ⳬ' => 'Ⳬ',
- 'â³®' => 'â³',
- 'â³³' => 'â³²',
- 'â´€' => 'á‚ ',
- 'â´�' => 'á‚¡',
- 'â´‚' => 'á‚¢',
- 'â´ƒ' => 'á‚£',
- 'ⴄ' => 'Ⴄ',
- 'â´…' => 'á‚¥',
- 'ⴆ' => 'Ⴆ',
- 'ⴇ' => 'Ⴇ',
- 'ⴈ' => 'Ⴈ',
- 'â´‰' => 'á‚©',
- 'ⴊ' => 'Ⴊ',
- 'â´‹' => 'á‚«',
- 'ⴌ' => 'Ⴌ',
- 'â´�' => 'á‚',
- 'â´Ž' => 'á‚®',
- '�' => 'Ⴏ',
- 'â´�' => 'á‚°',
- 'ⴑ' => 'Ⴑ',
- 'ⴒ' => 'Ⴒ',
- 'ⴓ' => 'Ⴓ',
- 'â´”' => 'á‚´',
- 'ⴕ' => 'Ⴕ',
- 'ⴖ' => 'Ⴖ',
- 'â´—' => 'á‚·',
- 'ⴘ' => 'Ⴘ',
- 'ⴙ' => 'Ⴙ',
- 'ⴚ' => 'Ⴚ',
- 'â´›' => 'á‚»',
- 'ⴜ' => 'Ⴜ',
- '�' => 'Ⴝ',
- 'ⴞ' => 'Ⴞ',
- 'â´Ÿ' => 'á‚¿',
- 'ⴠ' => 'Ⴠ',
- 'ⴡ' => '�',
- 'ⴢ' => 'Ⴢ',
- 'ⴣ' => 'Ⴣ',
- 'ⴤ' => 'Ⴤ',
- 'ⴥ' => 'Ⴥ',
- 'ⴧ' => 'Ⴧ',
- 'â´' => 'áƒ�',
- '�' => 'Ꙁ',
- 'ꙃ' => 'Ꙃ',
- 'ꙅ' => 'Ꙅ',
- 'ꙇ' => 'Ꙇ',
- 'ꙉ' => 'Ꙉ',
- 'ꙋ' => 'Ꙋ',
- '�' => 'Ꙍ',
- '�' => 'Ꙏ',
- 'ꙑ' => '�',
- 'ꙓ' => 'Ꙓ',
- 'ꙕ' => 'Ꙕ',
- 'ê™—' => 'ê™–',
- 'ꙙ' => 'Ꙙ',
- 'ꙛ' => 'Ꙛ',
- '�' => 'Ꙝ',
- 'ꙟ' => 'Ꙟ',
- 'ꙡ' => 'ê™ ',
- 'ꙣ' => 'Ꙣ',
- 'ꙥ' => 'Ꙥ',
- 'ꙧ' => 'Ꙧ',
- 'ꙩ' => 'Ꙩ',
- 'ꙫ' => 'Ꙫ',
- 'ê™' => 'Ꙭ',
- '�' => 'Ꚁ',
- 'ꚃ' => 'Ꚃ',
- 'êš…' => 'êš„',
- 'ꚇ' => 'Ꚇ',
- 'ꚉ' => 'Ꚉ',
- 'ꚋ' => 'Ꚋ',
- '�' => 'Ꚍ',
- '�' => 'Ꚏ',
- 'ꚑ' => '�',
- 'êš“' => 'êš’',
- 'êš•' => 'êš”',
- 'êš—' => 'êš–',
- 'ꚙ' => 'Ꚙ',
- 'êš›' => 'êšš',
- 'ꜣ' => 'Ꜣ',
- 'ꜥ' => 'Ꜥ',
- 'ꜧ' => 'Ꜧ',
- 'ꜩ' => 'Ꜩ',
- 'ꜫ' => 'Ꜫ',
- 'êœ' => 'Ꜭ',
- 'ꜯ' => 'Ꜯ',
- 'ꜳ' => 'Ꜳ',
- 'ꜵ' => 'Ꜵ',
- 'ꜷ' => 'Ꜷ',
- 'ꜹ' => 'Ꜹ',
- 'ꜻ' => 'Ꜻ',
- 'ꜽ' => 'Ꜽ',
- 'ꜿ' => 'Ꜿ',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- 'ê�¡' => 'ê� ',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- 'ê�' => 'ê�¬',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => 'Ꞁ',
- 'ꞃ' => 'Ꞃ',
- 'êž…' => 'êž„',
- 'ꞇ' => 'Ꞇ',
- 'ꞌ' => 'Ꞌ',
- 'ꞑ' => '�',
- 'êž“' => 'êž’',
- 'ꞔ' => 'Ꞔ',
- 'êž—' => 'êž–',
- 'ꞙ' => 'Ꞙ',
- 'êž›' => 'êžš',
- '�' => 'Ꞝ',
- 'ꞟ' => 'Ꞟ',
- 'êž¡' => 'êž ',
- 'ꞣ' => 'Ꞣ',
- 'ꞥ' => 'Ꞥ',
- 'ꞧ' => 'Ꞧ',
- 'ꞩ' => 'Ꞩ',
- 'êžµ' => 'êž´',
- 'ꞷ' => 'Ꞷ',
- 'ꞹ' => 'Ꞹ',
- 'ꞻ' => 'Ꞻ',
- 'êž½' => 'êž¼',
- 'êž¿' => 'êž¾',
- 'ꟃ' => 'Ꟃ',
- 'ꟈ' => 'Ꟈ',
- 'ꟊ' => 'Ꟊ',
- 'ꟶ' => 'Ꟶ',
- 'ê“' => 'êž³',
- 'ê°' => 'Ꭰ',
- 'ê±' => 'Ꭱ',
- 'ê²' => 'Ꭲ',
- 'ê³' => 'Ꭳ',
- 'ê´' => 'Ꭴ',
- 'êµ' => 'Ꭵ',
- 'ê¶' => 'Ꭶ',
- 'ê·' => 'Ꭷ',
- 'ê¸' => 'Ꭸ',
- 'ê¹' => 'Ꭹ',
- 'êº' => 'Ꭺ',
- 'ê»' => 'Ꭻ',
- 'ê¼' => 'Ꭼ',
- 'ê½' => 'áŽ',
- 'ê¾' => 'Ꭾ',
- 'ê¿' => 'Ꭿ',
- 'ꮀ' => 'Ꮀ',
- '�' => 'Ꮁ',
- 'ꮂ' => 'Ꮂ',
- 'ꮃ' => 'Ꮃ',
- 'ꮄ' => 'Ꮄ',
- 'ꮅ' => 'Ꮅ',
- 'ꮆ' => 'Ꮆ',
- 'ꮇ' => 'Ꮇ',
- 'ꮈ' => 'Ꮈ',
- 'ꮉ' => 'Ꮉ',
- 'ꮊ' => 'Ꮊ',
- 'ꮋ' => 'Ꮋ',
- 'ꮌ' => 'Ꮌ',
- '�' => 'Ꮍ',
- 'ꮎ' => 'Ꮎ',
- '�' => 'Ꮏ',
- '�' => '�',
- 'ꮑ' => '�',
- 'ꮒ' => '�',
- 'ꮓ' => '�',
- 'ꮔ' => '�',
- 'ꮕ' => '�',
- 'ꮖ' => '�',
- 'ꮗ' => '�',
- 'ꮘ' => '�',
- 'ꮙ' => '�',
- 'ꮚ' => '�',
- 'ꮛ' => '�',
- 'ꮜ' => '�',
- '�' => '�',
- 'ꮞ' => '�',
- 'ꮟ' => '�',
- 'ê® ' => 'á��',
- 'ꮡ' => '�',
- 'ꮢ' => '�',
- 'ꮣ' => '�',
- 'ꮤ' => '�',
- 'ꮥ' => '�',
- 'ꮦ' => '�',
- 'ꮧ' => '�',
- 'ꮨ' => '�',
- 'ꮩ' => '�',
- 'ꮪ' => '�',
- 'ꮫ' => '�',
- 'ꮬ' => '�',
- 'ê®' => 'á��',
- 'ꮮ' => '�',
- 'ꮯ' => '�',
- 'ê®°' => 'á� ',
- 'ꮱ' => '�',
- 'ꮲ' => '�',
- 'ꮳ' => '�',
- 'ꮴ' => '�',
- 'ꮵ' => '�',
- 'ꮶ' => '�',
- 'ꮷ' => '�',
- 'ꮸ' => '�',
- 'ꮹ' => '�',
- 'ꮺ' => '�',
- 'ꮻ' => '�',
- 'ꮼ' => '�',
- 'ꮽ' => 'á�',
- 'ꮾ' => '�',
- 'ꮿ' => '�',
- '�' => 'A',
- 'b' => 'B',
- 'c' => 'C',
- 'd' => 'D',
- 'ï½…' => 'ï¼¥',
- 'f' => 'F',
- 'g' => 'G',
- 'h' => 'H',
- 'i' => 'I',
- 'j' => 'J',
- 'k' => 'K',
- 'l' => 'L',
- 'ï½�' => 'ï¼',
- 'n' => 'N',
- '�' => 'O',
- '�' => 'P',
- 'q' => 'Q',
- 'ï½’' => 'ï¼²',
- 's' => 'S',
- 'ï½”' => 'ï¼´',
- 'u' => 'U',
- 'v' => 'V',
- 'ï½—' => 'ï¼·',
- 'x' => 'X',
- 'ï½™' => 'ï¼¹',
- 'z' => 'Z',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- 'ð��' => 'ð��…',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- 'ð�‘ˆ' => 'ð�� ',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- 'ð�“ ' => 'ð�’¸',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- 'ð�“' => 'ð�“…',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- 'ð�³ ' => 'ð�² ',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- 'ð�³' => 'ð�²',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- '�' => '�',
- 'ð‘£€' => 'ð‘¢ ',
- '�' => '𑢡',
- '𑣂' => '𑢢',
- '𑣃' => '𑢣',
- '𑣄' => '𑢤',
- 'ð‘£…' => 'ð‘¢¥',
- '𑣆' => '𑢦',
- '𑣇' => '𑢧',
- '𑣈' => '𑢨',
- '𑣉' => '𑢩',
- '𑣊' => '𑢪',
- '𑣋' => '𑢫',
- '𑣌' => '𑢬',
- 'ð‘£�' => 'ð‘¢',
- '𑣎' => '𑢮',
- '�' => '𑢯',
- '�' => '𑢰',
- '𑣑' => '𑢱',
- 'ð‘£’' => 'ð‘¢²',
- '𑣓' => '𑢳',
- 'ð‘£”' => 'ð‘¢´',
- '𑣕' => '𑢵',
- '𑣖' => '𑢶',
- 'ð‘£—' => 'ð‘¢·',
- '𑣘' => '𑢸',
- 'ð‘£™' => 'ð‘¢¹',
- '𑣚' => '𑢺',
- 'ð‘£›' => 'ð‘¢»',
- '𑣜' => '𑢼',
- '�' => '𑢽',
- '𑣞' => '𑢾',
- '𑣟' => '𑢿',
- 'ð–¹ ' => 'ð–¹€',
- '𖹡' => '�',
- '𖹢' => '𖹂',
- '𖹣' => '𖹃',
- '𖹤' => '𖹄',
- 'ð–¹¥' => 'ð–¹…',
- '𖹦' => '𖹆',
- '𖹧' => '𖹇',
- '𖹨' => '𖹈',
- '𖹩' => '𖹉',
- '𖹪' => '𖹊',
- '𖹫' => '𖹋',
- '𖹬' => '𖹌',
- 'ð–¹' => 'ð–¹�',
- '𖹮' => '𖹎',
- '𖹯' => '�',
- '𖹰' => '�',
- '𖹱' => '𖹑',
- 'ð–¹²' => 'ð–¹’',
- '𖹳' => '𖹓',
- 'ð–¹´' => 'ð–¹”',
- '𖹵' => '𖹕',
- '𖹶' => '𖹖',
- 'ð–¹·' => 'ð–¹—',
- '𖹸' => '𖹘',
- 'ð–¹¹' => 'ð–¹™',
- '𖹺' => '𖹚',
- 'ð–¹»' => 'ð–¹›',
- '𖹼' => '𖹜',
- '𖹽' => '�',
- '𖹾' => '𖹞',
- '𖹿' => '𖹟',
- '𞤢' => '𞤀',
- '𞤣' => '�',
- '𞤤' => '𞤂',
- '𞤥' => '𞤃',
- '𞤦' => '𞤄',
- '𞤧' => '𞤅',
- '𞤨' => '𞤆',
- '𞤩' => '𞤇',
- '𞤪' => '𞤈',
- '𞤫' => '𞤉',
- '𞤬' => '𞤊',
- 'ðž¤' => '𞤋',
- '𞤮' => '𞤌',
- '𞤯' => '�',
- '𞤰' => '𞤎',
- '𞤱' => '�',
- '𞤲' => '�',
- '𞤳' => '𞤑',
- '𞤴' => '𞤒',
- '𞤵' => '𞤓',
- '𞤶' => '𞤔',
- '𞤷' => '𞤕',
- '𞤸' => '𞤖',
- '𞤹' => '𞤗',
- '𞤺' => '𞤘',
- '𞤻' => '𞤙',
- '𞤼' => '𞤚',
- '𞤽' => '𞤛',
- '𞤾' => '𞤜',
- '𞤿' => '�',
- '𞥀' => '𞤞',
- '�' => '𞤟',
- '𞥂' => '𞤠',
- '𞥃' => '𞤡',
- 'ß' => 'SS',
- 'ff' => 'FF',
- '�' => 'FI',
- 'fl' => 'FL',
- 'ffi' => 'FFI',
- 'ffl' => 'FFL',
- 'ſt' => 'ST',
- 'st' => 'ST',
- 'Ö‡' => 'ÔµÕ’',
- 'ﬓ' => 'ՄՆ',
- 'ﬔ' => 'ՄԵ',
- 'ﬕ' => 'ՄԻ',
- 'ﬖ' => 'ՎՆ',
- 'ﬗ' => 'ՄԽ',
- 'ʼn' => 'ʼN',
- '�' => 'Ϊ�',
- 'ΰ' => 'Ϋ�',
- 'ǰ' => 'J̌',
- 'ẖ' => 'H̱',
- 'ẗ' => 'T̈',
- 'ẘ' => 'W̊',
- 'ẙ' => 'Y̊',
- 'ẚ' => 'Aʾ',
- '�' => 'Υ̓',
- 'ὒ' => 'Υ̓̀',
- 'ὔ' => 'Υ̓�',
- 'ὖ' => 'Υ̓͂',
- 'ᾶ' => 'Α͂',
- 'ῆ' => 'Η͂',
- 'ῒ' => 'Ϊ̀',
- 'ΐ' => 'Ϊ�',
- 'ῖ' => 'Ι͂',
- 'ῗ' => 'Ϊ͂',
- 'ῢ' => 'Ϋ̀',
- 'ΰ' => 'Ϋ�',
- 'ῤ' => 'Ρ̓',
- 'ῦ' => 'Υ͂',
- 'ῧ' => 'Ϋ͂',
- 'ῶ' => 'Ω͂',
- 'ᾈ' => 'ἈΙ',
- 'ᾉ' => 'ἉΙ',
- 'ᾊ' => 'ἊΙ',
- 'ᾋ' => 'ἋΙ',
- 'ᾌ' => 'ἌΙ',
- '�' => '�Ι',
- 'ᾎ' => 'ἎΙ',
- '�' => '�Ι',
- 'ᾘ' => 'ἨΙ',
- 'ᾙ' => 'ἩΙ',
- 'ᾚ' => 'ἪΙ',
- 'ᾛ' => 'ἫΙ',
- 'ᾜ' => 'ἬΙ',
- 'á¾�' => 'á¼Î™',
- 'ᾞ' => 'ἮΙ',
- 'ᾟ' => 'ἯΙ',
- 'ᾨ' => 'ὨΙ',
- 'ᾩ' => 'ὩΙ',
- 'ᾪ' => 'ὪΙ',
- 'ᾫ' => 'ὫΙ',
- 'ᾬ' => 'ὬΙ',
- 'á¾' => 'á½Î™',
- 'ᾮ' => 'ὮΙ',
- 'ᾯ' => 'ὯΙ',
- 'ᾼ' => 'ΑΙ',
- 'ῌ' => 'ΗΙ',
- 'ῼ' => 'ΩΙ',
- 'ᾲ' => 'ᾺΙ',
- 'ᾴ' => 'ΆΙ',
- 'ῂ' => 'ῊΙ',
- 'ῄ' => 'ΉΙ',
- 'ῲ' => 'ῺΙ',
- 'ῴ' => '�Ι',
- 'ᾷ' => 'Α͂Ι',
- 'ῇ' => 'Η͂Ι',
- 'ῷ' => 'Ω͂Ι',
- );
- <?php
- use Symfony\Polyfill\Mbstring as p;
- if (\PHP_VERSION_ID >= 80000) {
- return require __DIR__.'/bootstrap80.php';
- }
- if (!function_exists('mb_convert_encoding')) {
- function mb_convert_encoding($string, $to_encoding, $from_encoding = null) { return p\Mbstring::mb_convert_encoding($string, $to_encoding, $from_encoding); }
- }
- if (!function_exists('mb_decode_mimeheader')) {
- function mb_decode_mimeheader($string) { return p\Mbstring::mb_decode_mimeheader($string); }
- }
- if (!function_exists('mb_encode_mimeheader')) {
- 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); }
- }
- if (!function_exists('mb_decode_numericentity')) {
- function mb_decode_numericentity($string, $map, $encoding = null) { return p\Mbstring::mb_decode_numericentity($string, $map, $encoding); }
- }
- if (!function_exists('mb_encode_numericentity')) {
- function mb_encode_numericentity($string, $map, $encoding = null, $hex = false) { return p\Mbstring::mb_encode_numericentity($string, $map, $encoding, $hex); }
- }
- if (!function_exists('mb_convert_case')) {
- function mb_convert_case($string, $mode, $encoding = null) { return p\Mbstring::mb_convert_case($string, $mode, $encoding); }
- }
- if (!function_exists('mb_internal_encoding')) {
- function mb_internal_encoding($encoding = null) { return p\Mbstring::mb_internal_encoding($encoding); }
- }
- if (!function_exists('mb_language')) {
- function mb_language($language = null) { return p\Mbstring::mb_language($language); }
- }
- if (!function_exists('mb_list_encodings')) {
- function mb_list_encodings() { return p\Mbstring::mb_list_encodings(); }
- }
- if (!function_exists('mb_encoding_aliases')) {
- function mb_encoding_aliases($encoding) { return p\Mbstring::mb_encoding_aliases($encoding); }
- }
- if (!function_exists('mb_check_encoding')) {
- function mb_check_encoding($value = null, $encoding = null) { return p\Mbstring::mb_check_encoding($value, $encoding); }
- }
- if (!function_exists('mb_detect_encoding')) {
- function mb_detect_encoding($string, $encodings = null, $strict = false) { return p\Mbstring::mb_detect_encoding($string, $encodings, $strict); }
- }
- if (!function_exists('mb_detect_order')) {
- function mb_detect_order($encoding = null) { return p\Mbstring::mb_detect_order($encoding); }
- }
- if (!function_exists('mb_parse_str')) {
- function mb_parse_str($string, &$result = []) { parse_str($string, $result); return (bool) $result; }
- }
- if (!function_exists('mb_strlen')) {
- function mb_strlen($string, $encoding = null) { return p\Mbstring::mb_strlen($string, $encoding); }
- }
- if (!function_exists('mb_strpos')) {
- function mb_strpos($haystack, $needle, $offset = 0, $encoding = null) { return p\Mbstring::mb_strpos($haystack, $needle, $offset, $encoding); }
- }
- if (!function_exists('mb_strtolower')) {
- function mb_strtolower($string, $encoding = null) { return p\Mbstring::mb_strtolower($string, $encoding); }
- }
- if (!function_exists('mb_strtoupper')) {
- function mb_strtoupper($string, $encoding = null) { return p\Mbstring::mb_strtoupper($string, $encoding); }
- }
- if (!function_exists('mb_substitute_character')) {
- function mb_substitute_character($substitute_character = null) { return p\Mbstring::mb_substitute_character($substitute_character); }
- }
- if (!function_exists('mb_substr')) {
- function mb_substr($string, $start, $length = 2147483647, $encoding = null) { return p\Mbstring::mb_substr($string, $start, $length, $encoding); }
- }
- if (!function_exists('mb_stripos')) {
- function mb_stripos($haystack, $needle, $offset = 0, $encoding = null) { return p\Mbstring::mb_stripos($haystack, $needle, $offset, $encoding); }
- }
- if (!function_exists('mb_stristr')) {
- function mb_stristr($haystack, $needle, $before_needle = false, $encoding = null) { return p\Mbstring::mb_stristr($haystack, $needle, $before_needle, $encoding); }
- }
- if (!function_exists('mb_strrchr')) {
- function mb_strrchr($haystack, $needle, $before_needle = false, $encoding = null) { return p\Mbstring::mb_strrchr($haystack, $needle, $before_needle, $encoding); }
- }
- if (!function_exists('mb_strrichr')) {
- function mb_strrichr($haystack, $needle, $before_needle = false, $encoding = null) { return p\Mbstring::mb_strrichr($haystack, $needle, $before_needle, $encoding); }
- }
- if (!function_exists('mb_strripos')) {
- function mb_strripos($haystack, $needle, $offset = 0, $encoding = null) { return p\Mbstring::mb_strripos($haystack, $needle, $offset, $encoding); }
- }
- if (!function_exists('mb_strrpos')) {
- function mb_strrpos($haystack, $needle, $offset = 0, $encoding = null) { return p\Mbstring::mb_strrpos($haystack, $needle, $offset, $encoding); }
- }
- if (!function_exists('mb_strstr')) {
- function mb_strstr($haystack, $needle, $before_needle = false, $encoding = null) { return p\Mbstring::mb_strstr($haystack, $needle, $before_needle, $encoding); }
- }
- if (!function_exists('mb_get_info')) {
- function mb_get_info($type = 'all') { return p\Mbstring::mb_get_info($type); }
- }
- if (!function_exists('mb_http_output')) {
- function mb_http_output($encoding = null) { return p\Mbstring::mb_http_output($encoding); }
- }
- if (!function_exists('mb_strwidth')) {
- function mb_strwidth($string, $encoding = null) { return p\Mbstring::mb_strwidth($string, $encoding); }
- }
- if (!function_exists('mb_substr_count')) {
- function mb_substr_count($haystack, $needle, $encoding = null) { return p\Mbstring::mb_substr_count($haystack, $needle, $encoding); }
- }
- if (!function_exists('mb_output_handler')) {
- function mb_output_handler($string, $status) { return p\Mbstring::mb_output_handler($string, $status); }
- }
- if (!function_exists('mb_http_input')) {
- function mb_http_input($type = null) { return p\Mbstring::mb_http_input($type); }
- }
- if (!function_exists('mb_convert_variables')) {
- function mb_convert_variables($to_encoding, $from_encoding, &...$vars) { return p\Mbstring::mb_convert_variables($to_encoding, $from_encoding, ...$vars); }
- }
- if (!function_exists('mb_ord')) {
- function mb_ord($string, $encoding = null) { return p\Mbstring::mb_ord($string, $encoding); }
- }
- if (!function_exists('mb_chr')) {
- function mb_chr($codepoint, $encoding = null) { return p\Mbstring::mb_chr($codepoint, $encoding); }
- }
- if (!function_exists('mb_scrub')) {
- function mb_scrub($string, $encoding = null) { $encoding = null === $encoding ? mb_internal_encoding() : $encoding; return mb_convert_encoding($string, $encoding, $encoding); }
- }
- if (!function_exists('mb_str_split')) {
- function mb_str_split($string, $length = 1, $encoding = null) { return p\Mbstring::mb_str_split($string, $length, $encoding); }
- }
- if (extension_loaded('mbstring')) {
- return;
- }
- if (!defined('MB_CASE_UPPER')) {
- define('MB_CASE_UPPER', 0);
- }
- if (!defined('MB_CASE_LOWER')) {
- define('MB_CASE_LOWER', 1);
- }
- if (!defined('MB_CASE_TITLE')) {
- define('MB_CASE_TITLE', 2);
- }
- <?php
- use Symfony\Polyfill\Mbstring as p;
- if (!function_exists('mb_convert_encoding')) {
- 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); }
- }
- if (!function_exists('mb_decode_mimeheader')) {
- function mb_decode_mimeheader(?string $string): string { return p\Mbstring::mb_decode_mimeheader((string) $string); }
- }
- if (!function_exists('mb_encode_mimeheader')) {
- 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); }
- }
- if (!function_exists('mb_decode_numericentity')) {
- function mb_decode_numericentity(?string $string, array $map, ?string $encoding = null): string { return p\Mbstring::mb_decode_numericentity((string) $string, $map, $encoding); }
- }
- if (!function_exists('mb_encode_numericentity')) {
- 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); }
- }
- if (!function_exists('mb_convert_case')) {
- function mb_convert_case(?string $string, ?int $mode, ?string $encoding = null): string { return p\Mbstring::mb_convert_case((string) $string, (int) $mode, $encoding); }
- }
- if (!function_exists('mb_internal_encoding')) {
- function mb_internal_encoding(?string $encoding = null): string|bool { return p\Mbstring::mb_internal_encoding($encoding); }
- }
- if (!function_exists('mb_language')) {
- function mb_language(?string $language = null): string|bool { return p\Mbstring::mb_language($language); }
- }
- if (!function_exists('mb_list_encodings')) {
- function mb_list_encodings(): array { return p\Mbstring::mb_list_encodings(); }
- }
- if (!function_exists('mb_encoding_aliases')) {
- function mb_encoding_aliases(?string $encoding): array { return p\Mbstring::mb_encoding_aliases((string) $encoding); }
- }
- if (!function_exists('mb_check_encoding')) {
- function mb_check_encoding(array|string|null $value = null, ?string $encoding = null): bool { return p\Mbstring::mb_check_encoding($value, $encoding); }
- }
- if (!function_exists('mb_detect_encoding')) {
- 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); }
- }
- if (!function_exists('mb_detect_order')) {
- function mb_detect_order(array|string|null $encoding = null): array|bool { return p\Mbstring::mb_detect_order($encoding); }
- }
- if (!function_exists('mb_parse_str')) {
- function mb_parse_str(?string $string, &$result = []): bool { parse_str((string) $string, $result); return (bool) $result; }
- }
- if (!function_exists('mb_strlen')) {
- function mb_strlen(?string $string, ?string $encoding = null): int { return p\Mbstring::mb_strlen((string) $string, $encoding); }
- }
- if (!function_exists('mb_strpos')) {
- 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); }
- }
- if (!function_exists('mb_strtolower')) {
- function mb_strtolower(?string $string, ?string $encoding = null): string { return p\Mbstring::mb_strtolower((string) $string, $encoding); }
- }
- if (!function_exists('mb_strtoupper')) {
- function mb_strtoupper(?string $string, ?string $encoding = null): string { return p\Mbstring::mb_strtoupper((string) $string, $encoding); }
- }
- if (!function_exists('mb_substitute_character')) {
- function mb_substitute_character(string|int|null $substitute_character = null): string|int|bool { return p\Mbstring::mb_substitute_character($substitute_character); }
- }
- if (!function_exists('mb_substr')) {
- 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); }
- }
- if (!function_exists('mb_stripos')) {
- 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); }
- }
- if (!function_exists('mb_stristr')) {
- 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); }
- }
- if (!function_exists('mb_strrchr')) {
- 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); }
- }
- if (!function_exists('mb_strrichr')) {
- 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); }
- }
- if (!function_exists('mb_strripos')) {
- 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); }
- }
- if (!function_exists('mb_strrpos')) {
- 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); }
- }
- if (!function_exists('mb_strstr')) {
- 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); }
- }
- if (!function_exists('mb_get_info')) {
- function mb_get_info(?string $type = 'all'): array|string|int|false { return p\Mbstring::mb_get_info((string) $type); }
- }
- if (!function_exists('mb_http_output')) {
- function mb_http_output(?string $encoding = null): string|bool { return p\Mbstring::mb_http_output($encoding); }
- }
- if (!function_exists('mb_strwidth')) {
- function mb_strwidth(?string $string, ?string $encoding = null): int { return p\Mbstring::mb_strwidth((string) $string, $encoding); }
- }
- if (!function_exists('mb_substr_count')) {
- function mb_substr_count(?string $haystack, ?string $needle, ?string $encoding = null): int { return p\Mbstring::mb_substr_count((string) $haystack, (string) $needle, $encoding); }
- }
- if (!function_exists('mb_output_handler')) {
- function mb_output_handler(?string $string, ?int $status): string { return p\Mbstring::mb_output_handler((string) $string, (int) $status); }
- }
- if (!function_exists('mb_http_input')) {
- function mb_http_input(?string $type = null): array|string|false { return p\Mbstring::mb_http_input($type); }
- }
- if (!function_exists('mb_convert_variables')) {
- 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); }
- }
- if (!function_exists('mb_ord')) {
- function mb_ord(?string $string, ?string $encoding = null): int|false { return p\Mbstring::mb_ord((string) $string, $encoding); }
- }
- if (!function_exists('mb_chr')) {
- function mb_chr(?int $codepoint, ?string $encoding = null): string|false { return p\Mbstring::mb_chr((int) $codepoint, $encoding); }
- }
- if (!function_exists('mb_scrub')) {
- function mb_scrub(?string $string, ?string $encoding = null): string { $encoding ??= mb_internal_encoding(); return mb_convert_encoding((string) $string, $encoding, $encoding); }
- }
- if (!function_exists('mb_str_split')) {
- function mb_str_split(?string $string, ?int $length = 1, ?string $encoding = null): array { return p\Mbstring::mb_str_split((string) $string, (int) $length, $encoding); }
- }
- if (extension_loaded('mbstring')) {
- return;
- }
- if (!defined('MB_CASE_UPPER')) {
- define('MB_CASE_UPPER', 0);
- }
- if (!defined('MB_CASE_LOWER')) {
- define('MB_CASE_LOWER', 1);
- }
- if (!defined('MB_CASE_TITLE')) {
- define('MB_CASE_TITLE', 2);
- }
- Copyright (c) 2018-2019 Fabien Potencier
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is furnished
- to do so, subject to the following conditions:
- The above copyright notice and this permission notice shall be included in all
- copies or substantial portions of the Software.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
- <?php
- namespace Symfony\Polyfill\Php73;
- final class Php73
- {
- public static $startAt = 1533462603;
- public static function hrtime($asNum = false)
- {
- $ns = microtime(false);
- $s = substr($ns, 11) - self::$startAt;
- $ns = 1E9 * (float) $ns;
- if ($asNum) {
- $ns += $s * 1E9;
- return \PHP_INT_SIZE === 4 ? $ns : (int) $ns;
- }
- return [$s, (int) $ns];
- }
- }
- <?php
- if (\PHP_VERSION_ID < 70300) {
- class JsonException extends Exception
- {
- }
- }
- <?php
- use Symfony\Polyfill\Php73 as p;
- if (\PHP_VERSION_ID >= 70300) {
- return;
- }
- if (!function_exists('is_countable')) {
- function is_countable($value) { return is_array($value) || $value instanceof Countable || $value instanceof ResourceBundle || $value instanceof SimpleXmlElement; }
- }
- if (!function_exists('hrtime')) {
- require_once __DIR__.'/Php73.php';
- p\Php73::$startAt = (int) microtime(true);
- function hrtime($as_number = false) { return p\Php73::hrtime($as_number); }
- }
- if (!function_exists('array_key_first')) {
- function array_key_first(array $array) { foreach ($array as $key => $value) { return $key; } }
- }
- if (!function_exists('array_key_last')) {
- function array_key_last(array $array) { return key(array_slice($array, -1, 1, true)); }
- }
- Copyright (c) 2020 Fabien Potencier
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is furnished
- to do so, subject to the following conditions:
- The above copyright notice and this permission notice shall be included in all
- copies or substantial portions of the Software.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
- <?php
- namespace Symfony\Polyfill\Php80;
- final class Php80
- {
- public static function fdiv(float $dividend, float $divisor): float
- {
- return @($dividend / $divisor);
- }
- public static function get_debug_type($value): string
- {
- switch (true) {
- case null === $value: return 'null';
- case \is_bool($value): return 'bool';
- case \is_string($value): return 'string';
- case \is_array($value): return 'array';
- case \is_int($value): return 'int';
- case \is_float($value): return 'float';
- case \is_object($value): break;
- case $value instanceof \__PHP_Incomplete_Class: return '__PHP_Incomplete_Class';
- default:
- if (null === $type = @get_resource_type($value)) {
- return 'unknown';
- }
- if ('Unknown' === $type) {
- $type = 'closed';
- }
- return "resource ($type)";
- }
- $class = \get_class($value);
- if (false === strpos($class, '@')) {
- return $class;
- }
- return (get_parent_class($class) ?: key(class_implements($class)) ?: 'class').'@anonymous';
- }
- public static function get_resource_id($res): int
- {
- if (!\is_resource($res) && null === @get_resource_type($res)) {
- throw new \TypeError(sprintf('Argument 1 passed to get_resource_id() must be of the type resource, %s given', get_debug_type($res)));
- }
- return (int) $res;
- }
- public static function preg_last_error_msg(): string
- {
- switch (preg_last_error()) {
- case \PREG_INTERNAL_ERROR:
- return 'Internal error';
- case \PREG_BAD_UTF8_ERROR:
- return 'Malformed UTF-8 characters, possibly incorrectly encoded';
- case \PREG_BAD_UTF8_OFFSET_ERROR:
- return 'The offset did not correspond to the beginning of a valid UTF-8 code point';
- case \PREG_BACKTRACK_LIMIT_ERROR:
- return 'Backtrack limit exhausted';
- case \PREG_RECURSION_LIMIT_ERROR:
- return 'Recursion limit exhausted';
- case \PREG_JIT_STACKLIMIT_ERROR:
- return 'JIT stack limit exhausted';
- case \PREG_NO_ERROR:
- return 'No error';
- default:
- return 'Unknown error';
- }
- }
- public static function str_contains(string $haystack, string $needle): bool
- {
- return '' === $needle || false !== strpos($haystack, $needle);
- }
- public static function str_starts_with(string $haystack, string $needle): bool
- {
- return 0 === strncmp($haystack, $needle, \strlen($needle));
- }
- public static function str_ends_with(string $haystack, string $needle): bool
- {
- if ('' === $needle || $needle === $haystack) {
- return true;
- }
- if ('' === $haystack) {
- return false;
- }
- $needleLength = \strlen($needle);
- return $needleLength <= \strlen($haystack) && 0 === substr_compare($haystack, $needle, -$needleLength);
- }
- }
- <?php
- namespace Symfony\Polyfill\Php80;
- class PhpToken implements \Stringable
- {
- public $id;
- public $text;
- public $line;
- public $pos;
- public function __construct(int $id, string $text, int $line = -1, int $position = -1)
- {
- $this->id = $id;
- $this->text = $text;
- $this->line = $line;
- $this->pos = $position;
- }
- public function getTokenName(): ?string
- {
- if ('UNKNOWN' === $name = token_name($this->id)) {
- $name = \strlen($this->text) > 1 || \ord($this->text) < 32 ? null : $this->text;
- }
- return $name;
- }
- public function is($kind): bool
- {
- foreach ((array) $kind as $value) {
- if (\in_array($value, [$this->id, $this->text], true)) {
- return true;
- }
- }
- return false;
- }
- public function isIgnorable(): bool
- {
- return \in_array($this->id, [\T_WHITESPACE, \T_COMMENT, \T_DOC_COMMENT, \T_OPEN_TAG], true);
- }
- public function __toString(): string
- {
- return (string) $this->text;
- }
- public static function tokenize(string $code, int $flags = 0): array
- {
- $line = 1;
- $position = 0;
- $tokens = token_get_all($code, $flags);
- foreach ($tokens as $index => $token) {
- if (\is_string($token)) {
- $id = \ord($token);
- $text = $token;
- } else {
- [$id, $text, $line] = $token;
- }
- $tokens[$index] = new static($id, $text, $line, $position);
- $position += \strlen($text);
- }
- return $tokens;
- }
- }
- <?php
- #[Attribute(Attribute::TARGET_CLASS)]
- final class Attribute
- {
- public const TARGET_CLASS = 1;
- public const TARGET_FUNCTION = 2;
- public const TARGET_METHOD = 4;
- public const TARGET_PROPERTY = 8;
- public const TARGET_CLASS_CONSTANT = 16;
- public const TARGET_PARAMETER = 32;
- public const TARGET_ALL = 63;
- public const IS_REPEATABLE = 64;
- public $flags;
- public function __construct(int $flags = self::TARGET_ALL)
- {
- $this->flags = $flags;
- }
- }
- <?php
- if (\PHP_VERSION_ID < 80000 && \extension_loaded('tokenizer')) {
- class PhpToken extends Symfony\Polyfill\Php80\PhpToken
- {
- }
- }
- <?php
- if (\PHP_VERSION_ID < 80000) {
- interface Stringable
- {
- public function __toString();
- }
- }
- <?php
- if (\PHP_VERSION_ID < 80000) {
- class UnhandledMatchError extends Error
- {
- }
- }
- <?php
- if (\PHP_VERSION_ID < 80000) {
- class ValueError extends Error
- {
- }
- }
- <?php
- use Symfony\Polyfill\Php80 as p;
- if (\PHP_VERSION_ID >= 80000) {
- return;
- }
- if (!defined('FILTER_VALIDATE_BOOL') && defined('FILTER_VALIDATE_BOOLEAN')) {
- define('FILTER_VALIDATE_BOOL', \FILTER_VALIDATE_BOOLEAN);
- }
- if (!function_exists('fdiv')) {
- function fdiv(float $num1, float $num2): float { return p\Php80::fdiv($num1, $num2); }
- }
- if (!function_exists('preg_last_error_msg')) {
- function preg_last_error_msg(): string { return p\Php80::preg_last_error_msg(); }
- }
- if (!function_exists('str_contains')) {
- function str_contains(?string $haystack, ?string $needle): bool { return p\Php80::str_contains($haystack ?? '', $needle ?? ''); }
- }
- if (!function_exists('str_starts_with')) {
- function str_starts_with(?string $haystack, ?string $needle): bool { return p\Php80::str_starts_with($haystack ?? '', $needle ?? ''); }
- }
- if (!function_exists('str_ends_with')) {
- function str_ends_with(?string $haystack, ?string $needle): bool { return p\Php80::str_ends_with($haystack ?? '', $needle ?? ''); }
- }
- if (!function_exists('get_debug_type')) {
- function get_debug_type($value): string { return p\Php80::get_debug_type($value); }
- }
- if (!function_exists('get_resource_id')) {
- function get_resource_id($resource): int { return p\Php80::get_resource_id($resource); }
- }
- <?php
- namespace Symfony\Component\Process\Exception;
- interface ExceptionInterface extends \Throwable
- {
- }
- <?php
- namespace Symfony\Component\Process\Exception;
- class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
- {
- }
- <?php
- namespace Symfony\Component\Process\Exception;
- class LogicException extends \LogicException implements ExceptionInterface
- {
- }
- <?php
- namespace Symfony\Component\Process\Exception;
- use Symfony\Component\Process\Process;
- class ProcessFailedException extends RuntimeException
- {
- private $process;
- public function __construct(Process $process)
- {
- if ($process->isSuccessful()) {
- throw new InvalidArgumentException('Expected a failed process, but the given process was successful.');
- }
- $error = sprintf('The command "%s" failed.'."\n\nExit Code: %s(%s)\n\nWorking directory: %s",
- $process->getCommandLine(),
- $process->getExitCode(),
- $process->getExitCodeText(),
- $process->getWorkingDirectory()
- );
- if (!$process->isOutputDisabled()) {
- $error .= sprintf("\n\nOutput:\n================\n%s\n\nError Output:\n================\n%s",
- $process->getOutput(),
- $process->getErrorOutput()
- );
- }
- parent::__construct($error);
- $this->process = $process;
- }
- public function getProcess()
- {
- return $this->process;
- }
- }
- <?php
- namespace Symfony\Component\Process\Exception;
- use Symfony\Component\Process\Process;
- final class ProcessSignaledException extends RuntimeException
- {
- private $process;
- public function __construct(Process $process)
- {
- $this->process = $process;
- parent::__construct(sprintf('The process has been signaled with signal "%s".', $process->getTermSignal()));
- }
- public function getProcess(): Process
- {
- return $this->process;
- }
- public function getSignal(): int
- {
- return $this->getProcess()->getTermSignal();
- }
- }
- <?php
- namespace Symfony\Component\Process\Exception;
- use Symfony\Component\Process\Process;
- class ProcessTimedOutException extends RuntimeException
- {
- public const TYPE_GENERAL = 1;
- public const TYPE_IDLE = 2;
- private $process;
- private $timeoutType;
- public function __construct(Process $process, int $timeoutType)
- {
- $this->process = $process;
- $this->timeoutType = $timeoutType;
- parent::__construct(sprintf(
- 'The process "%s" exceeded the timeout of %s seconds.',
- $process->getCommandLine(),
- $this->getExceededTimeout()
- ));
- }
- public function getProcess()
- {
- return $this->process;
- }
- public function isGeneralTimeout()
- {
- return self::TYPE_GENERAL === $this->timeoutType;
- }
- public function isIdleTimeout()
- {
- return self::TYPE_IDLE === $this->timeoutType;
- }
- public function getExceededTimeout()
- {
- switch ($this->timeoutType) {
- case self::TYPE_GENERAL:
- return $this->process->getTimeout();
- case self::TYPE_IDLE:
- return $this->process->getIdleTimeout();
- default:
- throw new \LogicException(sprintf('Unknown timeout type "%d".', $this->timeoutType));
- }
- }
- }
- <?php
- namespace Symfony\Component\Process\Exception;
- class RuntimeException extends \RuntimeException implements ExceptionInterface
- {
- }
- <?php
- namespace Symfony\Component\Process;
- class ExecutableFinder
- {
- private $suffixes = ['.exe', '.bat', '.cmd', '.com'];
- public function setSuffixes(array $suffixes)
- {
- $this->suffixes = $suffixes;
- }
- public function addSuffix(string $suffix)
- {
- $this->suffixes[] = $suffix;
- }
- public function find(string $name, string $default = null, array $extraDirs = [])
- {
- if (\ini_get('open_basedir')) {
- $searchPath = array_merge(explode(\PATH_SEPARATOR, \ini_get('open_basedir')), $extraDirs);
- $dirs = [];
- foreach ($searchPath as $path) {
- if (@is_dir($path)) {
- $dirs[] = $path;
- } else {
- if (basename($path) == $name && @is_executable($path)) {
- return $path;
- }
- }
- }
- } else {
- $dirs = array_merge(
- explode(\PATH_SEPARATOR, getenv('PATH') ?: getenv('Path')),
- $extraDirs
- );
- }
- $suffixes = [''];
- if ('\\' === \DIRECTORY_SEPARATOR) {
- $pathExt = getenv('PATHEXT');
- $suffixes = array_merge($pathExt ? explode(\PATH_SEPARATOR, $pathExt) : $this->suffixes, $suffixes);
- }
- foreach ($suffixes as $suffix) {
- foreach ($dirs as $dir) {
- if (@is_file($file = $dir.\DIRECTORY_SEPARATOR.$name.$suffix) && ('\\' === \DIRECTORY_SEPARATOR || @is_executable($file))) {
- return $file;
- }
- }
- }
- return $default;
- }
- }
- <?php
- namespace Symfony\Component\Process;
- use Symfony\Component\Process\Exception\RuntimeException;
- class InputStream implements \IteratorAggregate
- {
- private $onEmpty = null;
- private $input = [];
- private $open = true;
- public function onEmpty(callable $onEmpty = null)
- {
- $this->onEmpty = $onEmpty;
- }
- public function write($input)
- {
- if (null === $input) {
- return;
- }
- if ($this->isClosed()) {
- throw new RuntimeException(sprintf('"%s" is closed.', static::class));
- }
- $this->input[] = ProcessUtils::validateInput(__METHOD__, $input);
- }
- public function close()
- {
- $this->open = false;
- }
- public function isClosed()
- {
- return !$this->open;
- }
- #[\ReturnTypeWillChange]
- public function getIterator()
- {
- $this->open = true;
- while ($this->open || $this->input) {
- if (!$this->input) {
- yield '';
- continue;
- }
- $current = array_shift($this->input);
- if ($current instanceof \Iterator) {
- yield from $current;
- } else {
- yield $current;
- }
- if (!$this->input && $this->open && null !== $onEmpty = $this->onEmpty) {
- $this->write($onEmpty($this));
- }
- }
- }
- }
- Copyright (c) 2004-2022 Fabien Potencier
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is furnished
- to do so, subject to the following conditions:
- The above copyright notice and this permission notice shall be included in all
- copies or substantial portions of the Software.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
- <?php
- namespace Symfony\Component\Process;
- class PhpExecutableFinder
- {
- private $executableFinder;
- public function __construct()
- {
- $this->executableFinder = new ExecutableFinder();
- }
- public function find(bool $includeArgs = true)
- {
- if ($php = getenv('PHP_BINARY')) {
- if (!is_executable($php)) {
- $command = '\\' === \DIRECTORY_SEPARATOR ? 'where' : 'command -v';
- if ($php = strtok(exec($command.' '.escapeshellarg($php)), \PHP_EOL)) {
- if (!is_executable($php)) {
- return false;
- }
- } else {
- return false;
- }
- }
- if (@is_dir($php)) {
- return false;
- }
- return $php;
- }
- $args = $this->findArguments();
- $args = $includeArgs && $args ? ' '.implode(' ', $args) : '';
- if (\PHP_BINARY && \in_array(\PHP_SAPI, ['cgi-fcgi', 'cli', 'cli-server', 'phpdbg'], true)) {
- return \PHP_BINARY.$args;
- }
- if ($php = getenv('PHP_PATH')) {
- if (!@is_executable($php) || @is_dir($php)) {
- return false;
- }
- return $php;
- }
- if ($php = getenv('PHP_PEAR_PHP_BIN')) {
- if (@is_executable($php) && !@is_dir($php)) {
- return $php;
- }
- }
- if (@is_executable($php = \PHP_BINDIR.('\\' === \DIRECTORY_SEPARATOR ? '\\php.exe' : '/php')) && !@is_dir($php)) {
- return $php;
- }
- $dirs = [\PHP_BINDIR];
- if ('\\' === \DIRECTORY_SEPARATOR) {
- $dirs[] = 'C:\xampp\php\\';
- }
- return $this->executableFinder->find('php', false, $dirs);
- }
- public function findArguments()
- {
- $arguments = [];
- if ('phpdbg' === \PHP_SAPI) {
- $arguments[] = '-qrr';
- }
- return $arguments;
- }
- }
- <?php
- namespace Symfony\Component\Process;
- use Symfony\Component\Process\Exception\LogicException;
- use Symfony\Component\Process\Exception\RuntimeException;
- class PhpProcess extends Process
- {
- public function __construct(string $script, string $cwd = null, array $env = null, int $timeout = 60, array $php = null)
- {
- if (null === $php) {
- $executableFinder = new PhpExecutableFinder();
- $php = $executableFinder->find(false);
- $php = false === $php ? null : array_merge([$php], $executableFinder->findArguments());
- }
- if ('phpdbg' === \PHP_SAPI) {
- $file = tempnam(sys_get_temp_dir(), 'dbg');
- file_put_contents($file, $script);
- register_shutdown_function('unlink', $file);
- $php[] = $file;
- $script = null;
- }
- parent::__construct($php, $cwd, $env, $script, $timeout);
- }
- public static function fromShellCommandline(string $command, string $cwd = null, array $env = null, $input = null, ?float $timeout = 60)
- {
- throw new LogicException(sprintf('The "%s()" method cannot be called when using "%s".', __METHOD__, self::class));
- }
- public function start(callable $callback = null, array $env = [])
- {
- if (null === $this->getCommandLine()) {
- throw new RuntimeException('Unable to find the PHP executable.');
- }
- parent::start($callback, $env);
- }
- }
- <?php
- namespace Symfony\Component\Process\Pipes;
- use Symfony\Component\Process\Exception\InvalidArgumentException;
- abstract class AbstractPipes implements PipesInterface
- {
- public $pipes = [];
- private $inputBuffer = '';
- private $input;
- private $blocked = true;
- private $lastError;
- public function __construct($input)
- {
- if (\is_resource($input) || $input instanceof \Iterator) {
- $this->input = $input;
- } elseif (\is_string($input)) {
- $this->inputBuffer = $input;
- } else {
- $this->inputBuffer = (string) $input;
- }
- }
- public function close()
- {
- foreach ($this->pipes as $pipe) {
- if (\is_resource($pipe)) {
- fclose($pipe);
- }
- }
- $this->pipes = [];
- }
- protected function hasSystemCallBeenInterrupted(): bool
- {
- $lastError = $this->lastError;
- $this->lastError = null;
- return null !== $lastError && false !== stripos($lastError, 'interrupted system call');
- }
- protected function unblock()
- {
- if (!$this->blocked) {
- return;
- }
- foreach ($this->pipes as $pipe) {
- stream_set_blocking($pipe, 0);
- }
- if (\is_resource($this->input)) {
- stream_set_blocking($this->input, 0);
- }
- $this->blocked = false;
- }
- protected function write(): ?array
- {
- if (!isset($this->pipes[0])) {
- return null;
- }
- $input = $this->input;
- if ($input instanceof \Iterator) {
- if (!$input->valid()) {
- $input = null;
- } elseif (\is_resource($input = $input->current())) {
- stream_set_blocking($input, 0);
- } elseif (!isset($this->inputBuffer[0])) {
- if (!\is_string($input)) {
- if (!\is_scalar($input)) {
- 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)));
- }
- $input = (string) $input;
- }
- $this->inputBuffer = $input;
- $this->input->next();
- $input = null;
- } else {
- $input = null;
- }
- }
- $r = $e = [];
- $w = [$this->pipes[0]];
- if (false === @stream_select($r, $w, $e, 0, 0)) {
- return null;
- }
- foreach ($w as $stdin) {
- if (isset($this->inputBuffer[0])) {
- $written = fwrite($stdin, $this->inputBuffer);
- $this->inputBuffer = substr($this->inputBuffer, $written);
- if (isset($this->inputBuffer[0])) {
- return [$this->pipes[0]];
- }
- }
- if ($input) {
- while (true) {
- $data = fread($input, self::CHUNK_SIZE);
- if (!isset($data[0])) {
- break;
- }
- $written = fwrite($stdin, $data);
- $data = substr($data, $written);
- if (isset($data[0])) {
- $this->inputBuffer = $data;
- return [$this->pipes[0]];
- }
- }
- if (feof($input)) {
- if ($this->input instanceof \Iterator) {
- $this->input->next();
- } else {
- $this->input = null;
- }
- }
- }
- }
- if (!isset($this->inputBuffer[0]) && !($this->input instanceof \Iterator ? $this->input->valid() : $this->input)) {
- $this->input = null;
- fclose($this->pipes[0]);
- unset($this->pipes[0]);
- } elseif (!$w) {
- return [$this->pipes[0]];
- }
- return null;
- }
- public function handleError(int $type, string $msg)
- {
- $this->lastError = $msg;
- }
- }
- <?php
- namespace Symfony\Component\Process\Pipes;
- interface PipesInterface
- {
- public const CHUNK_SIZE = 16384;
- public function getDescriptors(): array;
- public function getFiles(): array;
- public function readAndWrite(bool $blocking, bool $close = false): array;
- public function areOpen(): bool;
- public function haveReadSupport(): bool;
- public function close();
- }
- <?php
- namespace Symfony\Component\Process\Pipes;
- use Symfony\Component\Process\Process;
- class UnixPipes extends AbstractPipes
- {
- private $ttyMode;
- private $ptyMode;
- private $haveReadSupport;
- public function __construct(?bool $ttyMode, bool $ptyMode, $input, bool $haveReadSupport)
- {
- $this->ttyMode = $ttyMode;
- $this->ptyMode = $ptyMode;
- $this->haveReadSupport = $haveReadSupport;
- parent::__construct($input);
- }
- public function __sleep(): array
- {
- throw new \BadMethodCallException('Cannot serialize '.__CLASS__);
- }
- public function __wakeup()
- {
- throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
- }
- public function __destruct()
- {
- $this->close();
- }
- public function getDescriptors(): array
- {
- if (!$this->haveReadSupport) {
- $nullstream = fopen('/dev/null', 'c');
- return [
- ['pipe', 'r'],
- $nullstream,
- $nullstream,
- ];
- }
- if ($this->ttyMode) {
- return [
- ['file', '/dev/tty', 'r'],
- ['file', '/dev/tty', 'w'],
- ['file', '/dev/tty', 'w'],
- ];
- }
- if ($this->ptyMode && Process::isPtySupported()) {
- return [
- ['pty'],
- ['pty'],
- ['pty'],
- ];
- }
- return [
- ['pipe', 'r'],
- ['pipe', 'w'],
- ['pipe', 'w'],
- ];
- }
- public function getFiles(): array
- {
- return [];
- }
- public function readAndWrite(bool $blocking, bool $close = false): array
- {
- $this->unblock();
- $w = $this->write();
- $read = $e = [];
- $r = $this->pipes;
- unset($r[0]);
- set_error_handler([$this, 'handleError']);
- if (($r || $w) && false === stream_select($r, $w, $e, 0, $blocking ? Process::TIMEOUT_PRECISION * 1E6 : 0)) {
- restore_error_handler();
- if (!$this->hasSystemCallBeenInterrupted()) {
- $this->pipes = [];
- }
- return $read;
- }
- restore_error_handler();
- foreach ($r as $pipe) {
- $read[$type = array_search($pipe, $this->pipes, true)] = '';
- do {
- $data = @fread($pipe, self::CHUNK_SIZE);
- $read[$type] .= $data;
- } while (isset($data[0]) && ($close || isset($data[self::CHUNK_SIZE - 1])));
- if (!isset($read[$type][0])) {
- unset($read[$type]);
- }
- if ($close && feof($pipe)) {
- fclose($pipe);
- unset($this->pipes[$type]);
- }
- }
- return $read;
- }
- public function haveReadSupport(): bool
- {
- return $this->haveReadSupport;
- }
- public function areOpen(): bool
- {
- return (bool) $this->pipes;
- }
- }
- <?php
- namespace Symfony\Component\Process\Pipes;
- use Symfony\Component\Process\Exception\RuntimeException;
- use Symfony\Component\Process\Process;
- class WindowsPipes extends AbstractPipes
- {
- private $files = [];
- private $fileHandles = [];
- private $lockHandles = [];
- private $readBytes = [
- Process::STDOUT => 0,
- Process::STDERR => 0,
- ];
- private $haveReadSupport;
- public function __construct($input, bool $haveReadSupport)
- {
- $this->haveReadSupport = $haveReadSupport;
- if ($this->haveReadSupport) {
- $pipes = [
- Process::STDOUT => Process::OUT,
- Process::STDERR => Process::ERR,
- ];
- $tmpDir = sys_get_temp_dir();
- $lastError = 'unknown reason';
- set_error_handler(function ($type, $msg) use (&$lastError) { $lastError = $msg; });
- for ($i = 0;; ++$i) {
- foreach ($pipes as $pipe => $name) {
- $file = sprintf('%s\\sf_proc_%02X.%s', $tmpDir, $i, $name);
- if (!$h = fopen($file.'.lock', 'w')) {
- if (file_exists($file.'.lock')) {
- continue 2;
- }
- restore_error_handler();
- throw new RuntimeException('A temporary file could not be opened to write the process output: '.$lastError);
- }
- if (!flock($h, \LOCK_EX | \LOCK_NB)) {
- continue 2;
- }
- if (isset($this->lockHandles[$pipe])) {
- flock($this->lockHandles[$pipe], \LOCK_UN);
- fclose($this->lockHandles[$pipe]);
- }
- $this->lockHandles[$pipe] = $h;
- if (!($h = fopen($file, 'w')) || !fclose($h) || !$h = fopen($file, 'r')) {
- flock($this->lockHandles[$pipe], \LOCK_UN);
- fclose($this->lockHandles[$pipe]);
- unset($this->lockHandles[$pipe]);
- continue 2;
- }
- $this->fileHandles[$pipe] = $h;
- $this->files[$pipe] = $file;
- }
- break;
- }
- restore_error_handler();
- }
- parent::__construct($input);
- }
- public function __sleep(): array
- {
- throw new \BadMethodCallException('Cannot serialize '.__CLASS__);
- }
- public function __wakeup()
- {
- throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
- }
- public function __destruct()
- {
- $this->close();
- }
- public function getDescriptors(): array
- {
- if (!$this->haveReadSupport) {
- $nullstream = fopen('NUL', 'c');
- return [
- ['pipe', 'r'],
- $nullstream,
- $nullstream,
- ];
- }
- return [
- ['pipe', 'r'],
- ['file', 'NUL', 'w'],
- ['file', 'NUL', 'w'],
- ];
- }
- public function getFiles(): array
- {
- return $this->files;
- }
- public function readAndWrite(bool $blocking, bool $close = false): array
- {
- $this->unblock();
- $w = $this->write();
- $read = $r = $e = [];
- if ($blocking) {
- if ($w) {
- @stream_select($r, $w, $e, 0, Process::TIMEOUT_PRECISION * 1E6);
- } elseif ($this->fileHandles) {
- usleep(Process::TIMEOUT_PRECISION * 1E6);
- }
- }
- foreach ($this->fileHandles as $type => $fileHandle) {
- $data = stream_get_contents($fileHandle, -1, $this->readBytes[$type]);
- if (isset($data[0])) {
- $this->readBytes[$type] += \strlen($data);
- $read[$type] = $data;
- }
- if ($close) {
- ftruncate($fileHandle, 0);
- fclose($fileHandle);
- flock($this->lockHandles[$type], \LOCK_UN);
- fclose($this->lockHandles[$type]);
- unset($this->fileHandles[$type], $this->lockHandles[$type]);
- }
- }
- return $read;
- }
- public function haveReadSupport(): bool
- {
- return $this->haveReadSupport;
- }
- public function areOpen(): bool
- {
- return $this->pipes && $this->fileHandles;
- }
- public function close()
- {
- parent::close();
- foreach ($this->fileHandles as $type => $handle) {
- ftruncate($handle, 0);
- fclose($handle);
- flock($this->lockHandles[$type], \LOCK_UN);
- fclose($this->lockHandles[$type]);
- }
- $this->fileHandles = $this->lockHandles = [];
- }
- }
- <?php
- namespace Symfony\Component\Process;
- use Symfony\Component\Process\Exception\InvalidArgumentException;
- use Symfony\Component\Process\Exception\LogicException;
- use Symfony\Component\Process\Exception\ProcessFailedException;
- use Symfony\Component\Process\Exception\ProcessSignaledException;
- use Symfony\Component\Process\Exception\ProcessTimedOutException;
- use Symfony\Component\Process\Exception\RuntimeException;
- use Symfony\Component\Process\Pipes\PipesInterface;
- use Symfony\Component\Process\Pipes\UnixPipes;
- use Symfony\Component\Process\Pipes\WindowsPipes;
- class Process implements \IteratorAggregate
- {
- public const ERR = 'err';
- public const OUT = 'out';
- public const STATUS_READY = 'ready';
- public const STATUS_STARTED = 'started';
- public const STATUS_TERMINATED = 'terminated';
- public const STDIN = 0;
- public const STDOUT = 1;
- public const STDERR = 2;
- public const TIMEOUT_PRECISION = 0.2;
- public const ITER_NON_BLOCKING = 1;
- public const ITER_KEEP_OUTPUT = 2;
- public const ITER_SKIP_OUT = 4;
- public const ITER_SKIP_ERR = 8;
- private $callback;
- private $hasCallback = false;
- private $commandline;
- private $cwd;
- private $env = [];
- private $input;
- private $starttime;
- private $lastOutputTime;
- private $timeout;
- private $idleTimeout;
- private $exitcode;
- private $fallbackStatus = [];
- private $processInformation;
- private $outputDisabled = false;
- private $stdout;
- private $stderr;
- private $process;
- private $status = self::STATUS_READY;
- private $incrementalOutputOffset = 0;
- private $incrementalErrorOutputOffset = 0;
- private $tty = false;
- private $pty;
- private $options = ['suppress_errors' => true, 'bypass_shell' => true];
- private $useFileHandles = false;
- private $processPipes;
- private $latestSignal;
- private static $sigchild;
- public static $exitCodes = [
- 0 => 'OK',
- 1 => 'General error',
- 2 => 'Misuse of shell builtins',
- 126 => 'Invoked command cannot execute',
- 127 => 'Command not found',
- 128 => 'Invalid exit argument',
- 129 => 'Hangup',
- 130 => 'Interrupt',
- 131 => 'Quit and dump core',
- 132 => 'Illegal instruction',
- 133 => 'Trace/breakpoint trap',
- 134 => 'Process aborted',
- 135 => 'Bus error: "access to undefined portion of memory object"',
- 136 => 'Floating point exception: "erroneous arithmetic operation"',
- 137 => 'Kill (terminate immediately)',
- 138 => 'User-defined 1',
- 139 => 'Segmentation violation',
- 140 => 'User-defined 2',
- 141 => 'Write to pipe with no one reading',
- 142 => 'Signal raised by alarm',
- 143 => 'Termination (request to terminate)',
- 145 => 'Child process terminated, stopped (or continued*)',
- 146 => 'Continue if stopped',
- 147 => 'Stop executing temporarily',
- 148 => 'Terminal stop signal',
- 149 => 'Background process attempting to read from tty ("in")',
- 150 => 'Background process attempting to write to tty ("out")',
- 151 => 'Urgent data available on socket',
- 152 => 'CPU time limit exceeded',
- 153 => 'File size limit exceeded',
- 154 => 'Signal raised by timer counting virtual time: "virtual timer expired"',
- 155 => 'Profiling timer expired',
- 157 => 'Pollable event',
- 159 => 'Bad syscall',
- ];
- public function __construct(array $command, string $cwd = null, array $env = null, $input = null, ?float $timeout = 60)
- {
- if (!\function_exists('proc_open')) {
- throw new LogicException('The Process class relies on proc_open, which is not available on your PHP installation.');
- }
- $this->commandline = $command;
- $this->cwd = $cwd;
- if (null === $this->cwd && (\defined('ZEND_THREAD_SAFE') || '\\' === \DIRECTORY_SEPARATOR)) {
- $this->cwd = getcwd();
- }
- if (null !== $env) {
- $this->setEnv($env);
- }
- $this->setInput($input);
- $this->setTimeout($timeout);
- $this->useFileHandles = '\\' === \DIRECTORY_SEPARATOR;
- $this->pty = false;
- }
- public static function fromShellCommandline(string $command, string $cwd = null, array $env = null, $input = null, ?float $timeout = 60)
- {
- $process = new static([], $cwd, $env, $input, $timeout);
- $process->commandline = $command;
- return $process;
- }
- public function __sleep()
- {
- throw new \BadMethodCallException('Cannot serialize '.__CLASS__);
- }
- public function __wakeup()
- {
- throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
- }
- public function __destruct()
- {
- if ($this->options['create_new_console'] ?? false) {
- $this->processPipes->close();
- } else {
- $this->stop(0);
- }
- }
- public function __clone()
- {
- $this->resetProcessData();
- }
- public function run(callable $callback = null, array $env = []): int
- {
- $this->start($callback, $env);
- return $this->wait();
- }
- public function mustRun(callable $callback = null, array $env = []): self
- {
- if (0 !== $this->run($callback, $env)) {
- throw new ProcessFailedException($this);
- }
- return $this;
- }
- public function start(callable $callback = null, array $env = [])
- {
- if ($this->isRunning()) {
- throw new RuntimeException('Process is already running.');
- }
- $this->resetProcessData();
- $this->starttime = $this->lastOutputTime = microtime(true);
- $this->callback = $this->buildCallback($callback);
- $this->hasCallback = null !== $callback;
- $descriptors = $this->getDescriptors();
- if ($this->env) {
- $env += '\\' === \DIRECTORY_SEPARATOR ? array_diff_ukey($this->env, $env, 'strcasecmp') : $this->env;
- }
- $env += '\\' === \DIRECTORY_SEPARATOR ? array_diff_ukey($this->getDefaultEnv(), $env, 'strcasecmp') : $this->getDefaultEnv();
- if (\is_array($commandline = $this->commandline)) {
- $commandline = implode(' ', array_map([$this, 'escapeArgument'], $commandline));
- if ('\\' !== \DIRECTORY_SEPARATOR) {
- $commandline = 'exec '.$commandline;
- }
- } else {
- $commandline = $this->replacePlaceholders($commandline, $env);
- }
- if ('\\' === \DIRECTORY_SEPARATOR) {
- $commandline = $this->prepareWindowsCommandLine($commandline, $env);
- } elseif (!$this->useFileHandles && $this->isSigchildEnabled()) {
- $descriptors[3] = ['pipe', 'w'];
- $commandline = '{ ('.$commandline.') <&3 3<&- 3>/dev/null & } 3<&0;';
- $commandline .= 'pid=$!; echo $pid >&3; wait $pid; code=$?; echo $code >&3; exit $code';
- $ptsWorkaround = fopen(__FILE__, 'r');
- }
- $envPairs = [];
- foreach ($env as $k => $v) {
- if (false !== $v && false === \in_array($k, ['argc', 'argv', 'ARGC', 'ARGV'], true)) {
- $envPairs[] = $k.'='.$v;
- }
- }
- if (!is_dir($this->cwd)) {
- throw new RuntimeException(sprintf('The provided cwd "%s" does not exist.', $this->cwd));
- }
- $this->process = @proc_open($commandline, $descriptors, $this->processPipes->pipes, $this->cwd, $envPairs, $this->options);
- if (!\is_resource($this->process)) {
- throw new RuntimeException('Unable to launch a new process.');
- }
- $this->status = self::STATUS_STARTED;
- if (isset($descriptors[3])) {
- $this->fallbackStatus['pid'] = (int) fgets($this->processPipes->pipes[3]);
- }
- if ($this->tty) {
- return;
- }
- $this->updateStatus(false);
- $this->checkTimeout();
- }
- public function restart(callable $callback = null, array $env = []): self
- {
- if ($this->isRunning()) {
- throw new RuntimeException('Process is already running.');
- }
- $process = clone $this;
- $process->start($callback, $env);
- return $process;
- }
- public function wait(callable $callback = null)
- {
- $this->requireProcessIsStarted(__FUNCTION__);
- $this->updateStatus(false);
- if (null !== $callback) {
- if (!$this->processPipes->haveReadSupport()) {
- $this->stop(0);
- throw new LogicException('Pass the callback to the "Process::start" method or call enableOutput to use a callback with "Process::wait".');
- }
- $this->callback = $this->buildCallback($callback);
- }
- do {
- $this->checkTimeout();
- $running = '\\' === \DIRECTORY_SEPARATOR ? $this->isRunning() : $this->processPipes->areOpen();
- $this->readPipes($running, '\\' !== \DIRECTORY_SEPARATOR || !$running);
- } while ($running);
- while ($this->isRunning()) {
- $this->checkTimeout();
- usleep(1000);
- }
- if ($this->processInformation['signaled'] && $this->processInformation['termsig'] !== $this->latestSignal) {
- throw new ProcessSignaledException($this);
- }
- return $this->exitcode;
- }
- public function waitUntil(callable $callback): bool
- {
- $this->requireProcessIsStarted(__FUNCTION__);
- $this->updateStatus(false);
- if (!$this->processPipes->haveReadSupport()) {
- $this->stop(0);
- throw new LogicException('Pass the callback to the "Process::start" method or call enableOutput to use a callback with "Process::waitUntil".');
- }
- $callback = $this->buildCallback($callback);
- $ready = false;
- while (true) {
- $this->checkTimeout();
- $running = '\\' === \DIRECTORY_SEPARATOR ? $this->isRunning() : $this->processPipes->areOpen();
- $output = $this->processPipes->readAndWrite($running, '\\' !== \DIRECTORY_SEPARATOR || !$running);
- foreach ($output as $type => $data) {
- if (3 !== $type) {
- $ready = $callback(self::STDOUT === $type ? self::OUT : self::ERR, $data) || $ready;
- } elseif (!isset($this->fallbackStatus['signaled'])) {
- $this->fallbackStatus['exitcode'] = (int) $data;
- }
- }
- if ($ready) {
- return true;
- }
- if (!$running) {
- return false;
- }
- usleep(1000);
- }
- }
- public function getPid()
- {
- return $this->isRunning() ? $this->processInformation['pid'] : null;
- }
- public function signal(int $signal)
- {
- $this->doSignal($signal, true);
- return $this;
- }
- public function disableOutput()
- {
- if ($this->isRunning()) {
- throw new RuntimeException('Disabling output while the process is running is not possible.');
- }
- if (null !== $this->idleTimeout) {
- throw new LogicException('Output cannot be disabled while an idle timeout is set.');
- }
- $this->outputDisabled = true;
- return $this;
- }
- public function enableOutput()
- {
- if ($this->isRunning()) {
- throw new RuntimeException('Enabling output while the process is running is not possible.');
- }
- $this->outputDisabled = false;
- return $this;
- }
- public function isOutputDisabled()
- {
- return $this->outputDisabled;
- }
- public function getOutput()
- {
- $this->readPipesForOutput(__FUNCTION__);
- if (false === $ret = stream_get_contents($this->stdout, -1, 0)) {
- return '';
- }
- return $ret;
- }
- public function getIncrementalOutput()
- {
- $this->readPipesForOutput(__FUNCTION__);
- $latest = stream_get_contents($this->stdout, -1, $this->incrementalOutputOffset);
- $this->incrementalOutputOffset = ftell($this->stdout);
- if (false === $latest) {
- return '';
- }
- return $latest;
- }
- #[\ReturnTypeWillChange]
- public function getIterator(int $flags = 0)
- {
- $this->readPipesForOutput(__FUNCTION__, false);
- $clearOutput = !(self::ITER_KEEP_OUTPUT & $flags);
- $blocking = !(self::ITER_NON_BLOCKING & $flags);
- $yieldOut = !(self::ITER_SKIP_OUT & $flags);
- $yieldErr = !(self::ITER_SKIP_ERR & $flags);
- while (null !== $this->callback || ($yieldOut && !feof($this->stdout)) || ($yieldErr && !feof($this->stderr))) {
- if ($yieldOut) {
- $out = stream_get_contents($this->stdout, -1, $this->incrementalOutputOffset);
- if (isset($out[0])) {
- if ($clearOutput) {
- $this->clearOutput();
- } else {
- $this->incrementalOutputOffset = ftell($this->stdout);
- }
- yield self::OUT => $out;
- }
- }
- if ($yieldErr) {
- $err = stream_get_contents($this->stderr, -1, $this->incrementalErrorOutputOffset);
- if (isset($err[0])) {
- if ($clearOutput) {
- $this->clearErrorOutput();
- } else {
- $this->incrementalErrorOutputOffset = ftell($this->stderr);
- }
- yield self::ERR => $err;
- }
- }
- if (!$blocking && !isset($out[0]) && !isset($err[0])) {
- yield self::OUT => '';
- }
- $this->checkTimeout();
- $this->readPipesForOutput(__FUNCTION__, $blocking);
- }
- }
- public function clearOutput()
- {
- ftruncate($this->stdout, 0);
- fseek($this->stdout, 0);
- $this->incrementalOutputOffset = 0;
- return $this;
- }
- public function getErrorOutput()
- {
- $this->readPipesForOutput(__FUNCTION__);
- if (false === $ret = stream_get_contents($this->stderr, -1, 0)) {
- return '';
- }
- return $ret;
- }
- public function getIncrementalErrorOutput()
- {
- $this->readPipesForOutput(__FUNCTION__);
- $latest = stream_get_contents($this->stderr, -1, $this->incrementalErrorOutputOffset);
- $this->incrementalErrorOutputOffset = ftell($this->stderr);
- if (false === $latest) {
- return '';
- }
- return $latest;
- }
- public function clearErrorOutput()
- {
- ftruncate($this->stderr, 0);
- fseek($this->stderr, 0);
- $this->incrementalErrorOutputOffset = 0;
- return $this;
- }
- public function getExitCode()
- {
- $this->updateStatus(false);
- return $this->exitcode;
- }
- public function getExitCodeText()
- {
- if (null === $exitcode = $this->getExitCode()) {
- return null;
- }
- return self::$exitCodes[$exitcode] ?? 'Unknown error';
- }
- public function isSuccessful()
- {
- return 0 === $this->getExitCode();
- }
- public function hasBeenSignaled()
- {
- $this->requireProcessIsTerminated(__FUNCTION__);
- return $this->processInformation['signaled'];
- }
- public function getTermSignal()
- {
- $this->requireProcessIsTerminated(__FUNCTION__);
- if ($this->isSigchildEnabled() && -1 === $this->processInformation['termsig']) {
- throw new RuntimeException('This PHP has been compiled with --enable-sigchild. Term signal cannot be retrieved.');
- }
- return $this->processInformation['termsig'];
- }
- public function hasBeenStopped()
- {
- $this->requireProcessIsTerminated(__FUNCTION__);
- return $this->processInformation['stopped'];
- }
- public function getStopSignal()
- {
- $this->requireProcessIsTerminated(__FUNCTION__);
- return $this->processInformation['stopsig'];
- }
- public function isRunning()
- {
- if (self::STATUS_STARTED !== $this->status) {
- return false;
- }
- $this->updateStatus(false);
- return $this->processInformation['running'];
- }
- public function isStarted()
- {
- return self::STATUS_READY != $this->status;
- }
- public function isTerminated()
- {
- $this->updateStatus(false);
- return self::STATUS_TERMINATED == $this->status;
- }
- public function getStatus()
- {
- $this->updateStatus(false);
- return $this->status;
- }
- public function stop(float $timeout = 10, int $signal = null)
- {
- $timeoutMicro = microtime(true) + $timeout;
- if ($this->isRunning()) {
- $this->doSignal(15, false);
- do {
- usleep(1000);
- } while ($this->isRunning() && microtime(true) < $timeoutMicro);
- if ($this->isRunning()) {
- $this->doSignal($signal ?: 9, false);
- }
- }
- if ($this->isRunning()) {
- if (isset($this->fallbackStatus['pid'])) {
- unset($this->fallbackStatus['pid']);
- return $this->stop(0, $signal);
- }
- $this->close();
- }
- return $this->exitcode;
- }
- public function addOutput(string $line)
- {
- $this->lastOutputTime = microtime(true);
- fseek($this->stdout, 0, \SEEK_END);
- fwrite($this->stdout, $line);
- fseek($this->stdout, $this->incrementalOutputOffset);
- }
- public function addErrorOutput(string $line)
- {
- $this->lastOutputTime = microtime(true);
- fseek($this->stderr, 0, \SEEK_END);
- fwrite($this->stderr, $line);
- fseek($this->stderr, $this->incrementalErrorOutputOffset);
- }
- public function getLastOutputTime(): ?float
- {
- return $this->lastOutputTime;
- }
- public function getCommandLine()
- {
- return \is_array($this->commandline) ? implode(' ', array_map([$this, 'escapeArgument'], $this->commandline)) : $this->commandline;
- }
- public function getTimeout()
- {
- return $this->timeout;
- }
- public function getIdleTimeout()
- {
- return $this->idleTimeout;
- }
- public function setTimeout(?float $timeout)
- {
- $this->timeout = $this->validateTimeout($timeout);
- return $this;
- }
- public function setIdleTimeout(?float $timeout)
- {
- if (null !== $timeout && $this->outputDisabled) {
- throw new LogicException('Idle timeout cannot be set while the output is disabled.');
- }
- $this->idleTimeout = $this->validateTimeout($timeout);
- return $this;
- }
- public function setTty(bool $tty)
- {
- if ('\\' === \DIRECTORY_SEPARATOR && $tty) {
- throw new RuntimeException('TTY mode is not supported on Windows platform.');
- }
- if ($tty && !self::isTtySupported()) {
- throw new RuntimeException('TTY mode requires /dev/tty to be read/writable.');
- }
- $this->tty = $tty;
- return $this;
- }
- public function isTty()
- {
- return $this->tty;
- }
- public function setPty(bool $bool)
- {
- $this->pty = $bool;
- return $this;
- }
- public function isPty()
- {
- return $this->pty;
- }
- public function getWorkingDirectory()
- {
- if (null === $this->cwd) {
- return getcwd() ?: null;
- }
- return $this->cwd;
- }
- public function setWorkingDirectory(string $cwd)
- {
- $this->cwd = $cwd;
- return $this;
- }
- public function getEnv()
- {
- return $this->env;
- }
- public function setEnv(array $env)
- {
- $this->env = $env;
- return $this;
- }
- public function getInput()
- {
- return $this->input;
- }
- public function setInput($input)
- {
- if ($this->isRunning()) {
- throw new LogicException('Input cannot be set while the process is running.');
- }
- $this->input = ProcessUtils::validateInput(__METHOD__, $input);
- return $this;
- }
- public function checkTimeout()
- {
- if (self::STATUS_STARTED !== $this->status) {
- return;
- }
- if (null !== $this->timeout && $this->timeout < microtime(true) - $this->starttime) {
- $this->stop(0);
- throw new ProcessTimedOutException($this, ProcessTimedOutException::TYPE_GENERAL);
- }
- if (null !== $this->idleTimeout && $this->idleTimeout < microtime(true) - $this->lastOutputTime) {
- $this->stop(0);
- throw new ProcessTimedOutException($this, ProcessTimedOutException::TYPE_IDLE);
- }
- }
- public function getStartTime(): float
- {
- if (!$this->isStarted()) {
- throw new LogicException('Start time is only available after process start.');
- }
- return $this->starttime;
- }
- public function setOptions(array $options)
- {
- if ($this->isRunning()) {
- throw new RuntimeException('Setting options while the process is running is not possible.');
- }
- $defaultOptions = $this->options;
- $existingOptions = ['blocking_pipes', 'create_process_group', 'create_new_console'];
- foreach ($options as $key => $value) {
- if (!\in_array($key, $existingOptions)) {
- $this->options = $defaultOptions;
- throw new LogicException(sprintf('Invalid option "%s" passed to "%s()". Supported options are "%s".', $key, __METHOD__, implode('", "', $existingOptions)));
- }
- $this->options[$key] = $value;
- }
- }
- public static function isTtySupported(): bool
- {
- static $isTtySupported;
- if (null === $isTtySupported) {
- $isTtySupported = (bool) @proc_open('echo 1 >/dev/null', [['file', '/dev/tty', 'r'], ['file', '/dev/tty', 'w'], ['file', '/dev/tty', 'w']], $pipes);
- }
- return $isTtySupported;
- }
- public static function isPtySupported()
- {
- static $result;
- if (null !== $result) {
- return $result;
- }
- if ('\\' === \DIRECTORY_SEPARATOR) {
- return $result = false;
- }
- return $result = (bool) @proc_open('echo 1 >/dev/null', [['pty'], ['pty'], ['pty']], $pipes);
- }
- private function getDescriptors(): array
- {
- if ($this->input instanceof \Iterator) {
- $this->input->rewind();
- }
- if ('\\' === \DIRECTORY_SEPARATOR) {
- $this->processPipes = new WindowsPipes($this->input, !$this->outputDisabled || $this->hasCallback);
- } else {
- $this->processPipes = new UnixPipes($this->isTty(), $this->isPty(), $this->input, !$this->outputDisabled || $this->hasCallback);
- }
- return $this->processPipes->getDescriptors();
- }
- protected function buildCallback(callable $callback = null)
- {
- if ($this->outputDisabled) {
- return function ($type, $data) use ($callback): bool {
- return null !== $callback && $callback($type, $data);
- };
- }
- $out = self::OUT;
- return function ($type, $data) use ($callback, $out): bool {
- if ($out == $type) {
- $this->addOutput($data);
- } else {
- $this->addErrorOutput($data);
- }
- return null !== $callback && $callback($type, $data);
- };
- }
- protected function updateStatus(bool $blocking)
- {
- if (self::STATUS_STARTED !== $this->status) {
- return;
- }
- $this->processInformation = proc_get_status($this->process);
- $running = $this->processInformation['running'];
- $this->readPipes($running && $blocking, '\\' !== \DIRECTORY_SEPARATOR || !$running);
- if ($this->fallbackStatus && $this->isSigchildEnabled()) {
- $this->processInformation = $this->fallbackStatus + $this->processInformation;
- }
- if (!$running) {
- $this->close();
- }
- }
- protected function isSigchildEnabled()
- {
- if (null !== self::$sigchild) {
- return self::$sigchild;
- }
- if (!\function_exists('phpinfo')) {
- return self::$sigchild = false;
- }
- ob_start();
- phpinfo(\INFO_GENERAL);
- return self::$sigchild = str_contains(ob_get_clean(), '--enable-sigchild');
- }
- private function readPipesForOutput(string $caller, bool $blocking = false)
- {
- if ($this->outputDisabled) {
- throw new LogicException('Output has been disabled.');
- }
- $this->requireProcessIsStarted($caller);
- $this->updateStatus($blocking);
- }
- private function validateTimeout(?float $timeout): ?float
- {
- $timeout = (float) $timeout;
- if (0.0 === $timeout) {
- $timeout = null;
- } elseif ($timeout < 0) {
- throw new InvalidArgumentException('The timeout value must be a valid positive integer or float number.');
- }
- return $timeout;
- }
- private function readPipes(bool $blocking, bool $close)
- {
- $result = $this->processPipes->readAndWrite($blocking, $close);
- $callback = $this->callback;
- foreach ($result as $type => $data) {
- if (3 !== $type) {
- $callback(self::STDOUT === $type ? self::OUT : self::ERR, $data);
- } elseif (!isset($this->fallbackStatus['signaled'])) {
- $this->fallbackStatus['exitcode'] = (int) $data;
- }
- }
- }
- private function close(): int
- {
- $this->processPipes->close();
- if (\is_resource($this->process)) {
- proc_close($this->process);
- }
- $this->exitcode = $this->processInformation['exitcode'];
- $this->status = self::STATUS_TERMINATED;
- if (-1 === $this->exitcode) {
- if ($this->processInformation['signaled'] && 0 < $this->processInformation['termsig']) {
- $this->exitcode = 128 + $this->processInformation['termsig'];
- } elseif ($this->isSigchildEnabled()) {
- $this->processInformation['signaled'] = true;
- $this->processInformation['termsig'] = -1;
- }
- }
- $this->callback = null;
- return $this->exitcode;
- }
- private function resetProcessData()
- {
- $this->starttime = null;
- $this->callback = null;
- $this->exitcode = null;
- $this->fallbackStatus = [];
- $this->processInformation = null;
- $this->stdout = fopen('php://temp/maxmemory:'.(1024 * 1024), 'w+');
- $this->stderr = fopen('php://temp/maxmemory:'.(1024 * 1024), 'w+');
- $this->process = null;
- $this->latestSignal = null;
- $this->status = self::STATUS_READY;
- $this->incrementalOutputOffset = 0;
- $this->incrementalErrorOutputOffset = 0;
- }
- private function doSignal(int $signal, bool $throwException): bool
- {
- if (null === $pid = $this->getPid()) {
- if ($throwException) {
- throw new LogicException('Cannot send signal on a non running process.');
- }
- return false;
- }
- if ('\\' === \DIRECTORY_SEPARATOR) {
- exec(sprintf('taskkill /F /T /PID %d 2>&1', $pid), $output, $exitCode);
- if ($exitCode && $this->isRunning()) {
- if ($throwException) {
- throw new RuntimeException(sprintf('Unable to kill the process (%s).', implode(' ', $output)));
- }
- return false;
- }
- } else {
- if (!$this->isSigchildEnabled()) {
- $ok = @proc_terminate($this->process, $signal);
- } elseif (\function_exists('posix_kill')) {
- $ok = @posix_kill($pid, $signal);
- } elseif ($ok = proc_open(sprintf('kill -%d %d', $signal, $pid), [2 => ['pipe', 'w']], $pipes)) {
- $ok = false === fgets($pipes[2]);
- }
- if (!$ok) {
- if ($throwException) {
- throw new RuntimeException(sprintf('Error while sending signal "%s".', $signal));
- }
- return false;
- }
- }
- $this->latestSignal = $signal;
- $this->fallbackStatus['signaled'] = true;
- $this->fallbackStatus['exitcode'] = -1;
- $this->fallbackStatus['termsig'] = $this->latestSignal;
- return true;
- }
- private function prepareWindowsCommandLine(string $cmd, array &$env): string
- {
- $uid = uniqid('', true);
- $varCount = 0;
- $varCache = [];
- $cmd = preg_replace_callback(
- '/"(?:(
- [^"%!^]*+
- (?:
- (?: !LF! | "(?:\^[%!^])?+" )
- [^"%!^]*+
- )++
- ) | [^"]*+ )"/x',
- function ($m) use (&$env, &$varCache, &$varCount, $uid) {
- if (!isset($m[1])) {
- return $m[0];
- }
- if (isset($varCache[$m[0]])) {
- return $varCache[$m[0]];
- }
- if (str_contains($value = $m[1], "\0")) {
- $value = str_replace("\0", '?', $value);
- }
- if (false === strpbrk($value, "\"%!\n")) {
- return '"'.$value.'"';
- }
- $value = str_replace(['!LF!', '"^!"', '"^%"', '"^^"', '""'], ["\n", '!', '%', '^', '"'], $value);
- $value = '"'.preg_replace('/(\\\\*)"/', '$1$1\\"', $value).'"';
- $var = $uid.++$varCount;
- $env[$var] = $value;
- return $varCache[$m[0]] = '!'.$var.'!';
- },
- $cmd
- );
- $cmd = 'cmd /V:ON /E:ON /D /C ('.str_replace("\n", ' ', $cmd).')';
- foreach ($this->processPipes->getFiles() as $offset => $filename) {
- $cmd .= ' '.$offset.'>"'.$filename.'"';
- }
- return $cmd;
- }
- private function requireProcessIsStarted(string $functionName)
- {
- if (!$this->isStarted()) {
- throw new LogicException(sprintf('Process must be started before calling "%s()".', $functionName));
- }
- }
- private function requireProcessIsTerminated(string $functionName)
- {
- if (!$this->isTerminated()) {
- throw new LogicException(sprintf('Process must be terminated before calling "%s()".', $functionName));
- }
- }
- private function escapeArgument(?string $argument): string
- {
- if ('' === $argument || null === $argument) {
- return '""';
- }
- if ('\\' !== \DIRECTORY_SEPARATOR) {
- return "'".str_replace("'", "'\\''", $argument)."'";
- }
- if (str_contains($argument, "\0")) {
- $argument = str_replace("\0", '?', $argument);
- }
- if (!preg_match('/[\/()%!^"<>&|\s]/', $argument)) {
- return $argument;
- }
- $argument = preg_replace('/(\\\\+)$/', '$1$1', $argument);
- return '"'.str_replace(['"', '^', '%', '!', "\n"], ['""', '"^^"', '"^%"', '"^!"', '!LF!'], $argument).'"';
- }
- private function replacePlaceholders(string $commandline, array $env)
- {
- return preg_replace_callback('/"\$\{:([_a-zA-Z]++[_a-zA-Z0-9]*+)\}"/', function ($matches) use ($commandline, $env) {
- if (!isset($env[$matches[1]]) || false === $env[$matches[1]]) {
- throw new InvalidArgumentException(sprintf('Command line is missing a value for parameter "%s": ', $matches[1]).$commandline);
- }
- return $this->escapeArgument($env[$matches[1]]);
- }, $commandline);
- }
- private function getDefaultEnv(): array
- {
- $env = getenv();
- $env = ('\\' === \DIRECTORY_SEPARATOR ? array_intersect_ukey($env, $_SERVER, 'strcasecmp') : array_intersect_key($env, $_SERVER)) ?: $env;
- return $_ENV + ('\\' === \DIRECTORY_SEPARATOR ? array_diff_ukey($env, $_ENV, 'strcasecmp') : $env);
- }
- }
- <?php
- namespace Symfony\Component\Process;
- use Symfony\Component\Process\Exception\InvalidArgumentException;
- class ProcessUtils
- {
- private function __construct()
- {
- }
- public static function validateInput(string $caller, $input)
- {
- if (null !== $input) {
- if (\is_resource($input)) {
- return $input;
- }
- if (\is_string($input)) {
- return $input;
- }
- if (\is_scalar($input)) {
- return (string) $input;
- }
- if ($input instanceof Process) {
- return $input->getIterator($input::ITER_SKIP_ERR);
- }
- if ($input instanceof \Iterator) {
- return $input;
- }
- if ($input instanceof \Traversable) {
- return new \IteratorIterator($input);
- }
- throw new InvalidArgumentException(sprintf('"%s" only accepts strings, Traversable objects or stream resources.', $caller));
- }
- return $input;
- }
- }
- <?php
- namespace Symfony\Contracts\Service\Attribute;
- #[\Attribute(\Attribute::TARGET_METHOD | \Attribute::TARGET_PROPERTY)]
- final class Required
- {
- }
- <?php
- namespace Symfony\Contracts\Service\Attribute;
- use Symfony\Contracts\Service\ServiceSubscriberTrait;
- #[\Attribute(\Attribute::TARGET_METHOD)]
- final class SubscribedService
- {
- public function __construct(
- public ?string $key = null
- ) {
- }
- }
- Copyright (c) 2018-2022 Fabien Potencier
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is furnished
- to do so, subject to the following conditions:
- The above copyright notice and this permission notice shall be included in all
- copies or substantial portions of the Software.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
- <?php
- namespace Symfony\Contracts\Service;
- interface ResetInterface
- {
- public function reset();
- }
- <?php
- namespace Symfony\Contracts\Service;
- use Psr\Container\ContainerExceptionInterface;
- use Psr\Container\NotFoundExceptionInterface;
- class_exists(ContainerExceptionInterface::class);
- class_exists(NotFoundExceptionInterface::class);
- trait ServiceLocatorTrait
- {
- private $factories;
- private $loading = [];
- private $providedTypes;
- public function __construct(array $factories)
- {
- $this->factories = $factories;
- }
- public function has(string $id)
- {
- return isset($this->factories[$id]);
- }
- public function get(string $id)
- {
- if (!isset($this->factories[$id])) {
- throw $this->createNotFoundException($id);
- }
- if (isset($this->loading[$id])) {
- $ids = array_values($this->loading);
- $ids = \array_slice($this->loading, array_search($id, $ids));
- $ids[] = $id;
- throw $this->createCircularReferenceException($id, $ids);
- }
- $this->loading[$id] = $id;
- try {
- return $this->factories[$id]($this);
- } finally {
- unset($this->loading[$id]);
- }
- }
- public function getProvidedServices(): array
- {
- if (null === $this->providedTypes) {
- $this->providedTypes = [];
- foreach ($this->factories as $name => $factory) {
- if (!\is_callable($factory)) {
- $this->providedTypes[$name] = '?';
- } else {
- $type = (new \ReflectionFunction($factory))->getReturnType();
- $this->providedTypes[$name] = $type ? ($type->allowsNull() ? '?' : '').($type instanceof \ReflectionNamedType ? $type->getName() : $type) : '?';
- }
- }
- }
- return $this->providedTypes;
- }
- private function createNotFoundException(string $id): NotFoundExceptionInterface
- {
- if (!$alternatives = array_keys($this->factories)) {
- $message = 'is empty...';
- } else {
- $last = array_pop($alternatives);
- if ($alternatives) {
- $message = sprintf('only knows about the "%s" and "%s" services.', implode('", "', $alternatives), $last);
- } else {
- $message = sprintf('only knows about the "%s" service.', $last);
- }
- }
- if ($this->loading) {
- $message = sprintf('The service "%s" has a dependency on a non-existent service "%s". This locator %s', end($this->loading), $id, $message);
- } else {
- $message = sprintf('Service "%s" not found: the current service locator %s', $id, $message);
- }
- return new class($message) extends \InvalidArgumentException implements NotFoundExceptionInterface {
- };
- }
- private function createCircularReferenceException(string $id, array $path): ContainerExceptionInterface
- {
- return new class(sprintf('Circular reference detected for service "%s", path: "%s".', $id, implode(' -> ', $path))) extends \RuntimeException implements ContainerExceptionInterface {
- };
- }
- }
- <?php
- namespace Symfony\Contracts\Service;
- use Psr\Container\ContainerInterface;
- interface ServiceProviderInterface extends ContainerInterface
- {
- public function getProvidedServices(): array;
- }
- <?php
- namespace Symfony\Contracts\Service;
- interface ServiceSubscriberInterface
- {
- public static function getSubscribedServices();
- }
- <?php
- namespace Symfony\Contracts\Service;
- use Psr\Container\ContainerInterface;
- use Symfony\Contracts\Service\Attribute\SubscribedService;
- trait ServiceSubscriberTrait
- {
- protected $container;
- public static function getSubscribedServices(): array
- {
- $services = method_exists(get_parent_class(self::class) ?: '', __FUNCTION__) ? parent::getSubscribedServices() : [];
- $attributeOptIn = false;
- if (\PHP_VERSION_ID >= 80000) {
- foreach ((new \ReflectionClass(self::class))->getMethods() as $method) {
- if (self::class !== $method->getDeclaringClass()->name) {
- continue;
- }
- if (!$attribute = $method->getAttributes(SubscribedService::class)[0] ?? null) {
- continue;
- }
- if ($method->isStatic() || $method->isAbstract() || $method->isGenerator() || $method->isInternal() || $method->getNumberOfRequiredParameters()) {
- 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));
- }
- if (!$returnType = $method->getReturnType()) {
- throw new \LogicException(sprintf('Cannot use "%s" on methods without a return type in "%s::%s()".', SubscribedService::class, $method->name, self::class));
- }
- $serviceId = $returnType instanceof \ReflectionNamedType ? $returnType->getName() : (string) $returnType;
- if ($returnType->allowsNull()) {
- $serviceId = '?'.$serviceId;
- }
- $services[$attribute->newInstance()->key ?? self::class.'::'.$method->name] = $serviceId;
- $attributeOptIn = true;
- }
- }
- if (!$attributeOptIn) {
- foreach ((new \ReflectionClass(self::class))->getMethods() as $method) {
- if ($method->isStatic() || $method->isAbstract() || $method->isGenerator() || $method->isInternal() || $method->getNumberOfRequiredParameters()) {
- continue;
- }
- if (self::class !== $method->getDeclaringClass()->name) {
- continue;
- }
- if (!($returnType = $method->getReturnType()) instanceof \ReflectionNamedType) {
- continue;
- }
- if ($returnType->isBuiltin()) {
- continue;
- }
- if (\PHP_VERSION_ID >= 80000) {
- 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);
- }
- $services[self::class.'::'.$method->name] = '?'.($returnType instanceof \ReflectionNamedType ? $returnType->getName() : $returnType);
- }
- }
- return $services;
- }
- public function setContainer(ContainerInterface $container)
- {
- $this->container = $container;
- if (method_exists(get_parent_class(self::class) ?: '', __FUNCTION__)) {
- return parent::setContainer($container);
- }
- return null;
- }
- }
- <?php
- namespace Symfony\Contracts\Service\Test;
- use PHPUnit\Framework\TestCase;
- use Psr\Container\ContainerInterface;
- use Symfony\Contracts\Service\ServiceLocatorTrait;
- abstract class ServiceLocatorTest extends TestCase
- {
- protected function getServiceLocator(array $factories)
- {
- return new class($factories) implements ContainerInterface {
- use ServiceLocatorTrait;
- };
- }
- public function testHas()
- {
- $locator = $this->getServiceLocator([
- 'foo' => function () { return 'bar'; },
- 'bar' => function () { return 'baz'; },
- function () { return 'dummy'; },
- ]);
- $this->assertTrue($locator->has('foo'));
- $this->assertTrue($locator->has('bar'));
- $this->assertFalse($locator->has('dummy'));
- }
- public function testGet()
- {
- $locator = $this->getServiceLocator([
- 'foo' => function () { return 'bar'; },
- 'bar' => function () { return 'baz'; },
- ]);
- $this->assertSame('bar', $locator->get('foo'));
- $this->assertSame('baz', $locator->get('bar'));
- }
- public function testGetDoesNotMemoize()
- {
- $i = 0;
- $locator = $this->getServiceLocator([
- 'foo' => function () use (&$i) {
- ++$i;
- return 'bar';
- },
- ]);
- $this->assertSame('bar', $locator->get('foo'));
- $this->assertSame('bar', $locator->get('foo'));
- $this->assertSame(2, $i);
- }
- public function testThrowsOnUndefinedInternalService()
- {
- if (!$this->getExpectedException()) {
- $this->expectException(\Psr\Container\NotFoundExceptionInterface::class);
- $this->expectExceptionMessage('The service "foo" has a dependency on a non-existent service "bar". This locator only knows about the "foo" service.');
- }
- $locator = $this->getServiceLocator([
- 'foo' => function () use (&$locator) { return $locator->get('bar'); },
- ]);
- $locator->get('foo');
- }
- public function testThrowsOnCircularReference()
- {
- $this->expectException(\Psr\Container\ContainerExceptionInterface::class);
- $this->expectExceptionMessage('Circular reference detected for service "bar", path: "bar -> baz -> bar".');
- $locator = $this->getServiceLocator([
- 'foo' => function () use (&$locator) { return $locator->get('bar'); },
- 'bar' => function () use (&$locator) { return $locator->get('baz'); },
- 'baz' => function () use (&$locator) { return $locator->get('bar'); },
- ]);
- $locator->get('foo');
- }
- }
- <?php
- namespace Symfony\Component\String;
- use Symfony\Component\String\Exception\ExceptionInterface;
- use Symfony\Component\String\Exception\InvalidArgumentException;
- use Symfony\Component\String\Exception\RuntimeException;
- abstract class AbstractString implements \Stringable, \JsonSerializable
- {
- public const PREG_PATTERN_ORDER = \PREG_PATTERN_ORDER;
- public const PREG_SET_ORDER = \PREG_SET_ORDER;
- public const PREG_OFFSET_CAPTURE = \PREG_OFFSET_CAPTURE;
- public const PREG_UNMATCHED_AS_NULL = \PREG_UNMATCHED_AS_NULL;
- public const PREG_SPLIT = 0;
- public const PREG_SPLIT_NO_EMPTY = \PREG_SPLIT_NO_EMPTY;
- public const PREG_SPLIT_DELIM_CAPTURE = \PREG_SPLIT_DELIM_CAPTURE;
- public const PREG_SPLIT_OFFSET_CAPTURE = \PREG_SPLIT_OFFSET_CAPTURE;
- protected $string = '';
- protected $ignoreCase = false;
- abstract public function __construct(string $string = '');
- public static function unwrap(array $values): array
- {
- foreach ($values as $k => $v) {
- if ($v instanceof self) {
- $values[$k] = $v->__toString();
- } elseif (\is_array($v) && $values[$k] !== $v = static::unwrap($v)) {
- $values[$k] = $v;
- }
- }
- return $values;
- }
- public static function wrap(array $values): array
- {
- $i = 0;
- $keys = null;
- foreach ($values as $k => $v) {
- if (\is_string($k) && '' !== $k && $k !== $j = (string) new static($k)) {
- $keys = $keys ?? array_keys($values);
- $keys[$i] = $j;
- }
- if (\is_string($v)) {
- $values[$k] = new static($v);
- } elseif (\is_array($v) && $values[$k] !== $v = static::wrap($v)) {
- $values[$k] = $v;
- }
- ++$i;
- }
- return null !== $keys ? array_combine($keys, $values) : $values;
- }
- public function after($needle, bool $includeNeedle = false, int $offset = 0): self
- {
- $str = clone $this;
- $i = \PHP_INT_MAX;
- foreach ((array) $needle as $n) {
- $n = (string) $n;
- $j = $this->indexOf($n, $offset);
- if (null !== $j && $j < $i) {
- $i = $j;
- $str->string = $n;
- }
- }
- if (\PHP_INT_MAX === $i) {
- return $str;
- }
- if (!$includeNeedle) {
- $i += $str->length();
- }
- return $this->slice($i);
- }
- public function afterLast($needle, bool $includeNeedle = false, int $offset = 0): self
- {
- $str = clone $this;
- $i = null;
- foreach ((array) $needle as $n) {
- $n = (string) $n;
- $j = $this->indexOfLast($n, $offset);
- if (null !== $j && $j >= $i) {
- $i = $offset = $j;
- $str->string = $n;
- }
- }
- if (null === $i) {
- return $str;
- }
- if (!$includeNeedle) {
- $i += $str->length();
- }
- return $this->slice($i);
- }
- abstract public function append(string ...$suffix): self;
- public function before($needle, bool $includeNeedle = false, int $offset = 0): self
- {
- $str = clone $this;
- $i = \PHP_INT_MAX;
- foreach ((array) $needle as $n) {
- $n = (string) $n;
- $j = $this->indexOf($n, $offset);
- if (null !== $j && $j < $i) {
- $i = $j;
- $str->string = $n;
- }
- }
- if (\PHP_INT_MAX === $i) {
- return $str;
- }
- if ($includeNeedle) {
- $i += $str->length();
- }
- return $this->slice(0, $i);
- }
- public function beforeLast($needle, bool $includeNeedle = false, int $offset = 0): self
- {
- $str = clone $this;
- $i = null;
- foreach ((array) $needle as $n) {
- $n = (string) $n;
- $j = $this->indexOfLast($n, $offset);
- if (null !== $j && $j >= $i) {
- $i = $offset = $j;
- $str->string = $n;
- }
- }
- if (null === $i) {
- return $str;
- }
- if ($includeNeedle) {
- $i += $str->length();
- }
- return $this->slice(0, $i);
- }
- public function bytesAt(int $offset): array
- {
- $str = $this->slice($offset, 1);
- return '' === $str->string ? [] : array_values(unpack('C*', $str->string));
- }
- abstract public function camel(): self;
- abstract public function chunk(int $length = 1): array;
- public function collapseWhitespace(): self
- {
- $str = clone $this;
- $str->string = trim(preg_replace('/(?:\s{2,}+|[^\S ])/', ' ', $str->string));
- return $str;
- }
- public function containsAny($needle): bool
- {
- return null !== $this->indexOf($needle);
- }
- public function endsWith($suffix): bool
- {
- if (!\is_array($suffix) && !$suffix instanceof \Traversable) {
- throw new \TypeError(sprintf('Method "%s()" must be overridden by class "%s" to deal with non-iterable values.', __FUNCTION__, static::class));
- }
- foreach ($suffix as $s) {
- if ($this->endsWith((string) $s)) {
- return true;
- }
- }
- return false;
- }
- public function ensureEnd(string $suffix): self
- {
- if (!$this->endsWith($suffix)) {
- return $this->append($suffix);
- }
- $suffix = preg_quote($suffix);
- $regex = '{('.$suffix.')(?:'.$suffix.')++$}D';
- return $this->replaceMatches($regex.($this->ignoreCase ? 'i' : ''), '$1');
- }
- public function ensureStart(string $prefix): self
- {
- $prefix = new static($prefix);
- if (!$this->startsWith($prefix)) {
- return $this->prepend($prefix);
- }
- $str = clone $this;
- $i = $prefixLen = $prefix->length();
- while ($this->indexOf($prefix, $i) === $i) {
- $str = $str->slice($prefixLen);
- $i += $prefixLen;
- }
- return $str;
- }
- public function equalsTo($string): bool
- {
- if (!\is_array($string) && !$string instanceof \Traversable) {
- throw new \TypeError(sprintf('Method "%s()" must be overridden by class "%s" to deal with non-iterable values.', __FUNCTION__, static::class));
- }
- foreach ($string as $s) {
- if ($this->equalsTo((string) $s)) {
- return true;
- }
- }
- return false;
- }
- abstract public function folded(): self;
- public function ignoreCase(): self
- {
- $str = clone $this;
- $str->ignoreCase = true;
- return $str;
- }
- public function indexOf($needle, int $offset = 0): ?int
- {
- if (!\is_array($needle) && !$needle instanceof \Traversable) {
- throw new \TypeError(sprintf('Method "%s()" must be overridden by class "%s" to deal with non-iterable values.', __FUNCTION__, static::class));
- }
- $i = \PHP_INT_MAX;
- foreach ($needle as $n) {
- $j = $this->indexOf((string) $n, $offset);
- if (null !== $j && $j < $i) {
- $i = $j;
- }
- }
- return \PHP_INT_MAX === $i ? null : $i;
- }
- public function indexOfLast($needle, int $offset = 0): ?int
- {
- if (!\is_array($needle) && !$needle instanceof \Traversable) {
- throw new \TypeError(sprintf('Method "%s()" must be overridden by class "%s" to deal with non-iterable values.', __FUNCTION__, static::class));
- }
- $i = null;
- foreach ($needle as $n) {
- $j = $this->indexOfLast((string) $n, $offset);
- if (null !== $j && $j >= $i) {
- $i = $offset = $j;
- }
- }
- return $i;
- }
- public function isEmpty(): bool
- {
- return '' === $this->string;
- }
- abstract public function join(array $strings, string $lastGlue = null): self;
- public function jsonSerialize(): string
- {
- return $this->string;
- }
- abstract public function length(): int;
- abstract public function lower(): self;
- abstract public function match(string $regexp, int $flags = 0, int $offset = 0): array;
- abstract public function padBoth(int $length, string $padStr = ' '): self;
- abstract public function padEnd(int $length, string $padStr = ' '): self;
- abstract public function padStart(int $length, string $padStr = ' '): self;
- abstract public function prepend(string ...$prefix): self;
- public function repeat(int $multiplier): self
- {
- if (0 > $multiplier) {
- throw new InvalidArgumentException(sprintf('Multiplier must be positive, %d given.', $multiplier));
- }
- $str = clone $this;
- $str->string = str_repeat($str->string, $multiplier);
- return $str;
- }
- abstract public function replace(string $from, string $to): self;
- abstract public function replaceMatches(string $fromRegexp, $to): self;
- abstract public function reverse(): self;
- abstract public function slice(int $start = 0, int $length = null): self;
- abstract public function snake(): self;
- abstract public function splice(string $replacement, int $start = 0, int $length = null): self;
- public function split(string $delimiter, int $limit = null, int $flags = null): array
- {
- if (null === $flags) {
- throw new \TypeError('Split behavior when $flags is null must be implemented by child classes.');
- }
- if ($this->ignoreCase) {
- $delimiter .= 'i';
- }
- set_error_handler(static function ($t, $m) { throw new InvalidArgumentException($m); });
- try {
- if (false === $chunks = preg_split($delimiter, $this->string, $limit, $flags)) {
- $lastError = preg_last_error();
- foreach (get_defined_constants(true)['pcre'] as $k => $v) {
- if ($lastError === $v && '_ERROR' === substr($k, -6)) {
- throw new RuntimeException('Splitting failed with '.$k.'.');
- }
- }
- throw new RuntimeException('Splitting failed with unknown error code.');
- }
- } finally {
- restore_error_handler();
- }
- $str = clone $this;
- if (self::PREG_SPLIT_OFFSET_CAPTURE & $flags) {
- foreach ($chunks as &$chunk) {
- $str->string = $chunk[0];
- $chunk[0] = clone $str;
- }
- } else {
- foreach ($chunks as &$chunk) {
- $str->string = $chunk;
- $chunk = clone $str;
- }
- }
- return $chunks;
- }
- public function startsWith($prefix): bool
- {
- if (!\is_array($prefix) && !$prefix instanceof \Traversable) {
- throw new \TypeError(sprintf('Method "%s()" must be overridden by class "%s" to deal with non-iterable values.', __FUNCTION__, static::class));
- }
- foreach ($prefix as $prefix) {
- if ($this->startsWith((string) $prefix)) {
- return true;
- }
- }
- return false;
- }
- abstract public function title(bool $allWords = false): self;
- public function toByteString(string $toEncoding = null): ByteString
- {
- $b = new ByteString();
- $toEncoding = \in_array($toEncoding, ['utf8', 'utf-8', 'UTF8'], true) ? 'UTF-8' : $toEncoding;
- if (null === $toEncoding || $toEncoding === $fromEncoding = $this instanceof AbstractUnicodeString || preg_match('//u', $b->string) ? 'UTF-8' : 'Windows-1252') {
- $b->string = $this->string;
- return $b;
- }
- set_error_handler(static function ($t, $m) { throw new InvalidArgumentException($m); });
- try {
- try {
- $b->string = mb_convert_encoding($this->string, $toEncoding, 'UTF-8');
- } catch (InvalidArgumentException $e) {
- if (!\function_exists('iconv')) {
- throw $e;
- }
- $b->string = iconv('UTF-8', $toEncoding, $this->string);
- }
- } finally {
- restore_error_handler();
- }
- return $b;
- }
- public function toCodePointString(): CodePointString
- {
- return new CodePointString($this->string);
- }
- public function toString(): string
- {
- return $this->string;
- }
- public function toUnicodeString(): UnicodeString
- {
- return new UnicodeString($this->string);
- }
- abstract public function trim(string $chars = " \t\n\r\0\x0B\x0C\u{A0}\u{FEFF}"): self;
- abstract public function trimEnd(string $chars = " \t\n\r\0\x0B\x0C\u{A0}\u{FEFF}"): self;
- public function trimPrefix($prefix): self
- {
- if (\is_array($prefix) || $prefix instanceof \Traversable) {
- foreach ($prefix as $s) {
- $t = $this->trimPrefix($s);
- if ($t->string !== $this->string) {
- return $t;
- }
- }
- return clone $this;
- }
- $str = clone $this;
- if ($prefix instanceof self) {
- $prefix = $prefix->string;
- } else {
- $prefix = (string) $prefix;
- }
- if ('' !== $prefix && \strlen($this->string) >= \strlen($prefix) && 0 === substr_compare($this->string, $prefix, 0, \strlen($prefix), $this->ignoreCase)) {
- $str->string = substr($this->string, \strlen($prefix));
- }
- return $str;
- }
- abstract public function trimStart(string $chars = " \t\n\r\0\x0B\x0C\u{A0}\u{FEFF}"): self;
- public function trimSuffix($suffix): self
- {
- if (\is_array($suffix) || $suffix instanceof \Traversable) {
- foreach ($suffix as $s) {
- $t = $this->trimSuffix($s);
- if ($t->string !== $this->string) {
- return $t;
- }
- }
- return clone $this;
- }
- $str = clone $this;
- if ($suffix instanceof self) {
- $suffix = $suffix->string;
- } else {
- $suffix = (string) $suffix;
- }
- if ('' !== $suffix && \strlen($this->string) >= \strlen($suffix) && 0 === substr_compare($this->string, $suffix, -\strlen($suffix), null, $this->ignoreCase)) {
- $str->string = substr($this->string, 0, -\strlen($suffix));
- }
- return $str;
- }
- public function truncate(int $length, string $ellipsis = '', bool $cut = true): self
- {
- $stringLength = $this->length();
- if ($stringLength <= $length) {
- return clone $this;
- }
- $ellipsisLength = '' !== $ellipsis ? (new static($ellipsis))->length() : 0;
- if ($length < $ellipsisLength) {
- $ellipsisLength = 0;
- }
- if (!$cut) {
- if (null === $length = $this->indexOf([' ', "\r", "\n", "\t"], ($length ?: 1) - 1)) {
- return clone $this;
- }
- $length += $ellipsisLength;
- }
- $str = $this->slice(0, $length - $ellipsisLength);
- return $ellipsisLength ? $str->trimEnd()->append($ellipsis) : $str;
- }
- abstract public function upper(): self;
- abstract public function width(bool $ignoreAnsiDecoration = true): int;
- public function wordwrap(int $width = 75, string $break = "\n", bool $cut = false): self
- {
- $lines = '' !== $break ? $this->split($break) : [clone $this];
- $chars = [];
- $mask = '';
- if (1 === \count($lines) && '' === $lines[0]->string) {
- return $lines[0];
- }
- foreach ($lines as $i => $line) {
- if ($i) {
- $chars[] = $break;
- $mask .= '#';
- }
- foreach ($line->chunk() as $char) {
- $chars[] = $char->string;
- $mask .= ' ' === $char->string ? ' ' : '?';
- }
- }
- $string = '';
- $j = 0;
- $b = $i = -1;
- $mask = wordwrap($mask, $width, '#', $cut);
- while (false !== $b = strpos($mask, '#', $b + 1)) {
- for (++$i; $i < $b; ++$i) {
- $string .= $chars[$j];
- unset($chars[$j++]);
- }
- if ($break === $chars[$j] || ' ' === $chars[$j]) {
- unset($chars[$j++]);
- }
- $string .= $break;
- }
- $str = clone $this;
- $str->string = $string.implode('', $chars);
- return $str;
- }
- public function __sleep(): array
- {
- return ['string'];
- }
- public function __clone()
- {
- $this->ignoreCase = false;
- }
- public function __toString(): string
- {
- return $this->string;
- }
- }
- <?php
- namespace Symfony\Component\String;
- use Symfony\Component\String\Exception\ExceptionInterface;
- use Symfony\Component\String\Exception\InvalidArgumentException;
- use Symfony\Component\String\Exception\RuntimeException;
- abstract class AbstractUnicodeString extends AbstractString
- {
- public const NFC = \Normalizer::NFC;
- public const NFD = \Normalizer::NFD;
- public const NFKC = \Normalizer::NFKC;
- public const NFKD = \Normalizer::NFKD;
- 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";
- private const FOLD_FROM = ['Ä°', 'µ', 'Å¿', "\xCD\x85", 'Ï‚', 'Ï�', 'Ï‘', 'Ï•', 'Ï–', 'Ï°', 'ϱ', 'ϵ', 'ẛ', "\xE1\xBE\xBE", 'ß', 'Ä°', 'ʼn', 'Ç°', 'Î�', 'ΰ', 'Ö‡', 'ẖ', 'ẗ', 'ẘ', 'ẙ', 'ẚ', 'ẞ', 'á½�', 'á½’', 'á½”', 'á½–', 'á¾€', 'á¾�', 'ᾂ', 'ᾃ', 'ᾄ', 'á¾…', 'ᾆ', 'ᾇ', 'ᾈ', 'ᾉ', 'ᾊ', 'ᾋ', 'ᾌ', 'á¾�', 'ᾎ', 'á¾�', 'á¾�', 'ᾑ', 'á¾’', 'ᾓ', 'á¾”', 'ᾕ', 'á¾–', 'á¾—', 'ᾘ', 'á¾™', 'ᾚ', 'á¾›', 'ᾜ', 'á¾�', 'ᾞ', 'ᾟ', 'á¾ ', 'ᾡ', 'á¾¢', 'á¾£', 'ᾤ', 'á¾¥', 'ᾦ', 'ᾧ', 'ᾨ', 'ᾩ', 'ᾪ', 'ᾫ', 'ᾬ', 'á¾', 'á¾®', 'ᾯ', 'á¾²', 'á¾³', 'á¾´', 'ᾶ', 'á¾·', 'á¾¼', 'á¿‚', 'ῃ', 'á¿„', 'ῆ', 'ῇ', 'á¿Œ', 'á¿’', 'Î�', 'á¿–', 'á¿—', 'á¿¢', 'ΰ', 'ῤ', 'ῦ', 'ῧ', 'ῲ', 'ῳ', 'á¿´', 'ῶ', 'á¿·', 'ῼ', 'ff', 'ï¬�', 'fl', 'ffi', 'ffl', 'ſt', 'st', 'ﬓ', 'ﬔ', 'ﬕ', 'ﬖ', 'ﬗ'];
- private const FOLD_TO = ['i̇', 'μ', 's', 'ι', 'σ', 'β', 'θ', 'φ', 'Ï€', 'κ', 'Ï�', 'ε', 'ṡ', 'ι', 'ss', 'i̇', 'ʼn', 'Ç°', 'Î�', 'ΰ', 'Õ¥Ö‚', 'ẖ', 'ẗ', 'ẘ', 'ẙ', 'aʾ', 'ss', 'á½�', 'á½’', 'á½”', 'á½–', 'ἀι', 'á¼�ι', 'ἂι', 'ἃι', 'ἄι', 'ἅι', 'ἆι', 'ἇι', 'ἀι', 'á¼�ι', 'ἂι', 'ἃι', 'ἄι', 'ἅι', 'ἆι', 'ἇι', 'ἠι', 'ἡι', 'ἢι', 'ἣι', 'ἤι', 'ἥι', 'ἦι', 'ἧι', 'ἠι', 'ἡι', 'ἢι', 'ἣι', 'ἤι', 'ἥι', 'ἦι', 'ἧι', 'ὠι', 'ὡι', 'ὢι', 'ὣι', 'ὤι', 'ὥι', 'ὦι', 'ὧι', 'ὠι', 'ὡι', 'ὢι', 'ὣι', 'ὤι', 'ὥι', 'ὦι', 'ὧι', 'ὰι', 'αι', 'άι', 'ᾶ', 'ᾶι', 'αι', 'ὴι', 'ηι', 'ήι', 'ῆ', 'ῆι', 'ηι', 'á¿’', 'Î�', 'á¿–', 'á¿—', 'á¿¢', 'ΰ', 'ῤ', 'ῦ', 'ῧ', 'ὼι', 'ωι', 'ώι', 'ῶ', 'ῶι', 'ωι', 'ff', 'fi', 'fl', 'ffi', 'ffl', 'st', 'st', 'Õ´Õ¶', 'Õ´Õ¥', 'Õ´Õ«', 'Õ¾Õ¶', 'Õ´Õ'];
- private const UPPER_FROM = ['ß', 'ff', '�', 'fl', 'ffi', 'ffl', 'ſt', 'st', 'և', 'ﬓ', 'ﬔ', 'ﬕ', 'ﬖ', 'ﬗ', 'ʼn', '�', 'ΰ', 'ǰ', 'ẖ', 'ẗ', 'ẘ', 'ẙ', 'ẚ', '�', 'ὒ', 'ὔ', 'ὖ', 'ᾶ', 'ῆ', 'ῒ', 'ΐ', 'ῖ', 'ῗ', 'ῢ', 'ΰ', 'ῤ', 'ῦ', 'ῧ', 'ῶ'];
- private const UPPER_TO = ['SS', 'FF', 'FI', 'FL', 'FFI', 'FFL', 'ST', 'ST', 'ԵՒ', 'ՄՆ', 'ՄԵ', 'ՄԻ', 'ՎՆ', 'ՄԽ', 'ʼN', 'Ϊ�', 'Ϋ�', 'J̌', 'H̱', 'T̈', 'W̊', 'Y̊', 'Aʾ', 'Υ̓', 'Υ̓̀', 'Υ̓�', 'Υ̓͂', 'Α͂', 'Η͂', 'Ϊ̀', 'Ϊ�', 'Ι͂', 'Ϊ͂', 'Ϋ̀', 'Ϋ�', 'Ρ̓', 'Υ͂', 'Ϋ͂', 'Ω͂'];
- private const TRANSLIT_FROM = ['Æ', 'Ã�', 'Ø', 'Þ', 'ß', 'æ', 'ð', 'ø', 'þ', 'Ä�', 'Ä‘', 'Ħ', 'ħ', 'ı', 'ĸ', 'Ä¿', 'Å€', 'Å�', 'Å‚', 'ʼn', 'ÅŠ', 'Å‹', 'Å’', 'Å“', 'Ŧ', 'ŧ', 'Æ€', 'Æ�', 'Æ‚', 'ƃ', 'Ƈ', 'ƈ', 'Ɖ', 'ÆŠ', 'Æ‹', 'ÆŒ', 'Æ�', 'Æ‘', 'Æ’', 'Æ“', 'Æ•', 'Æ–', 'Æ—', 'Ƙ', 'Æ™', 'Æš', 'Æ�', 'Æž', 'Æ¢', 'Æ£', 'Ƥ', 'Æ¥', 'Æ«', 'Ƭ', 'Æ', 'Æ®', 'Ʋ', 'Ƴ', 'Æ´', 'Ƶ', 'ƶ', 'Ç„', 'Ç…', 'dž', 'Ǥ', 'Ç¥', 'È¡', 'Ȥ', 'È¥', 'È´', 'ȵ', 'ȶ', 'È·', 'ȸ', 'ȹ', 'Ⱥ', 'È»', 'ȼ', 'Ƚ', 'Ⱦ', 'È¿', 'É€', 'Ƀ', 'É„', 'Ɇ', 'ɇ', 'Ɉ', 'ɉ', 'ÉŒ', 'É�', 'ÉŽ', 'É�', 'É“', 'É•', 'É–', 'É—', 'É›', 'ÉŸ', 'É ', 'É¡', 'É¢', 'ɦ', 'ɧ', 'ɨ', 'ɪ', 'É«', 'ɬ', 'É', 'ɱ', 'ɲ', 'ɳ', 'É´', 'ɶ', 'ɼ', 'ɽ', 'ɾ', 'Ê€', 'Ê‚', 'ʈ', 'ʉ', 'Ê‹', 'Ê�', 'Ê�', 'Ê‘', 'Ê™', 'Ê›', 'Êœ', 'Ê�', 'ÊŸ', 'Ê ', 'Ê£', 'Ê¥', 'ʦ', 'ʪ', 'Ê«', 'á´€', 'á´�', 'á´ƒ', 'á´„', 'á´…', 'á´†', 'á´‡', 'á´Š', 'á´‹', 'á´Œ', 'á´�', 'á´�', 'á´˜', 'á´›', 'á´œ', 'á´ ', 'á´¡', 'á´¢', 'ᵫ', 'ᵬ', 'áµ', 'áµ®', 'ᵯ', 'áµ°', 'áµ±', 'áµ²', 'áµ³', 'áµ´', 'áµµ', 'ᵶ', 'ᵺ', 'áµ»', 'áµ½', 'áµ¾', 'ᶀ', 'á¶�', 'ᶂ', 'ᶃ', 'ᶄ', 'ᶅ', 'ᶆ', 'ᶇ', 'ᶈ', 'ᶉ', 'ᶊ', 'ᶌ', 'á¶�', 'ᶎ', 'á¶�', 'ᶑ', 'ᶒ', 'ᶓ', 'ᶖ', 'ᶙ', 'ẚ', 'ẜ', 'áº�', 'ẞ', 'Ỻ', 'á»»', 'Ỽ', 'ỽ', 'Ỿ', 'ỿ', '©', '®', 'â‚ ', 'â‚¢', 'â‚£', '₤', '₧', '₺', '₹', 'â„Œ', 'â„ž', '㎧', '㎮', 'ã�†', 'ã�—', 'ã�ž', 'ã�Ÿ', '¼', '½', '¾', 'â…“', 'â…”', 'â…•', 'â…–', 'â…—', 'â…˜', 'â…™', 'â…š', 'â…›', 'â…œ', 'â…�', 'â…ž', 'â…Ÿ', '〇', '‘', '’', '‚', '‛', '“', 'â€�', '„', '‟', '′', '″', 'ã€�', '〞', '«', '»', '‹', '›', 'â€�', '‑', '‒', '–', '—', '―', '︱', '︲', '﹘', '‖', 'â�„', 'â�…', 'â�†', 'â�Ž', 'ã€�', '。', '〈', '〉', '《', '》', '〔', '〕', '〘', '〙', '〚', '〛', '︑', '︒', '︹', '︺', '︽', '︾', '︿', 'ï¹€', '﹑', 'ï¹�', '﹞', '⦅', 'ï½ ', '。', '、', '×', '÷', '−', '∕', '∖', '∣', '∥', '≪', '≫', '⦅', '⦆'];
- 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', '\'', '\'', ',', '\'', '"', '"', ',,', '"', '\'', '"', '"', '"', '<<', '>>', '<', '>', '-', '-', '-', '-', '-', '-', '-', '-', '-', '||', '/', '[', ']', '*', ',', '.', '<', '>', '<<', '>>', '[', ']', '[', ']', '[', ']', ',', '.', '[', ']', '<<', '>>', '<', '>', ',', '[', ']', '((', '))', '.', ',', '*', '/', '-', '/', '\\', '|', '||', '<<', '>>', '((', '))'];
- private static $transliterators = [];
- private static $tableZero;
- private static $tableWide;
- public static function fromCodePoints(int ...$codes): self
- {
- $string = '';
- foreach ($codes as $code) {
- if (0x80 > $code %= 0x200000) {
- $string .= \chr($code);
- } elseif (0x800 > $code) {
- $string .= \chr(0xC0 | $code >> 6).\chr(0x80 | $code & 0x3F);
- } elseif (0x10000 > $code) {
- $string .= \chr(0xE0 | $code >> 12).\chr(0x80 | $code >> 6 & 0x3F).\chr(0x80 | $code & 0x3F);
- } else {
- $string .= \chr(0xF0 | $code >> 18).\chr(0x80 | $code >> 12 & 0x3F).\chr(0x80 | $code >> 6 & 0x3F).\chr(0x80 | $code & 0x3F);
- }
- }
- return new static($string);
- }
- public function ascii(array $rules = []): self
- {
- $str = clone $this;
- $s = $str->string;
- $str->string = '';
- array_unshift($rules, 'nfd');
- $rules[] = 'latin-ascii';
- if (\function_exists('transliterator_transliterate')) {
- $rules[] = 'any-latin/bgn';
- }
- $rules[] = 'nfkd';
- $rules[] = '[:nonspacing mark:] remove';
- while (\strlen($s) - 1 > $i = strspn($s, self::ASCII)) {
- if (0 < --$i) {
- $str->string .= substr($s, 0, $i);
- $s = substr($s, $i);
- }
- if (!$rule = array_shift($rules)) {
- $rules = [];
- }
- if ($rule instanceof \Transliterator) {
- $s = $rule->transliterate($s);
- } elseif ($rule instanceof \Closure) {
- $s = $rule($s);
- } elseif ($rule) {
- if ('nfd' === $rule = strtolower($rule)) {
- normalizer_is_normalized($s, self::NFD) ?: $s = normalizer_normalize($s, self::NFD);
- } elseif ('nfkd' === $rule) {
- normalizer_is_normalized($s, self::NFKD) ?: $s = normalizer_normalize($s, self::NFKD);
- } elseif ('[:nonspacing mark:] remove' === $rule) {
- $s = preg_replace('/\p{Mn}++/u', '', $s);
- } elseif ('latin-ascii' === $rule) {
- $s = str_replace(self::TRANSLIT_FROM, self::TRANSLIT_TO, $s);
- } elseif ('de-ascii' === $rule) {
- $s = preg_replace("/([AUO])\u{0308}(?=\p{Ll})/u", '$1e', $s);
- $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);
- } elseif (\function_exists('transliterator_transliterate')) {
- if (null === $transliterator = self::$transliterators[$rule] ?? self::$transliterators[$rule] = \Transliterator::create($rule)) {
- if ('any-latin/bgn' === $rule) {
- $rule = 'any-latin';
- $transliterator = self::$transliterators[$rule] ?? self::$transliterators[$rule] = \Transliterator::create($rule);
- }
- if (null === $transliterator) {
- throw new InvalidArgumentException(sprintf('Unknown transliteration rule "%s".', $rule));
- }
- self::$transliterators['any-latin/bgn'] = $transliterator;
- }
- $s = $transliterator->transliterate($s);
- }
- } elseif (!\function_exists('iconv')) {
- $s = preg_replace('/[^\x00-\x7F]/u', '?', $s);
- } else {
- $s = @preg_replace_callback('/[^\x00-\x7F]/u', static function ($c) {
- $c = (string) iconv('UTF-8', 'ASCII//TRANSLIT', $c[0]);
- if ('' === $c && '' === iconv('UTF-8', 'ASCII//TRANSLIT', '²')) {
- throw new \LogicException(sprintf('"%s" requires a translit-able iconv implementation, try installing "gnu-libiconv" if you\'re using Alpine Linux.', static::class));
- }
- return 1 < \strlen($c) ? ltrim($c, '\'`"^~') : ('' !== $c ? $c : '?');
- }, $s);
- }
- }
- $str->string .= $s;
- return $str;
- }
- public function camel(): parent
- {
- $str = clone $this;
- $str->string = str_replace(' ', '', preg_replace_callback('/\b./u', static function ($m) use (&$i) {
- return 1 === ++$i ? ('İ' === $m[0] ? 'i̇' : mb_strtolower($m[0], 'UTF-8')) : mb_convert_case($m[0], \MB_CASE_TITLE, 'UTF-8');
- }, preg_replace('/[^\pL0-9]++/u', ' ', $this->string)));
- return $str;
- }
- public function codePointsAt(int $offset): array
- {
- $str = $this->slice($offset, 1);
- if ('' === $str->string) {
- return [];
- }
- $codePoints = [];
- foreach (preg_split('//u', $str->string, -1, \PREG_SPLIT_NO_EMPTY) as $c) {
- $codePoints[] = mb_ord($c, 'UTF-8');
- }
- return $codePoints;
- }
- public function folded(bool $compat = true): parent
- {
- $str = clone $this;
- if (!$compat || \PHP_VERSION_ID < 70300 || !\defined('Normalizer::NFKC_CF')) {
- $str->string = normalizer_normalize($str->string, $compat ? \Normalizer::NFKC : \Normalizer::NFC);
- $str->string = mb_strtolower(str_replace(self::FOLD_FROM, self::FOLD_TO, $this->string), 'UTF-8');
- } else {
- $str->string = normalizer_normalize($str->string, \Normalizer::NFKC_CF);
- }
- return $str;
- }
- public function join(array $strings, string $lastGlue = null): parent
- {
- $str = clone $this;
- $tail = null !== $lastGlue && 1 < \count($strings) ? $lastGlue.array_pop($strings) : '';
- $str->string = implode($this->string, $strings).$tail;
- if (!preg_match('//u', $str->string)) {
- throw new InvalidArgumentException('Invalid UTF-8 string.');
- }
- return $str;
- }
- public function lower(): parent
- {
- $str = clone $this;
- $str->string = mb_strtolower(str_replace('İ', 'i̇', $str->string), 'UTF-8');
- return $str;
- }
- public function match(string $regexp, int $flags = 0, int $offset = 0): array
- {
- $match = ((\PREG_PATTERN_ORDER | \PREG_SET_ORDER) & $flags) ? 'preg_match_all' : 'preg_match';
- if ($this->ignoreCase) {
- $regexp .= 'i';
- }
- set_error_handler(static function ($t, $m) { throw new InvalidArgumentException($m); });
- try {
- if (false === $match($regexp.'u', $this->string, $matches, $flags | \PREG_UNMATCHED_AS_NULL, $offset)) {
- $lastError = preg_last_error();
- foreach (get_defined_constants(true)['pcre'] as $k => $v) {
- if ($lastError === $v && '_ERROR' === substr($k, -6)) {
- throw new RuntimeException('Matching failed with '.$k.'.');
- }
- }
- throw new RuntimeException('Matching failed with unknown error code.');
- }
- } finally {
- restore_error_handler();
- }
- return $matches;
- }
- public function normalize(int $form = self::NFC): self
- {
- if (!\in_array($form, [self::NFC, self::NFD, self::NFKC, self::NFKD])) {
- throw new InvalidArgumentException('Unsupported normalization form.');
- }
- $str = clone $this;
- normalizer_is_normalized($str->string, $form) ?: $str->string = normalizer_normalize($str->string, $form);
- return $str;
- }
- public function padBoth(int $length, string $padStr = ' '): parent
- {
- if ('' === $padStr || !preg_match('//u', $padStr)) {
- throw new InvalidArgumentException('Invalid UTF-8 string.');
- }
- $pad = clone $this;
- $pad->string = $padStr;
- return $this->pad($length, $pad, \STR_PAD_BOTH);
- }
- public function padEnd(int $length, string $padStr = ' '): parent
- {
- if ('' === $padStr || !preg_match('//u', $padStr)) {
- throw new InvalidArgumentException('Invalid UTF-8 string.');
- }
- $pad = clone $this;
- $pad->string = $padStr;
- return $this->pad($length, $pad, \STR_PAD_RIGHT);
- }
- public function padStart(int $length, string $padStr = ' '): parent
- {
- if ('' === $padStr || !preg_match('//u', $padStr)) {
- throw new InvalidArgumentException('Invalid UTF-8 string.');
- }
- $pad = clone $this;
- $pad->string = $padStr;
- return $this->pad($length, $pad, \STR_PAD_LEFT);
- }
- public function replaceMatches(string $fromRegexp, $to): parent
- {
- if ($this->ignoreCase) {
- $fromRegexp .= 'i';
- }
- if (\is_array($to) || $to instanceof \Closure) {
- if (!\is_callable($to)) {
- throw new \TypeError(sprintf('Argument 2 passed to "%s::replaceMatches()" must be callable, array given.', static::class));
- }
- $replace = 'preg_replace_callback';
- $to = static function (array $m) use ($to): string {
- $to = $to($m);
- if ('' !== $to && (!\is_string($to) || !preg_match('//u', $to))) {
- throw new InvalidArgumentException('Replace callback must return a valid UTF-8 string.');
- }
- return $to;
- };
- } elseif ('' !== $to && !preg_match('//u', $to)) {
- throw new InvalidArgumentException('Invalid UTF-8 string.');
- } else {
- $replace = 'preg_replace';
- }
- set_error_handler(static function ($t, $m) { throw new InvalidArgumentException($m); });
- try {
- if (null === $string = $replace($fromRegexp.'u', $to, $this->string)) {
- $lastError = preg_last_error();
- foreach (get_defined_constants(true)['pcre'] as $k => $v) {
- if ($lastError === $v && '_ERROR' === substr($k, -6)) {
- throw new RuntimeException('Matching failed with '.$k.'.');
- }
- }
- throw new RuntimeException('Matching failed with unknown error code.');
- }
- } finally {
- restore_error_handler();
- }
- $str = clone $this;
- $str->string = $string;
- return $str;
- }
- public function reverse(): parent
- {
- $str = clone $this;
- $str->string = implode('', array_reverse(preg_split('/(\X)/u', $str->string, -1, \PREG_SPLIT_DELIM_CAPTURE | \PREG_SPLIT_NO_EMPTY)));
- return $str;
- }
- public function snake(): parent
- {
- $str = $this->camel()->title();
- $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');
- return $str;
- }
- public function title(bool $allWords = false): parent
- {
- $str = clone $this;
- $limit = $allWords ? -1 : 1;
- $str->string = preg_replace_callback('/\b./u', static function (array $m): string {
- return mb_convert_case($m[0], \MB_CASE_TITLE, 'UTF-8');
- }, $str->string, $limit);
- return $str;
- }
- public function trim(string $chars = " \t\n\r\0\x0B\x0C\u{A0}\u{FEFF}"): parent
- {
- if (" \t\n\r\0\x0B\x0C\u{A0}\u{FEFF}" !== $chars && !preg_match('//u', $chars)) {
- throw new InvalidArgumentException('Invalid UTF-8 chars.');
- }
- $chars = preg_quote($chars);
- $str = clone $this;
- $str->string = preg_replace("{^[$chars]++|[$chars]++$}uD", '', $str->string);
- return $str;
- }
- public function trimEnd(string $chars = " \t\n\r\0\x0B\x0C\u{A0}\u{FEFF}"): parent
- {
- if (" \t\n\r\0\x0B\x0C\u{A0}\u{FEFF}" !== $chars && !preg_match('//u', $chars)) {
- throw new InvalidArgumentException('Invalid UTF-8 chars.');
- }
- $chars = preg_quote($chars);
- $str = clone $this;
- $str->string = preg_replace("{[$chars]++$}uD", '', $str->string);
- return $str;
- }
- public function trimPrefix($prefix): parent
- {
- if (!$this->ignoreCase) {
- return parent::trimPrefix($prefix);
- }
- $str = clone $this;
- if ($prefix instanceof \Traversable) {
- $prefix = iterator_to_array($prefix, false);
- } elseif ($prefix instanceof parent) {
- $prefix = $prefix->string;
- }
- $prefix = implode('|', array_map('preg_quote', (array) $prefix));
- $str->string = preg_replace("{^(?:$prefix)}iuD", '', $this->string);
- return $str;
- }
- public function trimStart(string $chars = " \t\n\r\0\x0B\x0C\u{A0}\u{FEFF}"): parent
- {
- if (" \t\n\r\0\x0B\x0C\u{A0}\u{FEFF}" !== $chars && !preg_match('//u', $chars)) {
- throw new InvalidArgumentException('Invalid UTF-8 chars.');
- }
- $chars = preg_quote($chars);
- $str = clone $this;
- $str->string = preg_replace("{^[$chars]++}uD", '', $str->string);
- return $str;
- }
- public function trimSuffix($suffix): parent
- {
- if (!$this->ignoreCase) {
- return parent::trimSuffix($suffix);
- }
- $str = clone $this;
- if ($suffix instanceof \Traversable) {
- $suffix = iterator_to_array($suffix, false);
- } elseif ($suffix instanceof parent) {
- $suffix = $suffix->string;
- }
- $suffix = implode('|', array_map('preg_quote', (array) $suffix));
- $str->string = preg_replace("{(?:$suffix)$}iuD", '', $this->string);
- return $str;
- }
- public function upper(): parent
- {
- $str = clone $this;
- $str->string = mb_strtoupper($str->string, 'UTF-8');
- if (\PHP_VERSION_ID < 70300) {
- $str->string = str_replace(self::UPPER_FROM, self::UPPER_TO, $str->string);
- }
- return $str;
- }
- public function width(bool $ignoreAnsiDecoration = true): int
- {
- $width = 0;
- $s = str_replace(["\x00", "\x05", "\x07"], '', $this->string);
- if (false !== strpos($s, "\r")) {
- $s = str_replace(["\r\n", "\r"], "\n", $s);
- }
- if (!$ignoreAnsiDecoration) {
- $s = preg_replace('/[\p{Cc}\x7F]++/u', '', $s);
- }
- foreach (explode("\n", $s) as $s) {
- if ($ignoreAnsiDecoration) {
- $s = preg_replace('/(?:\x1B(?:
- \[ [\x30-\x3F]*+ [\x20-\x2F]*+ [\x40-\x7E]
- | [P\]X^_] .*? \x1B\\\\
- | [\x41-\x7E]
- )|[\p{Cc}\x7F]++)/xu', '', $s);
- }
- $lineWidth = $this->wcswidth($s);
- if ($lineWidth > $width) {
- $width = $lineWidth;
- }
- }
- return $width;
- }
- private function pad(int $len, self $pad, int $type): parent
- {
- $sLen = $this->length();
- if ($len <= $sLen) {
- return clone $this;
- }
- $padLen = $pad->length();
- $freeLen = $len - $sLen;
- $len = $freeLen % $padLen;
- switch ($type) {
- case \STR_PAD_RIGHT:
- return $this->append(str_repeat($pad->string, intdiv($freeLen, $padLen)).($len ? $pad->slice(0, $len) : ''));
- case \STR_PAD_LEFT:
- return $this->prepend(str_repeat($pad->string, intdiv($freeLen, $padLen)).($len ? $pad->slice(0, $len) : ''));
- case \STR_PAD_BOTH:
- $freeLen /= 2;
- $rightLen = ceil($freeLen);
- $len = $rightLen % $padLen;
- $str = $this->append(str_repeat($pad->string, intdiv($rightLen, $padLen)).($len ? $pad->slice(0, $len) : ''));
- $leftLen = floor($freeLen);
- $len = $leftLen % $padLen;
- return $str->prepend(str_repeat($pad->string, intdiv($leftLen, $padLen)).($len ? $pad->slice(0, $len) : ''));
- default:
- throw new InvalidArgumentException('Invalid padding type.');
- }
- }
- private function wcswidth(string $string): int
- {
- $width = 0;
- foreach (preg_split('//u', $string, -1, \PREG_SPLIT_NO_EMPTY) as $c) {
- $codePoint = mb_ord($c, 'UTF-8');
- if (0 === $codePoint
- || 0x034F === $codePoint
- || (0x200B <= $codePoint && 0x200F >= $codePoint)
- || 0x2028 === $codePoint
- || 0x2029 === $codePoint
- || (0x202A <= $codePoint && 0x202E >= $codePoint)
- || (0x2060 <= $codePoint && 0x2063 >= $codePoint)
- ) {
- continue;
- }
- if (32 > $codePoint
- || (0x07F <= $codePoint && 0x0A0 > $codePoint)
- ) {
- return -1;
- }
- if (null === self::$tableZero) {
- self::$tableZero = require __DIR__.'/Resources/data/wcswidth_table_zero.php';
- }
- if ($codePoint >= self::$tableZero[0][0] && $codePoint <= self::$tableZero[$ubound = \count(self::$tableZero) - 1][1]) {
- $lbound = 0;
- while ($ubound >= $lbound) {
- $mid = floor(($lbound + $ubound) / 2);
- if ($codePoint > self::$tableZero[$mid][1]) {
- $lbound = $mid + 1;
- } elseif ($codePoint < self::$tableZero[$mid][0]) {
- $ubound = $mid - 1;
- } else {
- continue 2;
- }
- }
- }
- if (null === self::$tableWide) {
- self::$tableWide = require __DIR__.'/Resources/data/wcswidth_table_wide.php';
- }
- if ($codePoint >= self::$tableWide[0][0] && $codePoint <= self::$tableWide[$ubound = \count(self::$tableWide) - 1][1]) {
- $lbound = 0;
- while ($ubound >= $lbound) {
- $mid = floor(($lbound + $ubound) / 2);
- if ($codePoint > self::$tableWide[$mid][1]) {
- $lbound = $mid + 1;
- } elseif ($codePoint < self::$tableWide[$mid][0]) {
- $ubound = $mid - 1;
- } else {
- $width += 2;
- continue 2;
- }
- }
- }
- ++$width;
- }
- return $width;
- }
- }
- <?php
- namespace Symfony\Component\String;
- use Symfony\Component\String\Exception\ExceptionInterface;
- use Symfony\Component\String\Exception\InvalidArgumentException;
- use Symfony\Component\String\Exception\RuntimeException;
- class ByteString extends AbstractString
- {
- private const ALPHABET_ALPHANUMERIC = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
- public function __construct(string $string = '')
- {
- $this->string = $string;
- }
- public static function fromRandom(int $length = 16, string $alphabet = null): self
- {
- if ($length <= 0) {
- throw new InvalidArgumentException(sprintf('A strictly positive length is expected, "%d" given.', $length));
- }
- $alphabet = $alphabet ?? self::ALPHABET_ALPHANUMERIC;
- $alphabetSize = \strlen($alphabet);
- $bits = (int) ceil(log($alphabetSize, 2.0));
- if ($bits <= 0 || $bits > 56) {
- throw new InvalidArgumentException('The length of the alphabet must in the [2^1, 2^56] range.');
- }
- $ret = '';
- while ($length > 0) {
- $urandomLength = (int) ceil(2 * $length * $bits / 8.0);
- $data = random_bytes($urandomLength);
- $unpackedData = 0;
- $unpackedBits = 0;
- for ($i = 0; $i < $urandomLength && $length > 0; ++$i) {
- $unpackedData = ($unpackedData << 8) | \ord($data[$i]);
- $unpackedBits += 8;
- for (; $unpackedBits >= $bits && $length > 0; $unpackedBits -= $bits) {
- $index = ($unpackedData & ((1 << $bits) - 1));
- $unpackedData >>= $bits;
- if ($index < $alphabetSize) {
- $ret .= $alphabet[$index];
- --$length;
- }
- }
- }
- }
- return new static($ret);
- }
- public function bytesAt(int $offset): array
- {
- $str = $this->string[$offset] ?? '';
- return '' === $str ? [] : [\ord($str)];
- }
- public function append(string ...$suffix): parent
- {
- $str = clone $this;
- $str->string .= 1 >= \count($suffix) ? ($suffix[0] ?? '') : implode('', $suffix);
- return $str;
- }
- public function camel(): parent
- {
- $str = clone $this;
- $str->string = lcfirst(str_replace(' ', '', ucwords(preg_replace('/[^a-zA-Z0-9\x7f-\xff]++/', ' ', $this->string))));
- return $str;
- }
- public function chunk(int $length = 1): array
- {
- if (1 > $length) {
- throw new InvalidArgumentException('The chunk length must be greater than zero.');
- }
- if ('' === $this->string) {
- return [];
- }
- $str = clone $this;
- $chunks = [];
- foreach (str_split($this->string, $length) as $chunk) {
- $str->string = $chunk;
- $chunks[] = clone $str;
- }
- return $chunks;
- }
- public function endsWith($suffix): bool
- {
- if ($suffix instanceof parent) {
- $suffix = $suffix->string;
- } elseif (\is_array($suffix) || $suffix instanceof \Traversable) {
- return parent::endsWith($suffix);
- } else {
- $suffix = (string) $suffix;
- }
- return '' !== $suffix && \strlen($this->string) >= \strlen($suffix) && 0 === substr_compare($this->string, $suffix, -\strlen($suffix), null, $this->ignoreCase);
- }
- public function equalsTo($string): bool
- {
- if ($string instanceof parent) {
- $string = $string->string;
- } elseif (\is_array($string) || $string instanceof \Traversable) {
- return parent::equalsTo($string);
- } else {
- $string = (string) $string;
- }
- if ('' !== $string && $this->ignoreCase) {
- return 0 === strcasecmp($string, $this->string);
- }
- return $string === $this->string;
- }
- public function folded(): parent
- {
- $str = clone $this;
- $str->string = strtolower($str->string);
- return $str;
- }
- public function indexOf($needle, int $offset = 0): ?int
- {
- if ($needle instanceof parent) {
- $needle = $needle->string;
- } elseif (\is_array($needle) || $needle instanceof \Traversable) {
- return parent::indexOf($needle, $offset);
- } else {
- $needle = (string) $needle;
- }
- if ('' === $needle) {
- return null;
- }
- $i = $this->ignoreCase ? stripos($this->string, $needle, $offset) : strpos($this->string, $needle, $offset);
- return false === $i ? null : $i;
- }
- public function indexOfLast($needle, int $offset = 0): ?int
- {
- if ($needle instanceof parent) {
- $needle = $needle->string;
- } elseif (\is_array($needle) || $needle instanceof \Traversable) {
- return parent::indexOfLast($needle, $offset);
- } else {
- $needle = (string) $needle;
- }
- if ('' === $needle) {
- return null;
- }
- $i = $this->ignoreCase ? strripos($this->string, $needle, $offset) : strrpos($this->string, $needle, $offset);
- return false === $i ? null : $i;
- }
- public function isUtf8(): bool
- {
- return '' === $this->string || preg_match('//u', $this->string);
- }
- public function join(array $strings, string $lastGlue = null): parent
- {
- $str = clone $this;
- $tail = null !== $lastGlue && 1 < \count($strings) ? $lastGlue.array_pop($strings) : '';
- $str->string = implode($this->string, $strings).$tail;
- return $str;
- }
- public function length(): int
- {
- return \strlen($this->string);
- }
- public function lower(): parent
- {
- $str = clone $this;
- $str->string = strtolower($str->string);
- return $str;
- }
- public function match(string $regexp, int $flags = 0, int $offset = 0): array
- {
- $match = ((\PREG_PATTERN_ORDER | \PREG_SET_ORDER) & $flags) ? 'preg_match_all' : 'preg_match';
- if ($this->ignoreCase) {
- $regexp .= 'i';
- }
- set_error_handler(static function ($t, $m) { throw new InvalidArgumentException($m); });
- try {
- if (false === $match($regexp, $this->string, $matches, $flags | \PREG_UNMATCHED_AS_NULL, $offset)) {
- $lastError = preg_last_error();
- foreach (get_defined_constants(true)['pcre'] as $k => $v) {
- if ($lastError === $v && '_ERROR' === substr($k, -6)) {
- throw new RuntimeException('Matching failed with '.$k.'.');
- }
- }
- throw new RuntimeException('Matching failed with unknown error code.');
- }
- } finally {
- restore_error_handler();
- }
- return $matches;
- }
- public function padBoth(int $length, string $padStr = ' '): parent
- {
- $str = clone $this;
- $str->string = str_pad($this->string, $length, $padStr, \STR_PAD_BOTH);
- return $str;
- }
- public function padEnd(int $length, string $padStr = ' '): parent
- {
- $str = clone $this;
- $str->string = str_pad($this->string, $length, $padStr, \STR_PAD_RIGHT);
- return $str;
- }
- public function padStart(int $length, string $padStr = ' '): parent
- {
- $str = clone $this;
- $str->string = str_pad($this->string, $length, $padStr, \STR_PAD_LEFT);
- return $str;
- }
- public function prepend(string ...$prefix): parent
- {
- $str = clone $this;
- $str->string = (1 >= \count($prefix) ? ($prefix[0] ?? '') : implode('', $prefix)).$str->string;
- return $str;
- }
- public function replace(string $from, string $to): parent
- {
- $str = clone $this;
- if ('' !== $from) {
- $str->string = $this->ignoreCase ? str_ireplace($from, $to, $this->string) : str_replace($from, $to, $this->string);
- }
- return $str;
- }
- public function replaceMatches(string $fromRegexp, $to): parent
- {
- if ($this->ignoreCase) {
- $fromRegexp .= 'i';
- }
- if (\is_array($to)) {
- if (!\is_callable($to)) {
- throw new \TypeError(sprintf('Argument 2 passed to "%s::replaceMatches()" must be callable, array given.', static::class));
- }
- $replace = 'preg_replace_callback';
- } else {
- $replace = $to instanceof \Closure ? 'preg_replace_callback' : 'preg_replace';
- }
- set_error_handler(static function ($t, $m) { throw new InvalidArgumentException($m); });
- try {
- if (null === $string = $replace($fromRegexp, $to, $this->string)) {
- $lastError = preg_last_error();
- foreach (get_defined_constants(true)['pcre'] as $k => $v) {
- if ($lastError === $v && '_ERROR' === substr($k, -6)) {
- throw new RuntimeException('Matching failed with '.$k.'.');
- }
- }
- throw new RuntimeException('Matching failed with unknown error code.');
- }
- } finally {
- restore_error_handler();
- }
- $str = clone $this;
- $str->string = $string;
- return $str;
- }
- public function reverse(): parent
- {
- $str = clone $this;
- $str->string = strrev($str->string);
- return $str;
- }
- public function slice(int $start = 0, int $length = null): parent
- {
- $str = clone $this;
- $str->string = (string) substr($this->string, $start, $length ?? \PHP_INT_MAX);
- return $str;
- }
- public function snake(): parent
- {
- $str = $this->camel()->title();
- $str->string = strtolower(preg_replace(['/([A-Z]+)([A-Z][a-z])/', '/([a-z\d])([A-Z])/'], '\1_\2', $str->string));
- return $str;
- }
- public function splice(string $replacement, int $start = 0, int $length = null): parent
- {
- $str = clone $this;
- $str->string = substr_replace($this->string, $replacement, $start, $length ?? \PHP_INT_MAX);
- return $str;
- }
- public function split(string $delimiter, int $limit = null, int $flags = null): array
- {
- if (1 > $limit = $limit ?? \PHP_INT_MAX) {
- throw new InvalidArgumentException('Split limit must be a positive integer.');
- }
- if ('' === $delimiter) {
- throw new InvalidArgumentException('Split delimiter is empty.');
- }
- if (null !== $flags) {
- return parent::split($delimiter, $limit, $flags);
- }
- $str = clone $this;
- $chunks = $this->ignoreCase
- ? preg_split('{'.preg_quote($delimiter).'}iD', $this->string, $limit)
- : explode($delimiter, $this->string, $limit);
- foreach ($chunks as &$chunk) {
- $str->string = $chunk;
- $chunk = clone $str;
- }
- return $chunks;
- }
- public function startsWith($prefix): bool
- {
- if ($prefix instanceof parent) {
- $prefix = $prefix->string;
- } elseif (!\is_string($prefix)) {
- return parent::startsWith($prefix);
- }
- return '' !== $prefix && 0 === ($this->ignoreCase ? strncasecmp($this->string, $prefix, \strlen($prefix)) : strncmp($this->string, $prefix, \strlen($prefix)));
- }
- public function title(bool $allWords = false): parent
- {
- $str = clone $this;
- $str->string = $allWords ? ucwords($str->string) : ucfirst($str->string);
- return $str;
- }
- public function toUnicodeString(string $fromEncoding = null): UnicodeString
- {
- return new UnicodeString($this->toCodePointString($fromEncoding)->string);
- }
- public function toCodePointString(string $fromEncoding = null): CodePointString
- {
- $u = new CodePointString();
- if (\in_array($fromEncoding, [null, 'utf8', 'utf-8', 'UTF8', 'UTF-8'], true) && preg_match('//u', $this->string)) {
- $u->string = $this->string;
- return $u;
- }
- set_error_handler(static function ($t, $m) { throw new InvalidArgumentException($m); });
- try {
- try {
- $validEncoding = false !== mb_detect_encoding($this->string, $fromEncoding ?? 'Windows-1252', true);
- } catch (InvalidArgumentException $e) {
- if (!\function_exists('iconv')) {
- throw $e;
- }
- $u->string = iconv($fromEncoding ?? 'Windows-1252', 'UTF-8', $this->string);
- return $u;
- }
- } finally {
- restore_error_handler();
- }
- if (!$validEncoding) {
- throw new InvalidArgumentException(sprintf('Invalid "%s" string.', $fromEncoding ?? 'Windows-1252'));
- }
- $u->string = mb_convert_encoding($this->string, 'UTF-8', $fromEncoding ?? 'Windows-1252');
- return $u;
- }
- public function trim(string $chars = " \t\n\r\0\x0B\x0C"): parent
- {
- $str = clone $this;
- $str->string = trim($str->string, $chars);
- return $str;
- }
- public function trimEnd(string $chars = " \t\n\r\0\x0B\x0C"): parent
- {
- $str = clone $this;
- $str->string = rtrim($str->string, $chars);
- return $str;
- }
- public function trimStart(string $chars = " \t\n\r\0\x0B\x0C"): parent
- {
- $str = clone $this;
- $str->string = ltrim($str->string, $chars);
- return $str;
- }
- public function upper(): parent
- {
- $str = clone $this;
- $str->string = strtoupper($str->string);
- return $str;
- }
- public function width(bool $ignoreAnsiDecoration = true): int
- {
- $string = preg_match('//u', $this->string) ? $this->string : preg_replace('/[\x80-\xFF]/', '?', $this->string);
- return (new CodePointString($string))->width($ignoreAnsiDecoration);
- }
- }
- <?php
- namespace Symfony\Component\String;
- use Symfony\Component\String\Exception\ExceptionInterface;
- use Symfony\Component\String\Exception\InvalidArgumentException;
- class CodePointString extends AbstractUnicodeString
- {
- public function __construct(string $string = '')
- {
- if ('' !== $string && !preg_match('//u', $string)) {
- throw new InvalidArgumentException('Invalid UTF-8 string.');
- }
- $this->string = $string;
- }
- public function append(string ...$suffix): AbstractString
- {
- $str = clone $this;
- $str->string .= 1 >= \count($suffix) ? ($suffix[0] ?? '') : implode('', $suffix);
- if (!preg_match('//u', $str->string)) {
- throw new InvalidArgumentException('Invalid UTF-8 string.');
- }
- return $str;
- }
- public function chunk(int $length = 1): array
- {
- if (1 > $length) {
- throw new InvalidArgumentException('The chunk length must be greater than zero.');
- }
- if ('' === $this->string) {
- return [];
- }
- $rx = '/(';
- while (65535 < $length) {
- $rx .= '.{65535}';
- $length -= 65535;
- }
- $rx .= '.{'.$length.'})/us';
- $str = clone $this;
- $chunks = [];
- foreach (preg_split($rx, $this->string, -1, \PREG_SPLIT_DELIM_CAPTURE | \PREG_SPLIT_NO_EMPTY) as $chunk) {
- $str->string = $chunk;
- $chunks[] = clone $str;
- }
- return $chunks;
- }
- public function codePointsAt(int $offset): array
- {
- $str = $offset ? $this->slice($offset, 1) : $this;
- return '' === $str->string ? [] : [mb_ord($str->string, 'UTF-8')];
- }
- public function endsWith($suffix): bool
- {
- if ($suffix instanceof AbstractString) {
- $suffix = $suffix->string;
- } elseif (\is_array($suffix) || $suffix instanceof \Traversable) {
- return parent::endsWith($suffix);
- } else {
- $suffix = (string) $suffix;
- }
- if ('' === $suffix || !preg_match('//u', $suffix)) {
- return false;
- }
- if ($this->ignoreCase) {
- return preg_match('{'.preg_quote($suffix).'$}iuD', $this->string);
- }
- return \strlen($this->string) >= \strlen($suffix) && 0 === substr_compare($this->string, $suffix, -\strlen($suffix));
- }
- public function equalsTo($string): bool
- {
- if ($string instanceof AbstractString) {
- $string = $string->string;
- } elseif (\is_array($string) || $string instanceof \Traversable) {
- return parent::equalsTo($string);
- } else {
- $string = (string) $string;
- }
- if ('' !== $string && $this->ignoreCase) {
- return \strlen($string) === \strlen($this->string) && 0 === mb_stripos($this->string, $string, 0, 'UTF-8');
- }
- return $string === $this->string;
- }
- public function indexOf($needle, int $offset = 0): ?int
- {
- if ($needle instanceof AbstractString) {
- $needle = $needle->string;
- } elseif (\is_array($needle) || $needle instanceof \Traversable) {
- return parent::indexOf($needle, $offset);
- } else {
- $needle = (string) $needle;
- }
- if ('' === $needle) {
- return null;
- }
- $i = $this->ignoreCase ? mb_stripos($this->string, $needle, $offset, 'UTF-8') : mb_strpos($this->string, $needle, $offset, 'UTF-8');
- return false === $i ? null : $i;
- }
- public function indexOfLast($needle, int $offset = 0): ?int
- {
- if ($needle instanceof AbstractString) {
- $needle = $needle->string;
- } elseif (\is_array($needle) || $needle instanceof \Traversable) {
- return parent::indexOfLast($needle, $offset);
- } else {
- $needle = (string) $needle;
- }
- if ('' === $needle) {
- return null;
- }
- $i = $this->ignoreCase ? mb_strripos($this->string, $needle, $offset, 'UTF-8') : mb_strrpos($this->string, $needle, $offset, 'UTF-8');
- return false === $i ? null : $i;
- }
- public function length(): int
- {
- return mb_strlen($this->string, 'UTF-8');
- }
- public function prepend(string ...$prefix): AbstractString
- {
- $str = clone $this;
- $str->string = (1 >= \count($prefix) ? ($prefix[0] ?? '') : implode('', $prefix)).$this->string;
- if (!preg_match('//u', $str->string)) {
- throw new InvalidArgumentException('Invalid UTF-8 string.');
- }
- return $str;
- }
- public function replace(string $from, string $to): AbstractString
- {
- $str = clone $this;
- if ('' === $from || !preg_match('//u', $from)) {
- return $str;
- }
- if ('' !== $to && !preg_match('//u', $to)) {
- throw new InvalidArgumentException('Invalid UTF-8 string.');
- }
- if ($this->ignoreCase) {
- $str->string = implode($to, preg_split('{'.preg_quote($from).'}iuD', $this->string));
- } else {
- $str->string = str_replace($from, $to, $this->string);
- }
- return $str;
- }
- public function slice(int $start = 0, int $length = null): AbstractString
- {
- $str = clone $this;
- $str->string = mb_substr($this->string, $start, $length, 'UTF-8');
- return $str;
- }
- public function splice(string $replacement, int $start = 0, int $length = null): AbstractString
- {
- if (!preg_match('//u', $replacement)) {
- throw new InvalidArgumentException('Invalid UTF-8 string.');
- }
- $str = clone $this;
- $start = $start ? \strlen(mb_substr($this->string, 0, $start, 'UTF-8')) : 0;
- $length = $length ? \strlen(mb_substr($this->string, $start, $length, 'UTF-8')) : $length;
- $str->string = substr_replace($this->string, $replacement, $start, $length ?? \PHP_INT_MAX);
- return $str;
- }
- public function split(string $delimiter, int $limit = null, int $flags = null): array
- {
- if (1 > $limit = $limit ?? \PHP_INT_MAX) {
- throw new InvalidArgumentException('Split limit must be a positive integer.');
- }
- if ('' === $delimiter) {
- throw new InvalidArgumentException('Split delimiter is empty.');
- }
- if (null !== $flags) {
- return parent::split($delimiter.'u', $limit, $flags);
- }
- if (!preg_match('//u', $delimiter)) {
- throw new InvalidArgumentException('Split delimiter is not a valid UTF-8 string.');
- }
- $str = clone $this;
- $chunks = $this->ignoreCase
- ? preg_split('{'.preg_quote($delimiter).'}iuD', $this->string, $limit)
- : explode($delimiter, $this->string, $limit);
- foreach ($chunks as &$chunk) {
- $str->string = $chunk;
- $chunk = clone $str;
- }
- return $chunks;
- }
- public function startsWith($prefix): bool
- {
- if ($prefix instanceof AbstractString) {
- $prefix = $prefix->string;
- } elseif (\is_array($prefix) || $prefix instanceof \Traversable) {
- return parent::startsWith($prefix);
- } else {
- $prefix = (string) $prefix;
- }
- if ('' === $prefix || !preg_match('//u', $prefix)) {
- return false;
- }
- if ($this->ignoreCase) {
- return 0 === mb_stripos($this->string, $prefix, 0, 'UTF-8');
- }
- return 0 === strncmp($this->string, $prefix, \strlen($prefix));
- }
- }
- <?php
- namespace Symfony\Component\String\Exception;
- interface ExceptionInterface extends \Throwable
- {
- }
- <?php
- namespace Symfony\Component\String\Exception;
- class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
- {
- }
- <?php
- namespace Symfony\Component\String\Exception;
- class RuntimeException extends \RuntimeException implements ExceptionInterface
- {
- }
- <?php
- namespace Symfony\Component\String\Inflector;
- final class EnglishInflector implements InflectorInterface
- {
- private const PLURAL_MAP = [
- ['a', 1, true, true, ['on', 'um']],
- ['ea', 2, true, true, 'a'],
- ['secivres', 8, true, true, 'service'],
- ['eci', 3, false, true, 'ouse'],
- ['esee', 4, false, true, 'oose'],
- ['i', 1, true, true, 'us'],
- ['nem', 3, true, true, 'man'],
- ['nerdlihc', 8, true, true, 'child'],
- ['nexo', 4, false, false, 'ox'],
- ['seci', 4, false, true, ['ex', 'ix', 'ice']],
- ['seifles', 7, true, true, 'selfie'],
- ['seibmoz', 7, true, true, 'zombie'],
- ['seivom', 6, true, true, 'movie'],
- ['sesutcep', 8, true, true, 'pectus'],
- ['teef', 4, true, true, 'foot'],
- ['eseeg', 5, true, true, 'goose'],
- ['hteet', 5, true, true, 'tooth'],
- ['swen', 4, true, true, 'news'],
- ['seires', 6, true, true, 'series'],
- ['sei', 3, false, true, 'y'],
- ['sess', 4, true, false, 'ss'],
- ['ses', 3, true, true, ['s', 'se', 'sis']],
- ['sevit', 5, true, true, 'tive'],
- ['sevird', 6, false, true, 'drive'],
- ['sevi', 4, false, true, 'ife'],
- ['sevom', 5, true, true, 'move'],
- ['sev', 3, true, true, ['f', 've', 'ff']],
- ['sexa', 4, false, false, ['ax', 'axe', 'axis']],
- ['sex', 3, true, false, 'x'],
- ['sezz', 4, true, false, 'z'],
- ['suae', 4, false, true, 'eau'],
- ['see', 3, true, true, 'ee'],
- ['segd', 4, true, true, 'dge'],
- ['se', 2, true, true, ['', 'e']],
- ['s', 1, true, true, ''],
- ['xuae', 4, false, true, 'eau'],
- ['elpoep', 6, true, true, 'person'],
- ];
- private const SINGULAR_MAP = [
- ['airetirc', 8, false, false, 'criterion'],
- ['aluben', 6, false, false, 'nebulae'],
- ['dlihc', 5, true, true, 'children'],
- ['eci', 3, false, true, 'ices'],
- ['ecivres', 7, true, true, 'services'],
- ['efi', 3, false, true, 'ives'],
- ['eifles', 6, true, true, 'selfies'],
- ['eivom', 5, true, true, 'movies'],
- ['esuol', 5, false, true, 'lice'],
- ['esuom', 5, false, true, 'mice'],
- ['esoo', 4, false, true, 'eese'],
- ['es', 2, true, true, 'ses'],
- ['esoog', 5, true, true, 'geese'],
- ['ev', 2, true, true, 'ves'],
- ['evird', 5, false, true, 'drives'],
- ['evit', 4, true, true, 'tives'],
- ['evom', 4, true, true, 'moves'],
- ['ffats', 5, true, true, 'staves'],
- ['ff', 2, true, true, 'ffs'],
- ['f', 1, true, true, ['fs', 'ves']],
- ['hc', 2, true, true, 'ches'],
- ['hs', 2, true, true, 'shes'],
- ['htoot', 5, true, true, 'teeth'],
- ['mu', 2, true, true, 'a'],
- ['nam', 3, true, true, 'men'],
- ['nosrep', 6, true, true, ['persons', 'people']],
- ['noi', 3, true, true, 'ions'],
- ['nop', 3, true, true, 'pons'],
- ['nos', 3, true, true, 'sons'],
- ['no', 2, true, true, 'a'],
- ['ohce', 4, true, true, 'echoes'],
- ['oreh', 4, true, true, 'heroes'],
- ['salta', 5, true, true, 'atlases'],
- ['siri', 4, true, true, 'irises'],
- ['sis', 3, true, true, 'ses'],
- ['ss', 2, true, false, 'sses'],
- ['suballys', 8, true, true, 'syllabi'],
- ['sub', 3, true, true, 'buses'],
- ['suc', 3, true, true, 'cuses'],
- ['sutcep', 6, true, true, 'pectuses'],
- ['su', 2, true, true, 'i'],
- ['swen', 4, true, true, 'news'],
- ['toof', 4, true, true, 'feet'],
- ['uae', 3, false, true, ['eaus', 'eaux']],
- ['xo', 2, false, false, 'oxen'],
- ['xaoh', 4, true, false, 'hoaxes'],
- ['xedni', 5, false, true, ['indicies', 'indexes']],
- ['xo', 2, false, true, 'oxes'],
- ['x', 1, true, false, ['cies', 'xes']],
- ['xi', 2, false, true, 'ices'],
- ['y', 1, false, true, 'ies'],
- ['ziuq', 4, true, false, 'quizzes'],
- ['z', 1, true, true, 'zes'],
- ];
- private const UNINFLECTED = [
- '',
- 'atad',
- 'reed',
- 'kcabdeef',
- 'hsif',
- 'ofni',
- 'esoom',
- 'seires',
- 'peehs',
- 'seiceps',
- ];
- public function singularize(string $plural): array
- {
- $pluralRev = strrev($plural);
- $lowerPluralRev = strtolower($pluralRev);
- $pluralLength = \strlen($lowerPluralRev);
- if (\in_array($lowerPluralRev, self::UNINFLECTED, true)) {
- return [$plural];
- }
- foreach (self::PLURAL_MAP as $map) {
- $suffix = $map[0];
- $suffixLength = $map[1];
- $j = 0;
- while ($suffix[$j] === $lowerPluralRev[$j]) {
- ++$j;
- if ($j === $suffixLength) {
- if ($j < $pluralLength) {
- $nextIsVocal = false !== strpos('aeiou', $lowerPluralRev[$j]);
- if (!$map[2] && $nextIsVocal) {
- break;
- }
- if (!$map[3] && !$nextIsVocal) {
- break;
- }
- }
- $newBase = substr($plural, 0, $pluralLength - $suffixLength);
- $newSuffix = $map[4];
- $firstUpper = ctype_upper($pluralRev[$j - 1]);
- if (\is_array($newSuffix)) {
- $singulars = [];
- foreach ($newSuffix as $newSuffixEntry) {
- $singulars[] = $newBase.($firstUpper ? ucfirst($newSuffixEntry) : $newSuffixEntry);
- }
- return $singulars;
- }
- return [$newBase.($firstUpper ? ucfirst($newSuffix) : $newSuffix)];
- }
- if ($j === $pluralLength) {
- break;
- }
- }
- }
- return [$plural];
- }
- public function pluralize(string $singular): array
- {
- $singularRev = strrev($singular);
- $lowerSingularRev = strtolower($singularRev);
- $singularLength = \strlen($lowerSingularRev);
- if (\in_array($lowerSingularRev, self::UNINFLECTED, true)) {
- return [$singular];
- }
- foreach (self::SINGULAR_MAP as $map) {
- $suffix = $map[0];
- $suffixLength = $map[1];
- $j = 0;
- while ($suffix[$j] === $lowerSingularRev[$j]) {
- ++$j;
- if ($j === $suffixLength) {
- if ($j < $singularLength) {
- $nextIsVocal = false !== strpos('aeiou', $lowerSingularRev[$j]);
- if (!$map[2] && $nextIsVocal) {
- break;
- }
- if (!$map[3] && !$nextIsVocal) {
- break;
- }
- }
- $newBase = substr($singular, 0, $singularLength - $suffixLength);
- $newSuffix = $map[4];
- $firstUpper = ctype_upper($singularRev[$j - 1]);
- if (\is_array($newSuffix)) {
- $plurals = [];
- foreach ($newSuffix as $newSuffixEntry) {
- $plurals[] = $newBase.($firstUpper ? ucfirst($newSuffixEntry) : $newSuffixEntry);
- }
- return $plurals;
- }
- return [$newBase.($firstUpper ? ucfirst($newSuffix) : $newSuffix)];
- }
- if ($j === $singularLength) {
- break;
- }
- }
- }
- return [$singular.'s'];
- }
- }
- <?php
- namespace Symfony\Component\String\Inflector;
- final class FrenchInflector implements InflectorInterface
- {
- private const PLURALIZE_REGEXP = [
- ['/(s|x|z)$/i', '\1'],
- ['/(eau)$/i', '\1x'],
- ['/^(landau)$/i', '\1s'],
- ['/(au)$/i', '\1x'],
- ['/^(pneu|bleu|émeu)$/i', '\1s'],
- ['/(eu)$/i', '\1x'],
- ['/^(bal|carnaval|caracal|chacal|choral|corral|étal|festival|récital|val)$/i', '\1s'],
- ['/al$/i', '\1aux'],
- ['/^(aspir|b|cor|ém|ferm|soupir|trav|vant|vitr)ail$/i', '\1aux'],
- ['/^(bij|caill|ch|gen|hib|jouj|p)ou$/i', '\1oux'],
- ['/^(cinquante|soixante|mille)$/i', '\1'],
- ['/^(mon|ma)(sieur|dame|demoiselle|seigneur)$/', 'mes\2s'],
- ['/^(Mon|Ma)(sieur|dame|demoiselle|seigneur)$/', 'Mes\2s'],
- ];
- private const SINGULARIZE_REGEXP = [
- ['/((aspir|b|cor|ém|ferm|soupir|trav|vant|vitr))aux$/i', '\1ail'],
- ['/(eau)x$/i', '\1'],
- ['/(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'],
- ['/(au)x$/i', '\1'],
- ['/(eu)x$/i', '\1'],
- ['/(bij|caill|ch|gen|hib|jouj|p)oux$/i', '\1ou'],
- ['/^mes(dame|demoiselle)s$/', 'ma\1'],
- ['/^Mes(dame|demoiselle)s$/', 'Ma\1'],
- ['/^mes(sieur|seigneur)s$/', 'mon\1'],
- ['/^Mes(sieur|seigneur)s$/', 'Mon\1'],
- ['/s$/i', ''],
- ];
- 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';
- public function singularize(string $plural): array
- {
- if ($this->isInflectedWord($plural)) {
- return [$plural];
- }
- foreach (self::SINGULARIZE_REGEXP as $rule) {
- [$regexp, $replace] = $rule;
- if (1 === preg_match($regexp, $plural)) {
- return [preg_replace($regexp, $replace, $plural)];
- }
- }
- return [$plural];
- }
- public function pluralize(string $singular): array
- {
- if ($this->isInflectedWord($singular)) {
- return [$singular];
- }
- foreach (self::PLURALIZE_REGEXP as $rule) {
- [$regexp, $replace] = $rule;
- if (1 === preg_match($regexp, $singular)) {
- return [preg_replace($regexp, $replace, $singular)];
- }
- }
- return [$singular.'s'];
- }
- private function isInflectedWord(string $word): bool
- {
- return 1 === preg_match(self::UNINFLECTED, $word);
- }
- }
- <?php
- namespace Symfony\Component\String\Inflector;
- interface InflectorInterface
- {
- public function singularize(string $plural): array;
- public function pluralize(string $singular): array;
- }
- Copyright (c) 2019-2022 Fabien Potencier
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is furnished
- to do so, subject to the following conditions:
- The above copyright notice and this permission notice shall be included in all
- copies or substantial portions of the Software.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
- <?php
- namespace Symfony\Component\String;
- class LazyString implements \Stringable, \JsonSerializable
- {
- private $value;
- public static function fromCallable($callback, ...$arguments): self
- {
- if (!\is_callable($callback) && !(\is_array($callback) && isset($callback[0]) && $callback[0] instanceof \Closure && 2 >= \count($callback))) {
- 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)));
- }
- $lazyString = new static();
- $lazyString->value = static function () use (&$callback, &$arguments, &$value): string {
- if (null !== $arguments) {
- if (!\is_callable($callback)) {
- $callback[0] = $callback[0]();
- $callback[1] = $callback[1] ?? '__invoke';
- }
- $value = $callback(...$arguments);
- $callback = self::getPrettyName($callback);
- $arguments = null;
- }
- return $value ?? '';
- };
- return $lazyString;
- }
- public static function fromStringable($value): self
- {
- if (!self::isStringable($value)) {
- throw new \TypeError(sprintf('Argument 1 passed to "%s()" must be a scalar or a stringable object, "%s" given.', __METHOD__, get_debug_type($value)));
- }
- if (\is_object($value)) {
- return static::fromCallable([$value, '__toString']);
- }
- $lazyString = new static();
- $lazyString->value = (string) $value;
- return $lazyString;
- }
- final public static function isStringable($value): bool
- {
- return \is_string($value) || $value instanceof self || (\is_object($value) ? method_exists($value, '__toString') : \is_scalar($value));
- }
- final public static function resolve($value): string
- {
- return $value;
- }
- public function __toString()
- {
- if (\is_string($this->value)) {
- return $this->value;
- }
- try {
- return $this->value = ($this->value)();
- } catch (\Throwable $e) {
- if (\TypeError::class === \get_class($e) && __FILE__ === $e->getFile()) {
- $type = explode(', ', $e->getMessage());
- $type = substr(array_pop($type), 0, -\strlen(' returned'));
- $r = new \ReflectionFunction($this->value);
- $callback = $r->getStaticVariables()['callback'];
- $e = new \TypeError(sprintf('Return value of %s() passed to %s::fromCallable() must be of the type string, %s returned.', $callback, static::class, $type));
- }
- if (\PHP_VERSION_ID < 70400) {
- return trigger_error($e, \E_USER_ERROR);
- }
- throw $e;
- }
- }
- public function __sleep(): array
- {
- $this->__toString();
- return ['value'];
- }
- public function jsonSerialize(): string
- {
- return $this->__toString();
- }
- private function __construct()
- {
- }
- private static function getPrettyName(callable $callback): string
- {
- if (\is_string($callback)) {
- return $callback;
- }
- if (\is_array($callback)) {
- $class = \is_object($callback[0]) ? get_debug_type($callback[0]) : $callback[0];
- $method = $callback[1];
- } elseif ($callback instanceof \Closure) {
- $r = new \ReflectionFunction($callback);
- if (false !== strpos($r->name, '{closure}') || !$class = $r->getClosureScopeClass()) {
- return $r->name;
- }
- $class = $class->name;
- $method = $r->name;
- } else {
- $class = get_debug_type($callback);
- $method = '__invoke';
- }
- return $class.'::'.$method;
- }
- }
- <?php
- return [
- [
- 4352,
- 4447,
- ],
- [
- 8986,
- 8987,
- ],
- [
- 9001,
- 9001,
- ],
- [
- 9002,
- 9002,
- ],
- [
- 9193,
- 9196,
- ],
- [
- 9200,
- 9200,
- ],
- [
- 9203,
- 9203,
- ],
- [
- 9725,
- 9726,
- ],
- [
- 9748,
- 9749,
- ],
- [
- 9800,
- 9811,
- ],
- [
- 9855,
- 9855,
- ],
- [
- 9875,
- 9875,
- ],
- [
- 9889,
- 9889,
- ],
- [
- 9898,
- 9899,
- ],
- [
- 9917,
- 9918,
- ],
- [
- 9924,
- 9925,
- ],
- [
- 9934,
- 9934,
- ],
- [
- 9940,
- 9940,
- ],
- [
- 9962,
- 9962,
- ],
- [
- 9970,
- 9971,
- ],
- [
- 9973,
- 9973,
- ],
- [
- 9978,
- 9978,
- ],
- [
- 9981,
- 9981,
- ],
- [
- 9989,
- 9989,
- ],
- [
- 9994,
- 9995,
- ],
- [
- 10024,
- 10024,
- ],
- [
- 10060,
- 10060,
- ],
- [
- 10062,
- 10062,
- ],
- [
- 10067,
- 10069,
- ],
- [
- 10071,
- 10071,
- ],
- [
- 10133,
- 10135,
- ],
- [
- 10160,
- 10160,
- ],
- [
- 10175,
- 10175,
- ],
- [
- 11035,
- 11036,
- ],
- [
- 11088,
- 11088,
- ],
- [
- 11093,
- 11093,
- ],
- [
- 11904,
- 11929,
- ],
- [
- 11931,
- 12019,
- ],
- [
- 12032,
- 12245,
- ],
- [
- 12272,
- 12283,
- ],
- [
- 12288,
- 12288,
- ],
- [
- 12289,
- 12291,
- ],
- [
- 12292,
- 12292,
- ],
- [
- 12293,
- 12293,
- ],
- [
- 12294,
- 12294,
- ],
- [
- 12295,
- 12295,
- ],
- [
- 12296,
- 12296,
- ],
- [
- 12297,
- 12297,
- ],
- [
- 12298,
- 12298,
- ],
- [
- 12299,
- 12299,
- ],
- [
- 12300,
- 12300,
- ],
- [
- 12301,
- 12301,
- ],
- [
- 12302,
- 12302,
- ],
- [
- 12303,
- 12303,
- ],
- [
- 12304,
- 12304,
- ],
- [
- 12305,
- 12305,
- ],
- [
- 12306,
- 12307,
- ],
- [
- 12308,
- 12308,
- ],
- [
- 12309,
- 12309,
- ],
- [
- 12310,
- 12310,
- ],
- [
- 12311,
- 12311,
- ],
- [
- 12312,
- 12312,
- ],
- [
- 12313,
- 12313,
- ],
- [
- 12314,
- 12314,
- ],
- [
- 12315,
- 12315,
- ],
- [
- 12316,
- 12316,
- ],
- [
- 12317,
- 12317,
- ],
- [
- 12318,
- 12319,
- ],
- [
- 12320,
- 12320,
- ],
- [
- 12321,
- 12329,
- ],
- [
- 12330,
- 12333,
- ],
- [
- 12334,
- 12335,
- ],
- [
- 12336,
- 12336,
- ],
- [
- 12337,
- 12341,
- ],
- [
- 12342,
- 12343,
- ],
- [
- 12344,
- 12346,
- ],
- [
- 12347,
- 12347,
- ],
- [
- 12348,
- 12348,
- ],
- [
- 12349,
- 12349,
- ],
- [
- 12350,
- 12350,
- ],
- [
- 12353,
- 12438,
- ],
- [
- 12441,
- 12442,
- ],
- [
- 12443,
- 12444,
- ],
- [
- 12445,
- 12446,
- ],
- [
- 12447,
- 12447,
- ],
- [
- 12448,
- 12448,
- ],
- [
- 12449,
- 12538,
- ],
- [
- 12539,
- 12539,
- ],
- [
- 12540,
- 12542,
- ],
- [
- 12543,
- 12543,
- ],
- [
- 12549,
- 12591,
- ],
- [
- 12593,
- 12686,
- ],
- [
- 12688,
- 12689,
- ],
- [
- 12690,
- 12693,
- ],
- [
- 12694,
- 12703,
- ],
- [
- 12704,
- 12735,
- ],
- [
- 12736,
- 12771,
- ],
- [
- 12784,
- 12799,
- ],
- [
- 12800,
- 12830,
- ],
- [
- 12832,
- 12841,
- ],
- [
- 12842,
- 12871,
- ],
- [
- 12880,
- 12880,
- ],
- [
- 12881,
- 12895,
- ],
- [
- 12896,
- 12927,
- ],
- [
- 12928,
- 12937,
- ],
- [
- 12938,
- 12976,
- ],
- [
- 12977,
- 12991,
- ],
- [
- 12992,
- 13055,
- ],
- [
- 13056,
- 13311,
- ],
- [
- 13312,
- 19903,
- ],
- [
- 19968,
- 40959,
- ],
- [
- 40960,
- 40980,
- ],
- [
- 40981,
- 40981,
- ],
- [
- 40982,
- 42124,
- ],
- [
- 42128,
- 42182,
- ],
- [
- 43360,
- 43388,
- ],
- [
- 44032,
- 55203,
- ],
- [
- 63744,
- 64109,
- ],
- [
- 64110,
- 64111,
- ],
- [
- 64112,
- 64217,
- ],
- [
- 64218,
- 64255,
- ],
- [
- 65040,
- 65046,
- ],
- [
- 65047,
- 65047,
- ],
- [
- 65048,
- 65048,
- ],
- [
- 65049,
- 65049,
- ],
- [
- 65072,
- 65072,
- ],
- [
- 65073,
- 65074,
- ],
- [
- 65075,
- 65076,
- ],
- [
- 65077,
- 65077,
- ],
- [
- 65078,
- 65078,
- ],
- [
- 65079,
- 65079,
- ],
- [
- 65080,
- 65080,
- ],
- [
- 65081,
- 65081,
- ],
- [
- 65082,
- 65082,
- ],
- [
- 65083,
- 65083,
- ],
- [
- 65084,
- 65084,
- ],
- [
- 65085,
- 65085,
- ],
- [
- 65086,
- 65086,
- ],
- [
- 65087,
- 65087,
- ],
- [
- 65088,
- 65088,
- ],
- [
- 65089,
- 65089,
- ],
- [
- 65090,
- 65090,
- ],
- [
- 65091,
- 65091,
- ],
- [
- 65092,
- 65092,
- ],
- [
- 65093,
- 65094,
- ],
- [
- 65095,
- 65095,
- ],
- [
- 65096,
- 65096,
- ],
- [
- 65097,
- 65100,
- ],
- [
- 65101,
- 65103,
- ],
- [
- 65104,
- 65106,
- ],
- [
- 65108,
- 65111,
- ],
- [
- 65112,
- 65112,
- ],
- [
- 65113,
- 65113,
- ],
- [
- 65114,
- 65114,
- ],
- [
- 65115,
- 65115,
- ],
- [
- 65116,
- 65116,
- ],
- [
- 65117,
- 65117,
- ],
- [
- 65118,
- 65118,
- ],
- [
- 65119,
- 65121,
- ],
- [
- 65122,
- 65122,
- ],
- [
- 65123,
- 65123,
- ],
- [
- 65124,
- 65126,
- ],
- [
- 65128,
- 65128,
- ],
- [
- 65129,
- 65129,
- ],
- [
- 65130,
- 65131,
- ],
- [
- 65281,
- 65283,
- ],
- [
- 65284,
- 65284,
- ],
- [
- 65285,
- 65287,
- ],
- [
- 65288,
- 65288,
- ],
- [
- 65289,
- 65289,
- ],
- [
- 65290,
- 65290,
- ],
- [
- 65291,
- 65291,
- ],
- [
- 65292,
- 65292,
- ],
- [
- 65293,
- 65293,
- ],
- [
- 65294,
- 65295,
- ],
- [
- 65296,
- 65305,
- ],
- [
- 65306,
- 65307,
- ],
- [
- 65308,
- 65310,
- ],
- [
- 65311,
- 65312,
- ],
- [
- 65313,
- 65338,
- ],
- [
- 65339,
- 65339,
- ],
- [
- 65340,
- 65340,
- ],
- [
- 65341,
- 65341,
- ],
- [
- 65342,
- 65342,
- ],
- [
- 65343,
- 65343,
- ],
- [
- 65344,
- 65344,
- ],
- [
- 65345,
- 65370,
- ],
- [
- 65371,
- 65371,
- ],
- [
- 65372,
- 65372,
- ],
- [
- 65373,
- 65373,
- ],
- [
- 65374,
- 65374,
- ],
- [
- 65375,
- 65375,
- ],
- [
- 65376,
- 65376,
- ],
- [
- 65504,
- 65505,
- ],
- [
- 65506,
- 65506,
- ],
- [
- 65507,
- 65507,
- ],
- [
- 65508,
- 65508,
- ],
- [
- 65509,
- 65510,
- ],
- [
- 94176,
- 94177,
- ],
- [
- 94178,
- 94178,
- ],
- [
- 94179,
- 94179,
- ],
- [
- 94180,
- 94180,
- ],
- [
- 94192,
- 94193,
- ],
- [
- 94208,
- 100343,
- ],
- [
- 100352,
- 101119,
- ],
- [
- 101120,
- 101589,
- ],
- [
- 101632,
- 101640,
- ],
- [
- 110576,
- 110579,
- ],
- [
- 110581,
- 110587,
- ],
- [
- 110589,
- 110590,
- ],
- [
- 110592,
- 110847,
- ],
- [
- 110848,
- 110882,
- ],
- [
- 110928,
- 110930,
- ],
- [
- 110948,
- 110951,
- ],
- [
- 110960,
- 111355,
- ],
- [
- 126980,
- 126980,
- ],
- [
- 127183,
- 127183,
- ],
- [
- 127374,
- 127374,
- ],
- [
- 127377,
- 127386,
- ],
- [
- 127488,
- 127490,
- ],
- [
- 127504,
- 127547,
- ],
- [
- 127552,
- 127560,
- ],
- [
- 127568,
- 127569,
- ],
- [
- 127584,
- 127589,
- ],
- [
- 127744,
- 127776,
- ],
- [
- 127789,
- 127797,
- ],
- [
- 127799,
- 127868,
- ],
- [
- 127870,
- 127891,
- ],
- [
- 127904,
- 127946,
- ],
- [
- 127951,
- 127955,
- ],
- [
- 127968,
- 127984,
- ],
- [
- 127988,
- 127988,
- ],
- [
- 127992,
- 127994,
- ],
- [
- 127995,
- 127999,
- ],
- [
- 128000,
- 128062,
- ],
- [
- 128064,
- 128064,
- ],
- [
- 128066,
- 128252,
- ],
- [
- 128255,
- 128317,
- ],
- [
- 128331,
- 128334,
- ],
- [
- 128336,
- 128359,
- ],
- [
- 128378,
- 128378,
- ],
- [
- 128405,
- 128406,
- ],
- [
- 128420,
- 128420,
- ],
- [
- 128507,
- 128511,
- ],
- [
- 128512,
- 128591,
- ],
- [
- 128640,
- 128709,
- ],
- [
- 128716,
- 128716,
- ],
- [
- 128720,
- 128722,
- ],
- [
- 128725,
- 128727,
- ],
- [
- 128733,
- 128735,
- ],
- [
- 128747,
- 128748,
- ],
- [
- 128756,
- 128764,
- ],
- [
- 128992,
- 129003,
- ],
- [
- 129008,
- 129008,
- ],
- [
- 129292,
- 129338,
- ],
- [
- 129340,
- 129349,
- ],
- [
- 129351,
- 129535,
- ],
- [
- 129648,
- 129652,
- ],
- [
- 129656,
- 129660,
- ],
- [
- 129664,
- 129670,
- ],
- [
- 129680,
- 129708,
- ],
- [
- 129712,
- 129722,
- ],
- [
- 129728,
- 129733,
- ],
- [
- 129744,
- 129753,
- ],
- [
- 129760,
- 129767,
- ],
- [
- 129776,
- 129782,
- ],
- [
- 131072,
- 173791,
- ],
- [
- 173792,
- 173823,
- ],
- [
- 173824,
- 177976,
- ],
- [
- 177977,
- 177983,
- ],
- [
- 177984,
- 178205,
- ],
- [
- 178206,
- 178207,
- ],
- [
- 178208,
- 183969,
- ],
- [
- 183970,
- 183983,
- ],
- [
- 183984,
- 191456,
- ],
- [
- 191457,
- 194559,
- ],
- [
- 194560,
- 195101,
- ],
- [
- 195102,
- 195103,
- ],
- [
- 195104,
- 196605,
- ],
- [
- 196608,
- 201546,
- ],
- [
- 201547,
- 262141,
- ],
- ];
- <?php
- return [
- [
- 768,
- 879,
- ],
- [
- 1155,
- 1159,
- ],
- [
- 1160,
- 1161,
- ],
- [
- 1425,
- 1469,
- ],
- [
- 1471,
- 1471,
- ],
- [
- 1473,
- 1474,
- ],
- [
- 1476,
- 1477,
- ],
- [
- 1479,
- 1479,
- ],
- [
- 1552,
- 1562,
- ],
- [
- 1611,
- 1631,
- ],
- [
- 1648,
- 1648,
- ],
- [
- 1750,
- 1756,
- ],
- [
- 1759,
- 1764,
- ],
- [
- 1767,
- 1768,
- ],
- [
- 1770,
- 1773,
- ],
- [
- 1809,
- 1809,
- ],
- [
- 1840,
- 1866,
- ],
- [
- 1958,
- 1968,
- ],
- [
- 2027,
- 2035,
- ],
- [
- 2045,
- 2045,
- ],
- [
- 2070,
- 2073,
- ],
- [
- 2075,
- 2083,
- ],
- [
- 2085,
- 2087,
- ],
- [
- 2089,
- 2093,
- ],
- [
- 2137,
- 2139,
- ],
- [
- 2200,
- 2207,
- ],
- [
- 2250,
- 2273,
- ],
- [
- 2275,
- 2306,
- ],
- [
- 2362,
- 2362,
- ],
- [
- 2364,
- 2364,
- ],
- [
- 2369,
- 2376,
- ],
- [
- 2381,
- 2381,
- ],
- [
- 2385,
- 2391,
- ],
- [
- 2402,
- 2403,
- ],
- [
- 2433,
- 2433,
- ],
- [
- 2492,
- 2492,
- ],
- [
- 2497,
- 2500,
- ],
- [
- 2509,
- 2509,
- ],
- [
- 2530,
- 2531,
- ],
- [
- 2558,
- 2558,
- ],
- [
- 2561,
- 2562,
- ],
- [
- 2620,
- 2620,
- ],
- [
- 2625,
- 2626,
- ],
- [
- 2631,
- 2632,
- ],
- [
- 2635,
- 2637,
- ],
- [
- 2641,
- 2641,
- ],
- [
- 2672,
- 2673,
- ],
- [
- 2677,
- 2677,
- ],
- [
- 2689,
- 2690,
- ],
- [
- 2748,
- 2748,
- ],
- [
- 2753,
- 2757,
- ],
- [
- 2759,
- 2760,
- ],
- [
- 2765,
- 2765,
- ],
- [
- 2786,
- 2787,
- ],
- [
- 2810,
- 2815,
- ],
- [
- 2817,
- 2817,
- ],
- [
- 2876,
- 2876,
- ],
- [
- 2879,
- 2879,
- ],
- [
- 2881,
- 2884,
- ],
- [
- 2893,
- 2893,
- ],
- [
- 2901,
- 2902,
- ],
- [
- 2914,
- 2915,
- ],
- [
- 2946,
- 2946,
- ],
- [
- 3008,
- 3008,
- ],
- [
- 3021,
- 3021,
- ],
- [
- 3072,
- 3072,
- ],
- [
- 3076,
- 3076,
- ],
- [
- 3132,
- 3132,
- ],
- [
- 3134,
- 3136,
- ],
- [
- 3142,
- 3144,
- ],
- [
- 3146,
- 3149,
- ],
- [
- 3157,
- 3158,
- ],
- [
- 3170,
- 3171,
- ],
- [
- 3201,
- 3201,
- ],
- [
- 3260,
- 3260,
- ],
- [
- 3263,
- 3263,
- ],
- [
- 3270,
- 3270,
- ],
- [
- 3276,
- 3277,
- ],
- [
- 3298,
- 3299,
- ],
- [
- 3328,
- 3329,
- ],
- [
- 3387,
- 3388,
- ],
- [
- 3393,
- 3396,
- ],
- [
- 3405,
- 3405,
- ],
- [
- 3426,
- 3427,
- ],
- [
- 3457,
- 3457,
- ],
- [
- 3530,
- 3530,
- ],
- [
- 3538,
- 3540,
- ],
- [
- 3542,
- 3542,
- ],
- [
- 3633,
- 3633,
- ],
- [
- 3636,
- 3642,
- ],
- [
- 3655,
- 3662,
- ],
- [
- 3761,
- 3761,
- ],
- [
- 3764,
- 3772,
- ],
- [
- 3784,
- 3789,
- ],
- [
- 3864,
- 3865,
- ],
- [
- 3893,
- 3893,
- ],
- [
- 3895,
- 3895,
- ],
- [
- 3897,
- 3897,
- ],
- [
- 3953,
- 3966,
- ],
- [
- 3968,
- 3972,
- ],
- [
- 3974,
- 3975,
- ],
- [
- 3981,
- 3991,
- ],
- [
- 3993,
- 4028,
- ],
- [
- 4038,
- 4038,
- ],
- [
- 4141,
- 4144,
- ],
- [
- 4146,
- 4151,
- ],
- [
- 4153,
- 4154,
- ],
- [
- 4157,
- 4158,
- ],
- [
- 4184,
- 4185,
- ],
- [
- 4190,
- 4192,
- ],
- [
- 4209,
- 4212,
- ],
- [
- 4226,
- 4226,
- ],
- [
- 4229,
- 4230,
- ],
- [
- 4237,
- 4237,
- ],
- [
- 4253,
- 4253,
- ],
- [
- 4957,
- 4959,
- ],
- [
- 5906,
- 5908,
- ],
- [
- 5938,
- 5939,
- ],
- [
- 5970,
- 5971,
- ],
- [
- 6002,
- 6003,
- ],
- [
- 6068,
- 6069,
- ],
- [
- 6071,
- 6077,
- ],
- [
- 6086,
- 6086,
- ],
- [
- 6089,
- 6099,
- ],
- [
- 6109,
- 6109,
- ],
- [
- 6155,
- 6157,
- ],
- [
- 6159,
- 6159,
- ],
- [
- 6277,
- 6278,
- ],
- [
- 6313,
- 6313,
- ],
- [
- 6432,
- 6434,
- ],
- [
- 6439,
- 6440,
- ],
- [
- 6450,
- 6450,
- ],
- [
- 6457,
- 6459,
- ],
- [
- 6679,
- 6680,
- ],
- [
- 6683,
- 6683,
- ],
- [
- 6742,
- 6742,
- ],
- [
- 6744,
- 6750,
- ],
- [
- 6752,
- 6752,
- ],
- [
- 6754,
- 6754,
- ],
- [
- 6757,
- 6764,
- ],
- [
- 6771,
- 6780,
- ],
- [
- 6783,
- 6783,
- ],
- [
- 6832,
- 6845,
- ],
- [
- 6846,
- 6846,
- ],
- [
- 6847,
- 6862,
- ],
- [
- 6912,
- 6915,
- ],
- [
- 6964,
- 6964,
- ],
- [
- 6966,
- 6970,
- ],
- [
- 6972,
- 6972,
- ],
- [
- 6978,
- 6978,
- ],
- [
- 7019,
- 7027,
- ],
- [
- 7040,
- 7041,
- ],
- [
- 7074,
- 7077,
- ],
- [
- 7080,
- 7081,
- ],
- [
- 7083,
- 7085,
- ],
- [
- 7142,
- 7142,
- ],
- [
- 7144,
- 7145,
- ],
- [
- 7149,
- 7149,
- ],
- [
- 7151,
- 7153,
- ],
- [
- 7212,
- 7219,
- ],
- [
- 7222,
- 7223,
- ],
- [
- 7376,
- 7378,
- ],
- [
- 7380,
- 7392,
- ],
- [
- 7394,
- 7400,
- ],
- [
- 7405,
- 7405,
- ],
- [
- 7412,
- 7412,
- ],
- [
- 7416,
- 7417,
- ],
- [
- 7616,
- 7679,
- ],
- [
- 8400,
- 8412,
- ],
- [
- 8413,
- 8416,
- ],
- [
- 8417,
- 8417,
- ],
- [
- 8418,
- 8420,
- ],
- [
- 8421,
- 8432,
- ],
- [
- 11503,
- 11505,
- ],
- [
- 11647,
- 11647,
- ],
- [
- 11744,
- 11775,
- ],
- [
- 12330,
- 12333,
- ],
- [
- 12441,
- 12442,
- ],
- [
- 42607,
- 42607,
- ],
- [
- 42608,
- 42610,
- ],
- [
- 42612,
- 42621,
- ],
- [
- 42654,
- 42655,
- ],
- [
- 42736,
- 42737,
- ],
- [
- 43010,
- 43010,
- ],
- [
- 43014,
- 43014,
- ],
- [
- 43019,
- 43019,
- ],
- [
- 43045,
- 43046,
- ],
- [
- 43052,
- 43052,
- ],
- [
- 43204,
- 43205,
- ],
- [
- 43232,
- 43249,
- ],
- [
- 43263,
- 43263,
- ],
- [
- 43302,
- 43309,
- ],
- [
- 43335,
- 43345,
- ],
- [
- 43392,
- 43394,
- ],
- [
- 43443,
- 43443,
- ],
- [
- 43446,
- 43449,
- ],
- [
- 43452,
- 43453,
- ],
- [
- 43493,
- 43493,
- ],
- [
- 43561,
- 43566,
- ],
- [
- 43569,
- 43570,
- ],
- [
- 43573,
- 43574,
- ],
- [
- 43587,
- 43587,
- ],
- [
- 43596,
- 43596,
- ],
- [
- 43644,
- 43644,
- ],
- [
- 43696,
- 43696,
- ],
- [
- 43698,
- 43700,
- ],
- [
- 43703,
- 43704,
- ],
- [
- 43710,
- 43711,
- ],
- [
- 43713,
- 43713,
- ],
- [
- 43756,
- 43757,
- ],
- [
- 43766,
- 43766,
- ],
- [
- 44005,
- 44005,
- ],
- [
- 44008,
- 44008,
- ],
- [
- 44013,
- 44013,
- ],
- [
- 64286,
- 64286,
- ],
- [
- 65024,
- 65039,
- ],
- [
- 65056,
- 65071,
- ],
- [
- 66045,
- 66045,
- ],
- [
- 66272,
- 66272,
- ],
- [
- 66422,
- 66426,
- ],
- [
- 68097,
- 68099,
- ],
- [
- 68101,
- 68102,
- ],
- [
- 68108,
- 68111,
- ],
- [
- 68152,
- 68154,
- ],
- [
- 68159,
- 68159,
- ],
- [
- 68325,
- 68326,
- ],
- [
- 68900,
- 68903,
- ],
- [
- 69291,
- 69292,
- ],
- [
- 69446,
- 69456,
- ],
- [
- 69506,
- 69509,
- ],
- [
- 69633,
- 69633,
- ],
- [
- 69688,
- 69702,
- ],
- [
- 69744,
- 69744,
- ],
- [
- 69747,
- 69748,
- ],
- [
- 69759,
- 69761,
- ],
- [
- 69811,
- 69814,
- ],
- [
- 69817,
- 69818,
- ],
- [
- 69826,
- 69826,
- ],
- [
- 69888,
- 69890,
- ],
- [
- 69927,
- 69931,
- ],
- [
- 69933,
- 69940,
- ],
- [
- 70003,
- 70003,
- ],
- [
- 70016,
- 70017,
- ],
- [
- 70070,
- 70078,
- ],
- [
- 70089,
- 70092,
- ],
- [
- 70095,
- 70095,
- ],
- [
- 70191,
- 70193,
- ],
- [
- 70196,
- 70196,
- ],
- [
- 70198,
- 70199,
- ],
- [
- 70206,
- 70206,
- ],
- [
- 70367,
- 70367,
- ],
- [
- 70371,
- 70378,
- ],
- [
- 70400,
- 70401,
- ],
- [
- 70459,
- 70460,
- ],
- [
- 70464,
- 70464,
- ],
- [
- 70502,
- 70508,
- ],
- [
- 70512,
- 70516,
- ],
- [
- 70712,
- 70719,
- ],
- [
- 70722,
- 70724,
- ],
- [
- 70726,
- 70726,
- ],
- [
- 70750,
- 70750,
- ],
- [
- 70835,
- 70840,
- ],
- [
- 70842,
- 70842,
- ],
- [
- 70847,
- 70848,
- ],
- [
- 70850,
- 70851,
- ],
- [
- 71090,
- 71093,
- ],
- [
- 71100,
- 71101,
- ],
- [
- 71103,
- 71104,
- ],
- [
- 71132,
- 71133,
- ],
- [
- 71219,
- 71226,
- ],
- [
- 71229,
- 71229,
- ],
- [
- 71231,
- 71232,
- ],
- [
- 71339,
- 71339,
- ],
- [
- 71341,
- 71341,
- ],
- [
- 71344,
- 71349,
- ],
- [
- 71351,
- 71351,
- ],
- [
- 71453,
- 71455,
- ],
- [
- 71458,
- 71461,
- ],
- [
- 71463,
- 71467,
- ],
- [
- 71727,
- 71735,
- ],
- [
- 71737,
- 71738,
- ],
- [
- 71995,
- 71996,
- ],
- [
- 71998,
- 71998,
- ],
- [
- 72003,
- 72003,
- ],
- [
- 72148,
- 72151,
- ],
- [
- 72154,
- 72155,
- ],
- [
- 72160,
- 72160,
- ],
- [
- 72193,
- 72202,
- ],
- [
- 72243,
- 72248,
- ],
- [
- 72251,
- 72254,
- ],
- [
- 72263,
- 72263,
- ],
- [
- 72273,
- 72278,
- ],
- [
- 72281,
- 72283,
- ],
- [
- 72330,
- 72342,
- ],
- [
- 72344,
- 72345,
- ],
- [
- 72752,
- 72758,
- ],
- [
- 72760,
- 72765,
- ],
- [
- 72767,
- 72767,
- ],
- [
- 72850,
- 72871,
- ],
- [
- 72874,
- 72880,
- ],
- [
- 72882,
- 72883,
- ],
- [
- 72885,
- 72886,
- ],
- [
- 73009,
- 73014,
- ],
- [
- 73018,
- 73018,
- ],
- [
- 73020,
- 73021,
- ],
- [
- 73023,
- 73029,
- ],
- [
- 73031,
- 73031,
- ],
- [
- 73104,
- 73105,
- ],
- [
- 73109,
- 73109,
- ],
- [
- 73111,
- 73111,
- ],
- [
- 73459,
- 73460,
- ],
- [
- 92912,
- 92916,
- ],
- [
- 92976,
- 92982,
- ],
- [
- 94031,
- 94031,
- ],
- [
- 94095,
- 94098,
- ],
- [
- 94180,
- 94180,
- ],
- [
- 113821,
- 113822,
- ],
- [
- 118528,
- 118573,
- ],
- [
- 118576,
- 118598,
- ],
- [
- 119143,
- 119145,
- ],
- [
- 119163,
- 119170,
- ],
- [
- 119173,
- 119179,
- ],
- [
- 119210,
- 119213,
- ],
- [
- 119362,
- 119364,
- ],
- [
- 121344,
- 121398,
- ],
- [
- 121403,
- 121452,
- ],
- [
- 121461,
- 121461,
- ],
- [
- 121476,
- 121476,
- ],
- [
- 121499,
- 121503,
- ],
- [
- 121505,
- 121519,
- ],
- [
- 122880,
- 122886,
- ],
- [
- 122888,
- 122904,
- ],
- [
- 122907,
- 122913,
- ],
- [
- 122915,
- 122916,
- ],
- [
- 122918,
- 122922,
- ],
- [
- 123184,
- 123190,
- ],
- [
- 123566,
- 123566,
- ],
- [
- 123628,
- 123631,
- ],
- [
- 125136,
- 125142,
- ],
- [
- 125252,
- 125258,
- ],
- [
- 917760,
- 917999,
- ],
- ];
- <?php
- namespace Symfony\Component\String;
- if (!\function_exists(u::class)) {
- function u(?string $string = ''): UnicodeString
- {
- return new UnicodeString($string ?? '');
- }
- }
- if (!\function_exists(b::class)) {
- function b(?string $string = ''): ByteString
- {
- return new ByteString($string ?? '');
- }
- }
- if (!\function_exists(s::class)) {
- function s(?string $string = ''): AbstractString
- {
- $string = $string ?? '';
- return preg_match('//u', $string) ? new UnicodeString($string) : new ByteString($string);
- }
- }
- <?php
- namespace Symfony\Component\String\Slugger;
- use Symfony\Component\String\AbstractUnicodeString;
- use Symfony\Component\String\UnicodeString;
- use Symfony\Contracts\Translation\LocaleAwareInterface;
- if (!interface_exists(LocaleAwareInterface::class)) {
- 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".');
- }
- class AsciiSlugger implements SluggerInterface, LocaleAwareInterface
- {
- private const LOCALE_TO_TRANSLITERATOR_ID = [
- 'am' => 'Amharic-Latin',
- 'ar' => 'Arabic-Latin',
- 'az' => 'Azerbaijani-Latin',
- 'be' => 'Belarusian-Latin',
- 'bg' => 'Bulgarian-Latin',
- 'bn' => 'Bengali-Latin',
- 'de' => 'de-ASCII',
- 'el' => 'Greek-Latin',
- 'fa' => 'Persian-Latin',
- 'he' => 'Hebrew-Latin',
- 'hy' => 'Armenian-Latin',
- 'ka' => 'Georgian-Latin',
- 'kk' => 'Kazakh-Latin',
- 'ky' => 'Kirghiz-Latin',
- 'ko' => 'Korean-Latin',
- 'mk' => 'Macedonian-Latin',
- 'mn' => 'Mongolian-Latin',
- 'or' => 'Oriya-Latin',
- 'ps' => 'Pashto-Latin',
- 'ru' => 'Russian-Latin',
- 'sr' => 'Serbian-Latin',
- 'sr_Cyrl' => 'Serbian-Latin',
- 'th' => 'Thai-Latin',
- 'tk' => 'Turkmen-Latin',
- 'uk' => 'Ukrainian-Latin',
- 'uz' => 'Uzbek-Latin',
- 'zh' => 'Han-Latin',
- ];
- private $defaultLocale;
- private $symbolsMap = [
- 'en' => ['@' => 'at', '&' => 'and'],
- ];
- private $transliterators = [];
- public function __construct(string $defaultLocale = null, $symbolsMap = null)
- {
- if (null !== $symbolsMap && !\is_array($symbolsMap) && !$symbolsMap instanceof \Closure) {
- throw new \TypeError(sprintf('Argument 2 passed to "%s()" must be array, Closure or null, "%s" given.', __METHOD__, \gettype($symbolsMap)));
- }
- $this->defaultLocale = $defaultLocale;
- $this->symbolsMap = $symbolsMap ?? $this->symbolsMap;
- }
- public function setLocale($locale)
- {
- $this->defaultLocale = $locale;
- }
- public function getLocale()
- {
- return $this->defaultLocale;
- }
- public function slug(string $string, string $separator = '-', string $locale = null): AbstractUnicodeString
- {
- $locale = $locale ?? $this->defaultLocale;
- $transliterator = [];
- if ($locale && ('de' === $locale || 0 === strpos($locale, 'de_'))) {
- $transliterator = ['de-ASCII'];
- } elseif (\function_exists('transliterator_transliterate') && $locale) {
- $transliterator = (array) $this->createTransliterator($locale);
- }
- if ($this->symbolsMap instanceof \Closure) {
- $symbolsMap = $this->symbolsMap;
- array_unshift($transliterator, static function ($s) use ($symbolsMap, $locale) {
- return $symbolsMap($s, $locale);
- });
- }
- $unicodeString = (new UnicodeString($string))->ascii($transliterator);
- if (\is_array($this->symbolsMap)) {
- $map = null;
- if (isset($this->symbolsMap[$locale])) {
- $map = $this->symbolsMap[$locale];
- } else {
- $parent = self::getParentLocale($locale);
- if ($parent && isset($this->symbolsMap[$parent])) {
- $map = $this->symbolsMap[$parent];
- }
- }
- if ($map) {
- foreach ($map as $char => $replace) {
- $unicodeString = $unicodeString->replace($char, ' '.$replace.' ');
- }
- }
- }
- return $unicodeString
- ->replaceMatches('/[^A-Za-z0-9]++/', $separator)
- ->trim($separator)
- ;
- }
- private function createTransliterator(string $locale): ?\Transliterator
- {
- if (\array_key_exists($locale, $this->transliterators)) {
- return $this->transliterators[$locale];
- }
- if ($id = self::LOCALE_TO_TRANSLITERATOR_ID[$locale] ?? null) {
- return $this->transliterators[$locale] = \Transliterator::create($id.'/BGN') ?? \Transliterator::create($id);
- }
- if (!$parent = self::getParentLocale($locale)) {
- return $this->transliterators[$locale] = null;
- }
- if ($id = self::LOCALE_TO_TRANSLITERATOR_ID[$parent] ?? null) {
- $transliterator = \Transliterator::create($id.'/BGN') ?? \Transliterator::create($id);
- }
- return $this->transliterators[$locale] = $this->transliterators[$parent] = $transliterator ?? null;
- }
- private static function getParentLocale(?string $locale): ?string
- {
- if (!$locale) {
- return null;
- }
- if (false === $str = strrchr($locale, '_')) {
- return null;
- }
- return substr($locale, 0, -\strlen($str));
- }
- }
- <?php
- namespace Symfony\Component\String\Slugger;
- use Symfony\Component\String\AbstractUnicodeString;
- interface SluggerInterface
- {
- public function slug(string $string, string $separator = '-', string $locale = null): AbstractUnicodeString;
- }
- <?php
- namespace Symfony\Component\String;
- use Symfony\Component\String\Exception\ExceptionInterface;
- use Symfony\Component\String\Exception\InvalidArgumentException;
- class UnicodeString extends AbstractUnicodeString
- {
- public function __construct(string $string = '')
- {
- $this->string = normalizer_is_normalized($string) ? $string : normalizer_normalize($string);
- if (false === $this->string) {
- throw new InvalidArgumentException('Invalid UTF-8 string.');
- }
- }
- public function append(string ...$suffix): AbstractString
- {
- $str = clone $this;
- $str->string = $this->string.(1 >= \count($suffix) ? ($suffix[0] ?? '') : implode('', $suffix));
- normalizer_is_normalized($str->string) ?: $str->string = normalizer_normalize($str->string);
- if (false === $str->string) {
- throw new InvalidArgumentException('Invalid UTF-8 string.');
- }
- return $str;
- }
- public function chunk(int $length = 1): array
- {
- if (1 > $length) {
- throw new InvalidArgumentException('The chunk length must be greater than zero.');
- }
- if ('' === $this->string) {
- return [];
- }
- $rx = '/(';
- while (65535 < $length) {
- $rx .= '\X{65535}';
- $length -= 65535;
- }
- $rx .= '\X{'.$length.'})/u';
- $str = clone $this;
- $chunks = [];
- foreach (preg_split($rx, $this->string, -1, \PREG_SPLIT_DELIM_CAPTURE | \PREG_SPLIT_NO_EMPTY) as $chunk) {
- $str->string = $chunk;
- $chunks[] = clone $str;
- }
- return $chunks;
- }
- public function endsWith($suffix): bool
- {
- if ($suffix instanceof AbstractString) {
- $suffix = $suffix->string;
- } elseif (\is_array($suffix) || $suffix instanceof \Traversable) {
- return parent::endsWith($suffix);
- } else {
- $suffix = (string) $suffix;
- }
- $form = null === $this->ignoreCase ? \Normalizer::NFD : \Normalizer::NFC;
- normalizer_is_normalized($suffix, $form) ?: $suffix = normalizer_normalize($suffix, $form);
- if ('' === $suffix || false === $suffix) {
- return false;
- }
- if ($this->ignoreCase) {
- return 0 === mb_stripos(grapheme_extract($this->string, \strlen($suffix), \GRAPHEME_EXTR_MAXBYTES, \strlen($this->string) - \strlen($suffix)), $suffix, 0, 'UTF-8');
- }
- return $suffix === grapheme_extract($this->string, \strlen($suffix), \GRAPHEME_EXTR_MAXBYTES, \strlen($this->string) - \strlen($suffix));
- }
- public function equalsTo($string): bool
- {
- if ($string instanceof AbstractString) {
- $string = $string->string;
- } elseif (\is_array($string) || $string instanceof \Traversable) {
- return parent::equalsTo($string);
- } else {
- $string = (string) $string;
- }
- $form = null === $this->ignoreCase ? \Normalizer::NFD : \Normalizer::NFC;
- normalizer_is_normalized($string, $form) ?: $string = normalizer_normalize($string, $form);
- if ('' !== $string && false !== $string && $this->ignoreCase) {
- return \strlen($string) === \strlen($this->string) && 0 === mb_stripos($this->string, $string, 0, 'UTF-8');
- }
- return $string === $this->string;
- }
- public function indexOf($needle, int $offset = 0): ?int
- {
- if ($needle instanceof AbstractString) {
- $needle = $needle->string;
- } elseif (\is_array($needle) || $needle instanceof \Traversable) {
- return parent::indexOf($needle, $offset);
- } else {
- $needle = (string) $needle;
- }
- $form = null === $this->ignoreCase ? \Normalizer::NFD : \Normalizer::NFC;
- normalizer_is_normalized($needle, $form) ?: $needle = normalizer_normalize($needle, $form);
- if ('' === $needle || false === $needle) {
- return null;
- }
- try {
- $i = $this->ignoreCase ? grapheme_stripos($this->string, $needle, $offset) : grapheme_strpos($this->string, $needle, $offset);
- } catch (\ValueError $e) {
- return null;
- }
- return false === $i ? null : $i;
- }
- public function indexOfLast($needle, int $offset = 0): ?int
- {
- if ($needle instanceof AbstractString) {
- $needle = $needle->string;
- } elseif (\is_array($needle) || $needle instanceof \Traversable) {
- return parent::indexOfLast($needle, $offset);
- } else {
- $needle = (string) $needle;
- }
- $form = null === $this->ignoreCase ? \Normalizer::NFD : \Normalizer::NFC;
- normalizer_is_normalized($needle, $form) ?: $needle = normalizer_normalize($needle, $form);
- if ('' === $needle || false === $needle) {
- return null;
- }
- $string = $this->string;
- if (0 > $offset) {
- if (0 > $offset += grapheme_strlen($needle)) {
- $string = grapheme_substr($string, 0, $offset);
- }
- $offset = 0;
- }
- $i = $this->ignoreCase ? grapheme_strripos($string, $needle, $offset) : grapheme_strrpos($string, $needle, $offset);
- return false === $i ? null : $i;
- }
- public function join(array $strings, string $lastGlue = null): AbstractString
- {
- $str = parent::join($strings, $lastGlue);
- normalizer_is_normalized($str->string) ?: $str->string = normalizer_normalize($str->string);
- return $str;
- }
- public function length(): int
- {
- return grapheme_strlen($this->string);
- }
- public function normalize(int $form = self::NFC): parent
- {
- $str = clone $this;
- if (\in_array($form, [self::NFC, self::NFKC], true)) {
- normalizer_is_normalized($str->string, $form) ?: $str->string = normalizer_normalize($str->string, $form);
- } elseif (!\in_array($form, [self::NFD, self::NFKD], true)) {
- throw new InvalidArgumentException('Unsupported normalization form.');
- } elseif (!normalizer_is_normalized($str->string, $form)) {
- $str->string = normalizer_normalize($str->string, $form);
- $str->ignoreCase = null;
- }
- return $str;
- }
- public function prepend(string ...$prefix): AbstractString
- {
- $str = clone $this;
- $str->string = (1 >= \count($prefix) ? ($prefix[0] ?? '') : implode('', $prefix)).$this->string;
- normalizer_is_normalized($str->string) ?: $str->string = normalizer_normalize($str->string);
- if (false === $str->string) {
- throw new InvalidArgumentException('Invalid UTF-8 string.');
- }
- return $str;
- }
- public function replace(string $from, string $to): AbstractString
- {
- $str = clone $this;
- normalizer_is_normalized($from) ?: $from = normalizer_normalize($from);
- if ('' !== $from && false !== $from) {
- $tail = $str->string;
- $result = '';
- $indexOf = $this->ignoreCase ? 'grapheme_stripos' : 'grapheme_strpos';
- while ('' !== $tail && false !== $i = $indexOf($tail, $from)) {
- $slice = grapheme_substr($tail, 0, $i);
- $result .= $slice.$to;
- $tail = substr($tail, \strlen($slice) + \strlen($from));
- }
- $str->string = $result.$tail;
- normalizer_is_normalized($str->string) ?: $str->string = normalizer_normalize($str->string);
- if (false === $str->string) {
- throw new InvalidArgumentException('Invalid UTF-8 string.');
- }
- }
- return $str;
- }
- public function replaceMatches(string $fromRegexp, $to): AbstractString
- {
- $str = parent::replaceMatches($fromRegexp, $to);
- normalizer_is_normalized($str->string) ?: $str->string = normalizer_normalize($str->string);
- return $str;
- }
- public function slice(int $start = 0, int $length = null): AbstractString
- {
- $str = clone $this;
- if (\PHP_VERSION_ID < 80000 && 0 > $start && grapheme_strlen($this->string) < -$start) {
- $start = 0;
- }
- $str->string = (string) grapheme_substr($this->string, $start, $length ?? 2147483647);
- return $str;
- }
- public function splice(string $replacement, int $start = 0, int $length = null): AbstractString
- {
- $str = clone $this;
- if (\PHP_VERSION_ID < 80000 && 0 > $start && grapheme_strlen($this->string) < -$start) {
- $start = 0;
- }
- $start = $start ? \strlen(grapheme_substr($this->string, 0, $start)) : 0;
- $length = $length ? \strlen(grapheme_substr($this->string, $start, $length ?? 2147483647)) : $length;
- $str->string = substr_replace($this->string, $replacement, $start, $length ?? 2147483647);
- normalizer_is_normalized($str->string) ?: $str->string = normalizer_normalize($str->string);
- if (false === $str->string) {
- throw new InvalidArgumentException('Invalid UTF-8 string.');
- }
- return $str;
- }
- public function split(string $delimiter, int $limit = null, int $flags = null): array
- {
- if (1 > $limit = $limit ?? 2147483647) {
- throw new InvalidArgumentException('Split limit must be a positive integer.');
- }
- if ('' === $delimiter) {
- throw new InvalidArgumentException('Split delimiter is empty.');
- }
- if (null !== $flags) {
- return parent::split($delimiter.'u', $limit, $flags);
- }
- normalizer_is_normalized($delimiter) ?: $delimiter = normalizer_normalize($delimiter);
- if (false === $delimiter) {
- throw new InvalidArgumentException('Split delimiter is not a valid UTF-8 string.');
- }
- $str = clone $this;
- $tail = $this->string;
- $chunks = [];
- $indexOf = $this->ignoreCase ? 'grapheme_stripos' : 'grapheme_strpos';
- while (1 < $limit && false !== $i = $indexOf($tail, $delimiter)) {
- $str->string = grapheme_substr($tail, 0, $i);
- $chunks[] = clone $str;
- $tail = substr($tail, \strlen($str->string) + \strlen($delimiter));
- --$limit;
- }
- $str->string = $tail;
- $chunks[] = clone $str;
- return $chunks;
- }
- public function startsWith($prefix): bool
- {
- if ($prefix instanceof AbstractString) {
- $prefix = $prefix->string;
- } elseif (\is_array($prefix) || $prefix instanceof \Traversable) {
- return parent::startsWith($prefix);
- } else {
- $prefix = (string) $prefix;
- }
- $form = null === $this->ignoreCase ? \Normalizer::NFD : \Normalizer::NFC;
- normalizer_is_normalized($prefix, $form) ?: $prefix = normalizer_normalize($prefix, $form);
- if ('' === $prefix || false === $prefix) {
- return false;
- }
- if ($this->ignoreCase) {
- return 0 === mb_stripos(grapheme_extract($this->string, \strlen($prefix), \GRAPHEME_EXTR_MAXBYTES), $prefix, 0, 'UTF-8');
- }
- return $prefix === grapheme_extract($this->string, \strlen($prefix), \GRAPHEME_EXTR_MAXBYTES);
- }
- public function __wakeup()
- {
- if (!\is_string($this->string)) {
- throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
- }
- normalizer_is_normalized($this->string) ?: $this->string = normalizer_normalize($this->string);
- }
- public function __clone()
- {
- if (null === $this->ignoreCase) {
- normalizer_is_normalized($this->string) ?: $this->string = normalizer_normalize($this->string);
- }
- $this->ignoreCase = false;
- }
- }
- <?php
- if (PHP_SAPI !== 'cli' && PHP_SAPI !== 'phpdbg') {
- echo 'Warning: Composer should be invoked via the CLI version of PHP, not the '.PHP_SAPI.' SAPI'.PHP_EOL;
- }
- if (PHP_VERSION_ID < 70205) {
- 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;
- exit(1);
- }
- setlocale(LC_ALL, 'C');
- require __DIR__.'/../src/bootstrap.php';
- use Composer\Console\Application;
- use Composer\XdebugHandler\XdebugHandler;
- use Composer\Util\Platform;
- use Composer\Util\ErrorHandler;
- error_reporting(-1);
- // Restart without Xdebug
- $xdebug = new XdebugHandler('Composer');
- $xdebug->check();
- unset($xdebug);
- if (defined('HHVM_VERSION') && version_compare(HHVM_VERSION, '4.0', '>=')) {
- echo 'HHVM 4.0 has dropped support for Composer, please use PHP instead. Aborting.'.PHP_EOL;
- exit(1);
- }
- if (!extension_loaded('iconv') && !extension_loaded('mbstring')) {
- echo 'The iconv OR mbstring extension is required and both are missing.'
- .PHP_EOL.'Install either of them or recompile php without --disable-iconv.'
- .PHP_EOL.'Aborting.'.PHP_EOL;
- exit(1);
- }
- if (function_exists('ini_set')) {
- @ini_set('display_errors', '1');
- // Set user defined memory limit
- if ($memoryLimit = getenv('COMPOSER_MEMORY_LIMIT')) {
- @ini_set('memory_limit', $memoryLimit);
- } else {
- $memoryInBytes = function ($value) {
- $unit = strtolower(substr($value, -1, 1));
- $value = (int) $value;
- switch($unit) {
- case 'g':
- $value *= 1024;
- // no break (cumulative multiplier)
- case 'm':
- $value *= 1024;
- // no break (cumulative multiplier)
- case 'k':
- $value *= 1024;
- }
- return $value;
- };
- $memoryLimit = trim(ini_get('memory_limit'));
- // Increase memory_limit if it is lower than 1.5GB
- if ($memoryLimit != -1 && $memoryInBytes($memoryLimit) < 1024 * 1024 * 1536) {
- @ini_set('memory_limit', '1536M');
- }
- unset($memoryInBytes);
- }
- unset($memoryLimit);
- }
- // Workaround PHP bug on Windows where env vars containing Unicode chars are mangled in $_SERVER
- // see https://github.com/php/php-src/issues/7896
- if (PHP_VERSION_ID >= 70113 && (PHP_VERSION_ID < 80016 || (PHP_VERSION_ID >= 80100 && PHP_VERSION_ID < 80103)) && Platform::isWindows()) {
- foreach ($_SERVER as $serverVar => $serverVal) {
- if (($serverVal = getenv($serverVar)) !== false) {
- $_SERVER[$serverVar] = $serverVal;
- }
- }
- }
- Platform::putEnv('COMPOSER_BINARY', realpath($_SERVER['argv'][0]));
- ErrorHandler::register();
- // run the command application
- $application = new Application();
- $application->run();
- Copyright (c) Nils Adermann, Jordi Boggiano
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is furnished
- to do so, subject to the following conditions:
- The above copyright notice and this permission notice shall be included in all
- copies or substantial portions of the Software.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
- ïÈÍÙ¾·^‘¯ð%8s><Ø}ªië‘'LçéM'ˆ‰²“-ô¥}õÀ0•¯6òa¯ ‹OžS. Jb$á÷Ý„���GBMB
|